
    zih                     r    d Z ddlZdZddZddZddZddZed	k    rd
Z e	 ee                     dS dS )zWrappers for TeX->MathML conversion by external tools

This module is provisional:
the API is not settled and may change with any minor Docutils version.
    NzP\documentclass{article}
\usepackage{amsmath}
\begin{document}
%s
\end{document}
c                    t          j        g dt           j        t           j        t           j        d          }|j                            t
          | z                      d                     |j                                         |j        	                                }|j
        	                                                    d          }|r0|                    d          dk    s|s|                    |           t          j        g dt           j        t           j        t           j        d          }|j                            |           |j                                         |j        	                                                    d          }|j
        	                                                    d          }|r0|                    d          dk    s|s|                    |           |                    d          |                    d	          d
z   }	}|||	         }d|v rt          |          |S )zdConvert LaTeX math code to MathML with LaTeXML_

    .. _LaTeXML: http://dlmf.nist.gov/LaTeXML/
    )latexml-z--preload=amsfontsz--preload=amsmathz--inputencoding=utf8Tstdinstdoutstderr	close_fdsutf-8Errorr   )latexmlpostr   z--nonumbersectionsz--format=xhtmlz--<math</math>   zclass="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ends
             p/var/www/tmov.alphamb/tmov_inventario/venv/lib/python3.11/site-packages/docutils/utils/math/tex2mathml_extern.pyr   r      s   
 	     * * *#'		) 		) 		)A GMM$y088AABBBGMMOOO8==??L(--//((11K $[%%g..!33<3{### ! ! ! %/O%/_%/_(,
. 
. 
.F L|$$$
L]!!((11F##%%,,W55J #Z__W--22&2z""" W%%v{{9'='=a'?3EE#IFV##&!!!M    c                 $   t          j        g dt           j        t           j        t           j        d          }|j                            t
          | z                      d                     |j                                         |j        	                                }|j
        	                                                    d          }|                    d          dk    rCd                    d |                                D                       }t          d	|z             |r|                    d
          dk    s|s|                    |           |                    d          |                    d          dz   }}|||         S )zgConvert LaTeX math code to MathML with TtM_

    .. _TtM: http://hutchinson.belmont.ma.us/tth/mml/
    )ttmz-uz-rTr   r   z**** Unknownr   
c              3   D   K   | ]}|                     d           |V  dS )z****N)
startswith).0lines     r'   	<genexpr>zttm.<locals>.<genexpr>_   sF       4 4??6224 4 4 4 4 4 4r(   z&
Message from external converter TtM:

**** Errorr   r   r   )r   r   r   r   r   r   r   r   r   r   r	   r   r   join
splitlinesr   r   )r   r   r   r#   errmsgr%   r&   s           r'   r*   r*   L   sp   
 	   
  * * *#'	) 	) 	)A GMM$y088AABBBGMMOOOX]]__F
(--//
 
 
)
)C
xx1$$ii 4 4)9)9 4 4 4 4 4DSHIII CHH\**a//v/sW%%v{{9'='=a'?3E%)r(   Tc                    g d}|rd}nd}|                     d           t          j        dg|z   t          j        t          j        t          j        d          }|j                            |                     d                     |j                                         |j        	                                
                    d          }|j        	                                
                    d          }|                    d	          d
k    rE||                    d          dz   |                    d                   }t          d|z            |r0|                    d          d
k    s|s|                    |           |                    d          dz   |                    d          }
}	d|d||	|
         d}|S )zlConvert LaTeX math code to MathML with blahtexml_

    .. _blahtexml: http://gva.noekeon.org/blahtexml/
    )
--mathmlz
--indentedz	--spacingmoderatez--mathml-encodingrawz--other-encodingr9   z--doctype-xhtml+mathmlz--annotate-TeX z display="block"z--displaymath	blahtexmlTr   r   z<error>r   z	<message>	   z
</message>z.
Message from external converter blahtexml:
%sr1   z<markup>z	</markup>z0<math xmlns="http://www.w3.org/1998/Math/MathML"z>
z</math>
)appendr   r   r   r   r   r   r   r   r   r   r	   r   r   r   )r   inliner   optionsmathmode_argr   r#   r4   r5   r%   r&   s              r'   r;   r;   h   s   
  G  ()'''+w.) * *#'		) 	) 	)A
 GMM)""7++,,,GMMOOOX]]__##G,,F
(--//
 
 
)
)C{{9""V[[--a/L0I0IIJL  ! ! 	! SXXl++q000sZ((*FKK,D,D3EE ,fU3Y.?.?.?AFMr(   c                    t          j        g dt           j        t           j        t           j        d          }|j                            |                     d                     |j                                         |j                                        	                    d          }|j
                                        	                    d                                          }|                                }|r)|r|                    |           t          d|z            |dk    rt          d|z            |                    d          |                    d	          d
z   }}|||         S )zXConvert LaTeX math code to MathML with pandoc_

    .. _pandoc: https://pandoc.org/
    )pandocr7   z--from=latexTr   r   z1
Error message from external converter pandoc:
%sr   z.
Error code from external converter pandoc:
%sr   r   r   )r   r   r   r   r   r   r   r   r   r   r	   stripwaitr   r   r   )r   r   r   r#   r4   xr%   r&   s           r'   rB   rB      s`   
 	     * * *#'	) 	) 	)A GMM)""7++,,,GMMOOOX]]__##G,,F
(--//
 
 
)
)
/
/
1
1C	A
 ! 	 NN3O  ! ! 	!AvvL   	 W%%v{{9'='=a'?3E%)r(   __main__uR   \frac{\partial \sin^2(\alpha)}{\partial \vec r}\varpi \mathbb{R} \, \text{Grüße})N)TN)
__doc__r   r   r   r*   r;   rB   __name__exampleprint r(   r'   <module>rL      s         - - - -`   8& & & &R   D z9G 
E))G

 r(   