# How can I format DisplayFormula Cell into TraditionalForm when export as HTML

This example is in DisplayFormula cell.

cellExpression=Cell[BoxData[RowBox[{RowBox[{SuperscriptBox["f","\[Prime]",MultilineFunction->None],RowBox[{"(","x",")"}]}],"=",RowBox[{RowBox[{"sin","",FractionBox["1","x"]}],"-",RowBox[{FractionBox["1","x"],"cos",FractionBox["1","x"],RowBox[{"(",RowBox[{"x","!=","0"}],")"}]}]}]}]],"DisplayFormulaNumbered"];CellPrint@cellExpression


How can I format them to the appearance like the following in batch.

I set FontSize->Times, and Italic for $\color{Green}{f'(x)}$, $x$ seperately, but not so easy for too many InlineFormula/DisplayFormula/... cells by hand.

\begin{align*}\color{blue}{f'(x)}=\sin \frac{1}{\color{red}{x}}-\frac{1}{\color{red}{x}}\cos\frac{1}{\color{red}{x}}(\color{red}{x}\neq 0)\tag{1}\end{align*}

When I export notebook as html, the formulas are rasterized to image which not in TraditionalForm which shown above as that I setted by hand.

sample typesetting, inline formulas are images, I'm thinking that how to make them more beautiful and more traditional formal. Most of them are typed into Mathematica by hand

As you'll see that some single fs are Times Italic, they are good shown, but in DisplayFormula they are not.

### Edit:

Mike Honeychurch's example

My Setting(related?):

### ------------Note:

I've tried Mike's method, however failed, how about yours.

I'm on Windows and Mathemtaica 9.

-
@Nasser well, good to know about that, I'll consider it after I can play around converting Notebook To Latex well. –  HyperGroups Jul 15 '13 at 5:54

Your underlying box structure is not quite right. You need to add FormBoxes and TextData. e.g.

cellExpression =
Cell[TextData[
Cell[BoxData[
FormBox[RowBox[{RowBox[{SuperscriptBox["f", "\[Prime]",
MultilineFunction -> None], RowBox[{"(", "x", ")"}]}],
"=", RowBox[{RowBox[{"sin", "", FractionBox["1", "x"]}], "-",
RowBox[{FractionBox["1", "x"], "cos",
FractionBox["1", "x"],
RowBox[{"(", RowBox[{"x", "\[NotEqual]", "0"}],
], "DisplayFormulaNumbered"];
CellPrint@cellExpression


The correct form can be determined by building these equations in a e.g. text cell, starting with the new cell and then pressing control 9.

Edit

pasted is the gif image that Mathematica generates when you save the code and generated cell above as HTML.

I did this with V8 on Mac 10.6.8

-
When I saved your sample as .html, they're also not traditional form. How about in yours? –  HyperGroups Jul 15 '13 at 5:50
yep they are traditional form. see edit. –  Mike Honeychurch Jul 15 '13 at 6:11
I donot know why I can't follow your effect, only Output Cell and InlineFormula cell can become TraditionalForm. –  HyperGroups Aug 12 '13 at 13:35
What version & platform are you using and what stylesheet are you using? Have you modified the stylesheet? –  Mike Honeychurch Aug 12 '13 at 21:53
mathematica 9, windows 8, Default Stylesheet and Styled stylesheets. –  HyperGroups Aug 13 '13 at 0:50