# Outputting a fraction on one line with an oblique division sign

How can I make Mathematica output a fraction as x/2 as opposed to the x on top with a horizontal bar and 2 on the bottom?

Perhaps I need to work more with Riffle but so far I cannot get it. I have tried concatenating strings, but Mathematica reverses the order of the two elements. Specifically, I am trying to put the symbol theta with a subscript i and then a division by 2. It is going onto a figure, and is very difficult to read with the vertical division.

My code is:

Do[
alabel[i] =
Text[StyleForm[Subscript["\[Theta]", i]/2, FontSize -> 10,
FontColor -> Black, FontFamily -> "Times"],
{Re[ww[tt[]]], Im[ww[tt[]]]} + .2 {Cos[aloc3[[i]]], Sin[aloc3[[i]]]},
ioffset[i]]
, {i, 1, 6}];

th3 = Graphics[Table[alabel[j], {j, 1, 6}]];


(The coordinate ww[[tt[]]] is just some point in the plane).

• I can't understand what you are trying to accomplish by inserting text with 3D coordinates into a 2D graphics object. Could you clarify your Question regarding that. Oct 7 '13 at 21:38

\$PrePrint =
RawBoxes[ToBoxes[#] //.
FractionBox[x_, y_] :>
RowBox[{If[Head[x] === RowBox, RowBox[{"(", x, ")"}], x], "/",
If[Head[y] === RowBox, RowBox[{"(", y, ")"}], y]}]] &;


Then every fraction in your output will be of the form x/y.

For example: Assuming you want your labels inserted into a 2D Graphic, it can be done like this:

With[{n = 3},
Module[{pts, lbls},
SeedRandom@1; pts = RandomReal[1., {n, 2}];
lbls =
Table[
Text[Row[{Subscript[θ, i], "/\[ThinSpace]2"}, "",
BaseStyle -> {"TR", 10}], pts[[i]]],
{i, Range @ n}];
Framed @ Graphics[lbls]]] The salient points in the above example are in the use of Row with the option BaseStyle and in adding a \[ThinSpace] to adjust the spacing between the slash and the denominator 2. Without the \[ThinSpace] the text looks too tight.

Here's a way to get the slash to not be written in the standard form:

Plot[Sin[2 Pi t], {t, 0, 2 Pi}, PlotLabel -> Row[{Subscript[θ, i], "/", 2}]] 