Ziamath¶
Ziamath renders MathML or LaTeX Math expressions as SVG paths using only the Python standard library. Does not require a Latex installation, nor rely on any third party or online services. It can use any math-enabled font, such as STIXTwoMath-Regular which comes included with Ziamath for use by default. The resulting SVGs are drawn entirely with <path> elements, so the image does not depend on having the font available.
Example¶
To render from MathML:
import ziamath as zm
zm.Math(
'''<mrow>
<mi> y </mi>
<mo> = </mo>
<mi> f </mi>
<mo> ⁡ </mo>
<mrow>
<mo> ( </mo>
<mi> x </mi>
<mo> ) </mo>
</mrow>
</mrow>''')
To render from Latex:
zm.Latex(r'\frac{1}{1-x^2}')
Demo¶
See Ziamath in action as it runs in your browser through PyScript here!
Support¶
If you appreciate Ziamath, buy me a coffee to show your support!
Source code is available on Github.
Ziamath is also used by the Ziaplot and Schemdraw Python packages, and was used for rendering the SVG and PNG equations on MathGrabber.