I find that the equations I write in Mathematica are not always publication quality. Here is a typical example:

If I copy as Latex, then I get the following code:
\frac{\sum _{i=1}^N \frac{(k|k) \tilde{x}_j^i}{\sqrt{P_{\text{jj}} (k|k)}}}{N}
This code is actually kind of messed up and does not reproduce the equation correctly, but it is easy to manually edit it to create the right Latex code:
\frac{1}{N}{\sum _{i=1}^N \frac{ \tilde{x}_j^i(k|k)}{\sqrt{P_{\text{jj}} (k|k)}}}
Now, if we render this Latex code we get a much nicer looking version of the same equation:

The sigma looks better, variables are italicized, the vertical line (not sure what it is called) looks much better. The runt vertical line in Mathematica just looks really bad. Also, the coloring is removed, which for my purposes is better because I am including the equation in black and white text and do not want randomly colored symbols.
My question is: how can I make the equation look better in the notebook? For example, if I am using Mathematica to make a slide show or presentation, I want the equation to look as professional as possible, but still be an editable cell. What are my options?
Note that using TraditionalForm has the following consequences:

Update
If we really torture it with both Defer and HoldForm, looks like we can get the typeset equation:

Answer
Typesetting in Text cells
Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{
FractionBox["1", "N"],
RowBox[{
UnderoverscriptBox["\[Sum]",
RowBox[{"i", "=", "1"}], "N"],
FractionBox[
RowBox[{
SubsuperscriptBox[
OverscriptBox["x","~"],
"j", "i"],
"(",
RowBox[{"k", "|", "k"}], ")"}],
SqrtBox[
RowBox[{
SubscriptBox["P", "jj"], "(",
RowBox[{"k", "|", "k"}], ")"}]]]}]}],
TraditionalForm]]]], "Text",
UnderoverscriptBoxOptions->{LimitsPositioning->False},
OverscriptBoxOptions->{DiacriticalPositioning->True},
FractionBoxOptions->{AllowScriptLevelChange->False}]
gives

This was typeset in a text cell by starting with Ctrl-9 and then typing

The default ScriptLevel for inline cells is 1 so I set that to 0 in a private style (Format > Edit Stylesheet):

The additional UnderoverscriptBox, OverscriptBox and FractionBox options were set via the option inspector. You can do additional tweeking by nudging terms around via Insert > Typesetting.
Typesetting in Input cells
Wrapping TraditionalForm around your expression, as per your updated question, is intended to render the output as traditional form. However your question seems to be framed around having traditional looking equations that -- based on your update -- can be evaluated.
If you want all you input and output to appear like this then set this globally in your preferences:

Then in your input cells you can type the equation and it will appear in traditional form:

If you only want to convert certain cells then either make the changes via the menu Cell > Convert To or via a right click:

which produces:

Comments
Post a Comment