
    KiQ
                    D    d Z ddlmZ dZ G d de      Zd Zd
dZddZy	)a4  
This is the Docutils (Python Documentation Utilities) "math" sub-package.

It contains various modules for conversion between different math formats
(LaTeX, MathML, HTML).

:math2html:    LaTeX math -> HTML conversion from eLyXer
:latex2mathml: LaTeX math -> presentational MathML
:unichar2tex:  Unicode character to LaTeX math translation table
:tex2unichar:  LaTeX math to Unicode character translation dictionaries
:mathalphabet2unichar:  LaTeX math alphabets to Unicode character translation
:tex2mathml_extern: Wrapper for 3rd party TeX -> MathML converters
    )annotationsreStructuredTextc                  (     e Zd ZdZg fd fdZ xZS )	MathErrorzException for math syntax and math conversion errors.

    The additional attribute `details` may hold a list of Docutils
    nodes suitable as children for a ``<system_message>``.
    c                2    t         |   |       || _        y )N)super__init__details)selfmsgr
   	__class__s      h/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/site-packages/docutils/utils/math/__init__.pyr	   zMathError.__init__(   s        )returnNone)__name__
__module____qualname____doc__r	   __classcell__)r   s   @r   r   r   "   s    
 %'  r   r   c                T    | j                  d      }dj                  d |D              S )zAReturn string (LaTeX math) `code` with environments stripped out.\begin{c              3  D   K   | ]  }|j                  d       d     yw)z\end{N)split).0chunks     r   	<genexpr>z toplevel_code.<locals>.<genexpr>0   s&      0$ !;;x04 0s    )r   join)codechunkss     r   toplevel_coder"   -   s.    ZZ
#F?? 0(.0 0 0r   c                X    t        |       j                  d      dk\  rd}nd}|s|dz  }|S )a:  Return the right math environment to display `code`.

    The test simply looks for line-breaks (``\``) outside environments.
    Multi-line formulae are set with ``align``, one-liners with
    ``equation``.

    If `numbered` evaluates to ``False``, the "starred" versions are used
    to suppress numbering.
    z\\r   alignequation*)r"   find)r    numberedenvs      r   pick_math_environmentr*   4   s7     T&!+s
Jr   c                >    |rt        |       }d|d| d|dS d| z  S )Nr   z}
z
\end{}z$%s$)r*   )r    as_blockr)   s      r   wrap_math_coder.   G   s(     #D)/2D#>>D=r   N)F)r   str)	r   
__future__r   __docformat__
ValueErrorr   r"   r*   r.    r   r   <module>r4      s/    #"
 0&r   