
    N&iL                         d Z ddlmZ ddlZdZddZddZddZed	k    r+d
Z	 e
 ee	                              d                     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.
    )print_functionNzP\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--inputencoding=utf8Tstdinstdoutstderr	close_fdsutf8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
             r/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/docutils/utils/math/tex2mathml_extern.pyr   r      s   
 	   
 #-/#-?#-?&*	, 	, 	,A GMM$y088@@AAAGMMOOO8==??L(--//((00K $[%%g..!33<3{###       %/O%/_%/_(,
. 
. 
.F L|$$$
L]!!((00F##%%,,V44J #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                 <    g | ]}|                     d           |S )z****)
startswith).0lines     r(   
<listcomp>zttm.<locals>.<listcomp>`   s8     5 5 5$ OOF335 5 5 5r)   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+   M   st   
 	   
  * * *#'	) 	) 	)A GMM$y088@@AAAGMMOOOX]]__F
(--//
 
 
(
(C
xx1$$ii 5 5#..*:*: 5 5 5 6 6DcIJJJ CHH\**a//v/sW%%v{{9'='=a'?3EE#IFMr)   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    rCt          d||                    d          dz   |                    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/
    )
z--mathmlz
--indentedz	--spacingmoderatez--mathml-encodingrawz--other-encodingr9   z--doctype-xhtml+mathmlz--annotate-TeX zmode="display"z--displaymath	blahtexmlTr   r   z<error>r   z,
Message from external converter blahtexml:
z	<message>	   z
</message>r2   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$   r5   r&   r'   s
             r(   r;   r;   i   s   
  G  (''''+w.) * *#'		) 	) 	)A
 GMM)""6**+++GMMOOOX]]__##F++F
(--//
 
 
(
(C{{9""JK0026;;|3L3LLMN O O 	O SXXl++q000sZ((*FKK,D,D3EE ,fU3Y.?.?.?AFMr)   __main__uG   \frac{\partial \sin^2(\alpha)}{\partial \vec r}\varpi \, \text{Grüße}r   )N)TN)__doc__
__future__r   r   r   r   r+   r;   __name__exampleprintr    r)   r(   <module>rH      s     & % % % % %     , , , ,\   8% % % %R z.G 
E))G


#
#F
+
+,,,,, r)   