o n§¥_ã@s\ddlmZddlZdZddd„Zddd„Zdd d „Zed kr,d Ze eeƒ  d ¡ƒdSdS)é)Úprint_functionNzP\documentclass{article} \usepackage{amsmath} \begin{document} %s \end{document} c Cs&tjgd¢tjtjtjdd}|j t| d¡¡|j ¡|j  ¡}|j   ¡  d¡}|r<|  d¡dks7|s<|  |¡tjgd¢tjtjtjdd}|j |¡|j ¡|j  ¡  d¡}|j   ¡  d¡}|rv|  d¡dksq|sv|  |¡|  d¡|  d ¡d }} ||| …}d |vr‘t|ƒ‚|S) zdConvert LaTeX math code to MathML with LaTeXML_ .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/ )Úlatexmlú-z--inputencoding=utf8T©ÚstdinÚstdoutÚstderrÚ close_fdsÚutf8ÚErrorr)Ú latexmlpostrz--nonumbersectionsz--format=xhtmlz--úézclass="ltx_ERROR)Ú subprocessÚPopenÚPIPErÚwriteÚdocument_templateÚencodeÚcloserÚreadrÚdecodeÚfindÚerrorÚ SyntaxError) Ú math_codeÚreporterÚpÚ latexml_codeÚ latexml_errÚpost_pÚresultÚ post_p_errÚstartÚend©r&úG/usr/lib/python3/dist-packages/docutils/utils/math/tex2mathml_extern.pyrs: ø    ö   rcCsÔtjgd¢tjtjtjdd}|j t| d¡¡|j ¡|j  ¡}|j   ¡  d¡}|  d¡dkrEd  dd „| ¡Dƒ¡}td |ƒ‚|rN|  d ¡dksP|sU| |¡|  d ¡|  d ¡d}}|||…}|S)zgConvert LaTeX math code to MathML with TtM_ .. _TtM: http://hutchinson.belmont.ma.us/tth/mml/ )Úttmz-uz-rTrr z **** UnknownrÚ cSsg|] }| d¡r|‘qS)z****)Ú startswith)Ú.0Úliner&r&r'Ú ]s ÿzttm..z& Message from external converter TtM: ú **** Errorr rr)rrrrrrrrrrrrrÚjoinÚ splitlinesrr)rrrr"ÚerrÚmsgr$r%r&r&r'r(Js$ ø     r(Tc Csgd¢}|r d}nd}| d¡tjdg|tjtjtjdd}|j | d¡¡|j ¡|j  ¡  d¡}|j   ¡  d¡}|  d ¡d krWt d ||  d ¡d |  d¡…ƒ‚|rg|  d¡d ksb|sg| |¡|  d¡d |  d¡}} d|||| …f}|S)zlConvert LaTeX math code to MathML with blahtexml_ .. _blahtexml: http://gva.noekeon.org/blahtexml/ ) z--mathmlz --indentedz --spacingÚmoderatez--mathml-encodingÚrawz--other-encodingr4z--doctype-xhtml+mathmlz--annotate-TeXÚzmode="display"z --displaymathÚ blahtexmlTrr zrz, Message from external converter blahtexml: z é z r.zz z> %s )Úappendrrrrrrrrrrrrrr) rÚinlinerÚoptionsÚ mathmode_argrr"r1r$r%r&r&r'r6fs4  ü ÿ ÿr6Ú__main__uG\frac{\partial \sin^2(\alpha)}{\partial \vec r}\varpi \, \text{Grüße}r )N)TN) Ú __future__rrrrr(r6Ú__name__ÚexampleÚprintrr&r&r&r'Ús   . )û