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



$PrePrint =.;

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

Before edit:

$PrePrint =.;

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

Is this what you are after?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.