Skip to main content

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?



enter image description here





New added:



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.



enter image description here




Answer



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?


Comments