# Why are graphics rendered as MathML when I set $PrePrint = MathMLForm? For external usage, I set output in MathMLForm by using $PrePrint=MathMLForm

Everything goes well but makes graphics rendered in MathMLForm as well. How could I make graphics rendered as image?

Thanks for @Kuba, But I am facing another problem when execute script like:

Table[Plot[f[x], {x, -2 Pi, 2 Pi}, Exclusions -> {1/f[x] == 0}],
{f, {Tan, Cot, Csc, Sec}}]


The final result is not a type of graphics, but it contains graphics. So it rendered in MathML finally.

Edit:

$PrePrint =.;$PrePrint = With[{expr = #},
If[MemberQ[expr, _Graphics | _Graphics3D | _Graph, {0, ∞}],
expr,
MathMLForm[expr]]] &;


Before edit:

$PrePrint =.;$PrePrint = If[MatchQ[#, _Graphics | _Graphics3D | _Graph], #, MathMLForm[#]] &;


Is this what you are after?

• Thanks! @Kuba. This is exactly what i want. – Michael May 23 '14 at 9:40
• Hi @Kuba, I am facing another problem when using the script. Would you please take a look ? thanks! – Michael May 24 '14 at 6:50
• Done. You replied so fast as I didn't finish the update :p – Michael May 24 '14 at 6:59
• thanks again, I added MatchQ statement for graphics only scenario. And it's all right now. – Michael May 24 '14 at 7:24
• @Michael not needed but thanks for paying attention, I have to get a coffee :) Added {0, \[Infinity]} – Kuba May 24 '14 at 7:29