LaTeX Math DisplayΒΆ

_images/mathjax.png

LaTeX is available to users of the vpython module in a Jupyter notebook.

In Web VPython, LaTeX may be used with MathJax to display math equations in the title or caption field of a canvas. MathJax requires that:

  • All LaTeX backslashes must be replace by double backslashes.

  • Expressions must be bracketed by \\( and \\) intstead of dollar signs.

box()
scene.caption = "Final kinetic energy = \\( \\dfrac {1} {2}mv_i^{2}+\\int _{i}^{f}\\vec{F}\\cdot d \\vec{r} \\)"
scene.title = "\\(\\dfrac {5} {7} \\)"
MathJax.Hub.Queue(["Typeset",MathJax.Hub])

To typeset only a specific element:

scene.title = "\\(\\dfrac {3y} {4x} \\)"
MathJax.Hub.Queue(["Typeset",MathJax.Hub,scene.title])