I need to typeset large number of equations to be used for PlotLabel
and Titles
and such. These have to look nice. Hence I use TraditionalForm
with HoldForm
and this works well, except for a tiny little annoying thing. This below is just an example:
TraditionalForm[HoldForm[(v/w) Sin[w t]]]
displays as $\frac{v \ \sin(t)}{w}$ and not as $\frac{v}{w} \sin(t)$. In otherwords, the Sin[x]
was put in the numerator as well, where I'd like it to remain on its own as was typed.
I used ()
above as a hint to leave Sin[]
alone, but this hint did nothing.
An easy fix is to use HoldForm
around each small sub-expression as follows
TraditionalForm[Row[{HoldForm[(v/w)], HoldForm[Sin[w t]]}]]
which now generates $\frac{v}{w} \sin(t)$
But the above is a small example. I have much larger equations, and would be nice if I could tell Mathematica when I type it, using ()
or another trick, to please not group these subexpression as it did in the above example (I'd like the equations to look exactly as they appear in the text book.
It is not a big issue really to use HoldForm
many times to force the shape to look exactly as I wanted, but just thought to check if someone knows an easier way to do this other than what I have shown.
I just had a thought! is it possible to use $\LaTeX$ directly to typeset things in Mathematica for purpose of display? i.e. it would be nice if one can write something like Text["$\frac{v}{w} \sin(t)$"]
and have Mathematica interpret this as $\LaTeX$, and typeset it as $\LaTeX$ output. If possible, I can just write everything in $\LaTeX$ as strings, and problems solved. What I mean by the above is as follows (only to help explain the point):
In MATLAB I can do this:
text(.5,.5,'$\frac{v}{w} \sin(t)$','interpreter','latex','FontSize',18)
which generates
Notice I had to tell MATLAB to use the $\LaTeX$ interpreter. But that is all. It will be really nice to be able to do something like this in Mathematica if possible. Using String
s also avoids many other problems when typesetting symbolic expressions in Mathematica since a string is inert and a raw Symbol
and can't have value other than itself.
Thanks.
TraditionalForm[HoldForm[(v/w)] Sin[w t]]
$\endgroup$