Ziamath renders MathML or LaTeX Math expressions as SVG paths. Does not require a Latex installation, nor rely on any third party services, but rather uses math-enabled fonts, 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.
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:
Ziamath can be installed using pip:
pip install ziamath
Ziamath natively draws MathML. For Latex support, the latex2mathml package is used to convert the Latex into MathML first. It can be installed along with ziamath:
pip install ziamath[latex]
Ziamath depends on its sister package, Ziafont, for reading TTF font files.