3 E\@sLddlZdZd ddZdddZddd Zed krHd Zeeejd dS)NzP\documentclass{article} \usepackage{amsmath} \begin{document} %s \end{document} c Cs4tjdddgtjtjtjdd}|jjt|jd|jj|jj }|j j j d}|rl|j ddksr| r||j |tjd dd d d gtjtjtjdd}|jj||jj|jj j d}|j j j d}|r|j ddks| r|j ||j d |j dd}} ||| }d|kr0t||S)zhConvert LaTeX math code to MathML with LaTeXML_ .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/ latexml-z--inputencoding=utf8T)stdinstdoutstderr close_fdsutf8ErrorrZ latexmlpostz--nonumbersectionsz--format=xhtmlz--zzclass="ltx_ERROR) subprocessPopenPIPErwritedocument_templateencodecloserreadrdecodefinderror SyntaxError) math_codereporterpZ latexml_codeZ latexml_errZpost_presultZ post_p_errstartendr/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/docutils/docutils/utils/math/tex2mathml_extern.pyrsB        rcCstjdddgtjtjtjdd}|jjt|jd|jj|jj }|j j j d}|j ddkrd j d d |jD}td ||r|j d dks| r|j||j d|j dd}}|||}|S)zkConvert LaTeX math code to MathML with TtM_ .. _TtM: http://hutchinson.belmont.ma.us/tth/mml/ ttmz-uz-rT)rrrrrz **** Unknownr cSsg|]}|jdr|qS)z****) startswith).0linerrr \szttm..z& Message from external converter TtM: z **** Errorzr )r r r rrrrrrrrrrjoin splitlinesrr)rrrrerrmsgrrrrrrIs&     rTc Csdddddddddd g }|r"d }nd }|jd tjd g|tjtjtjdd}|jj|jd|jj|jj j d}|j j j d}t ||j ddkrtd||j dd|j d|r|j ddks| r|j||j dd|j d}} d|||| f}|S)zpConvert LaTeX math code to MathML with blahtexml_ .. _blahtexml: http://gva.noekeon.org/blahtexml/ z--mathmlz --indentedz --spacingZmoderatez--mathml-encodingrawz--other-encodingz--doctype-xhtml+mathmlz--annotate-TeXzmode="display"z --displaymath blahtexmlT)rrrrrzrz, Message from external converter blahtexml: z z z **** Errorzz z> %s )appendr r r rrrrrrrrprintrrr) rinlineroptionsZ mathmode_argrrr'rrrrrr+es<     r+__main__uH\frac{\partial \sin^2(\alpha)}{\partial \vec r} \varpi \, \text{Grüße}r)N)N)TN) r rrrr+__name__exampler.rrrrrs .  *