# Inline cells and conversion rules

In the following link you can find the following about ConversionRules when exporting to HTML:

specifies mappings from Mathematica cell styles to HTML elements, including both inline and block-level versions of the markup

Lets define the following temporary function with the following conversion rules:

TempFunction[expr_] := ExportString[expr, "HTML",
"FullDocument" -> False,
"ConversionRules" -> {
"InlineMath" -> {
{"<inline>", ConvertTeXBoxesToTeX[#] &, "</inline>"},
{"<block>", ConvertTeXBoxesToTeX[#] &, "</block>"}
},
"Text" -> {
{"<inlineText>", "</inlineText>"},
{"<blockText>", "</BlockText>"}
},
"" -> {"", ""}
}
]


As the quote says, I have specified both the inline and block versions of the mapping. Now lets use it to see if they work as intended.

# CASE 1:

Here we use a single block cell.

TempFunction[
]


The output is:

<block>x=y</block>


# CASE 2:

Here we use an inline cell.

TempFunction[
Cell[TextData[{"Let ",
Cell[BoxData[
FormBox[RowBox[{"x", " ", "=", " ", SuperscriptBox["y", "2"]}],
]

<blockText>Let <inline>x = y^2</inline>.</BlockText>


# CASE 3:

TempFunction[
Cell[TextData[{"Let ",
Cell[BoxData[
FormBox[RowBox[{"x", " ", "=", " ", "y"}], TraditionalForm]],
"InlineMath", FormatType -> "TraditionalForm"], "."}], "Text"]
]

<blockText>Let <inline><em>x</em><em> </em><em>=</em><em> </em><em>y</em></inline>.</BlockText>


I was expecting this:

<blockText>Let <inline>x = y</inline>.</BlockText>


Is this a bug? What style is being surrounded by the tag em? Case 1 and Case 2 make sense, but Case 3 has me scratching my head. Can someone explain this behavior?

-
Weird behaviour, that just by adding a superscriptbox in a rowbox, single letters are emphasized –  Rojo May 27 '12 at 5:51
@Rojo methink it is the other way around ... –  belisarius May 27 '12 at 6:14
@belisarius and Rojo, Since you guys are checking this out, try replacing TraditionalForm for TextForm in CASE 3. What do you guys think? –  jmlopez May 27 '12 at 6:23
@belisarious, I was being ironic, I meant the opposite, couldn't you tell? –  Rojo May 27 '12 at 6:46
@jmlopez, you mean that the problem gets fixed? Same happens with StandardForm. Probably has to do with TraditionalForm having SingleLetterItalics set to true. Can't test much right now –  Rojo May 27 '12 at 6:49

You should be able to turn this off globally for your current kernel session by using a variant of the solution posted by Albert Retey to an earlier question of mine:

SetOptions[\$FrontEnd,
FormatType :> (Style[TraditionalForm[##],SingleLetterItalics -> False] &)]


You might also want to set the same for Graphics, depending on what you are exporting.

SetOptions[Graphics,
FormatType :> (Style[TraditionalForm[##],SingleLetterItalics -> False] &)]

-
This didn't seem to work, at least with the example that I showed. Still, +1, for showing me that you can modify different parts of a style. For now, the best answer I have is set DefaultInlineFormatType->TextForm, in the notebook options. That way, when you write inline cells, in this case, my InlineMath cell, then it will have the TextForm as default and the HTML converter will not emphasize the letters. –  jmlopez May 28 '12 at 17:21