U C^C5@sBdZddlmmmZddddddd d d d d ddd Zdddddddddddd ZejZej Z e ej e ej e eje eje eje ejdddd DZd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFg&ZdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`daZdbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddd4ZddddZGdddZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ GdddeZ!GdddeZ"GdddeZ#GdddeZ$GdddeZ%GdddeZ&GdddeZ'GdddeZ(GdddeZ)Gdd„deZ*GddĄdeZ+GddƄdeZ,dddɄZ-dd˄Z.ddd̈́Z/dS)z2Convert LaTex math code into presentational MathMLN´¯u˘uˇu˙¨u⃛`^u˚u⃡u˜u⃗) acutebarZbrevecheckdotZddotZdddotZgraveZhatZmathringZoverleftrightarrowtildeZvecuΦuΞuΣuΨuΔuΘuϒuΠuΩuΓuΛ) PhiXiSigmaPsiDeltaThetaUpsilonPiOmegaGammaLambdacCsg|] }t|qS)special).0symbolrrF/tmp/pip-install-6_kvzl1k/docutils/docutils/utils/math/latex2mathml.py 8sr)sumintZointprodZarccosZarcsinZarctanargcoscoshZcotZcothZcscdegZdetZdimexpgcdZhominfZkerZlgZlimZliminfZlimsuplnlogmaxminZPrsecsinsinhsuptantanhZinjlimZ varinjlimZ varlimsupZprojlimZ varliminfZ varprojlimu𝔸u𝔹uℂu𝔻u𝔼u𝔽u𝔾uℍu𝕀u𝕁u𝕂u𝕃u𝕄uℕu𝕆uℙuℚuℝu𝕊u𝕋u𝕌u𝕍u𝕎u𝕏u𝕐uℤ)ABCDEFGHIJKLMNOPQRSTUVWXYZu𝒜uℬu𝒞u𝒟uℰuℱu𝒢uℋuℐu𝒥u𝒦uℒuℳu𝒩u𝒪u𝒫u𝒬uℛu𝒮u𝒯u𝒰u𝒱u𝒲u𝒳u𝒴u𝒵u𝒶u𝒷u𝒸u𝒹uℯu𝒻uℊu𝒽u𝒾u𝒿u𝓀u𝓁u𝓂u𝓃uℴu𝓅u𝓆u𝓇u𝓈u𝓉u𝓊u𝓋u𝓌u𝓍u𝓎u𝓏)4r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKabcdefghijklmnopqrstuvwxyzu≠u∉u≢)=z\inz\equivc@sfeZdZdZdZdddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)mathzBase class for MathML elements.i@BNcCsLg|_|dk r:t|tkr0|D]}||qn |||dk rH||_dS)z\math([children]) -> MathML element children can be one child or a list of children.N)childrentypelistappendinline)selfrhrlchildrrr__init__s  z math.__init__cCs8t|dr,|jjdddd|jDS|jjSdS)Nrhz(%s),cSsg|] }t|qSr)repr)rrnrrrrsz!math.__repr__..)hasattr __class____name__joinrhrmrrr__repr__s  z math.__repr__cCst|j|jkS)zRoom for more children?)lenrh nchildrenrvrrrfullsz math.fullcCs6|r t|j|||_|}|r2|j}q"|S)zvappend(child) -> element Appends child and returns self if self is not full or first non-full parent.)rzAssertionErrorrhrkparent)rmrnnoderrrrks  z math.appendcCs|jd}|jd=|S)zAdelete_child() -> child Delete last child and return it.)rh)rmrnrrr delete_childs zmath.delete_childcCs|j}|r|j}q|S)zKclose() -> parent Close element and return first non-full element.)r|rz)rmr|rrrclosesz math.closecCs|||S)zxml() -> xml-string) xml_startxml_bodyxml_endrvrrrxmlszmath.xmlcCs:t|dsd|jjgSd}|jr,d|gSd|gSdS)Nrlz<%s>z"http://www.w3.org/1998/Math/MathMLzz )rr���rs���rt���rl���)rm���xmlnsr���r���r���r������s ����  zmath.xml_startc�����������������C���s���d|�j�j�gS�)Nzrs���rt���rv���r���r���r���r������s����z math.xml_endc�����������������C���s"���g�}|�j�D�]}||��q |S�N)rh���extendr���)rm���r���rn���r���r���r���r������s���� z math.xml_body)NN)rt��� __module__ __qualname____doc__ry���ro���rw���rz���rk���r���r���r���r���r���r���r���r���r���r���rg������s���    rg���c�������������������@���s���e�Zd�Zdd�ZdS�)mrowc�����������������C���s���d|�j�j�gS�Nz <%s>r���rv���r���r���r���r������s����zmrow.xml_startNrt���r���r���r���r���r���r���r���r������s���r���c�������������������@���s���e�Zd�Zdd�ZdS�)mtablec�����������������C���s���d|�j�j�gS�r���r���rv���r���r���r���r������s����zmtable.xml_startNr���r���r���r���r���r������s���r���c�������������������@���s ���e�Zd�ZdS�)mtrNrt���r���r���r���r���r���r���r�����s����r���c�������������������@���s ���e�Zd�ZdS�)mtdNr���r���r���r���r���r�����s����r���c�������������������@���s$���e�Zd�ZdZdZdd�Zdd�ZdS�)mxzBase class for mo, mi, and mnr���c�����������������C���s ���||�_�d�S�r���data)rm���r���r���r���r���ro�����s����z mx.__init__c�����������������C���s���|�j�gS�r���r���rv���r���r���r���r��� ��s����z mx.xml_bodyN)rt���r���r���r���ry���ro���r���r���r���r���r���r�����s���r���c�������������������@���s���e�Zd�ZdddZdd�ZdS�)moz<z>)<>c�����������������C���s���|�j�|�j|�jgS�r���) translationgetr���rv���r���r���r���r�����s����z mo.xml_bodyN)rt���r���r���r���r���r���r���r���r���r�����s��� r���c�������������������@���s ���e�Zd�ZdS�)miNr���r���r���r���r���r�����s����r���c�������������������@���s ���e�Zd�ZdS�)mnNr���r���r���r���r���r�����s����r���c�������������������@���s���e�Zd�ZdZdS�)msub���Nrt���r���r���ry���r���r���r���r���r�����s���r���c�������������������@���s���e�Zd�ZdZdS�)msupr���Nr���r���r���r���r���r�����s���r���c�������������������@���s���e�Zd�ZdZdS�)msqrt���Nr���r���r���r���r���r�����s���r���c�������������������@���s���e�Zd�ZdZdS�)mrootr���Nr���r���r���r���r���r�����s���r���c�������������������@���s���e�Zd�ZdZdS�)mfracr���Nr���r���r���r���r���r���"��s���r���c�������������������@���s"���e�Zd�ZdZdddZdd�ZdS�) msubsup���NFc�����������������C���s���||�_�t|�|�d�S�r���reversedrg���ro���rm���rh���r���r���r���r���ro���'��s����zmsubsup.__init__c�����������������C���s4���|�j�r*|�jd�|�jd�g|�jdd<�d|�_�t|�S�)Nr���r���r���F)r���rh���rg���r���rv���r���r���r���r���+��s����z msubsup.xml)NFrt���r���r���ry���ro���r���r���r���r���r���r���%��s��� r���c�������������������@���s,���e�Zd�ZddddddZdd�Zd d �Zd S�) mfenced{u���〈}u���〉r���)\{\langle\}\rangle.c�����������������C���s���||�_�t|��d�S�r���)openparrg���ro���)rm���parr���r���r���ro���6��s����zmfenced.__init__c�����������������C���s2���|�j�|�j|�j}|�j�|�j|�j}d||f�gS�)Nz)r���r���r���closepar)rm���openr���r���r���r���r���:��s����zmfenced.xml_startN)rt���r���r���r���ro���r���r���r���r���r���r���2��s����r���c�������������������@���s���e�Zd�ZdZdS�)mspacer���Nr���r���r���r���r���r���?��s���r���c�������������������@���s���e�Zd�ZdddZdd�ZdS�)mstyleNc�����������������K���s$���|d�k r||�_�t|�|�||�_d�S�r���)ry���rg���ro���attrs)rm���rh���ry���kwargsr���r���r���ro���C��s���� zmstyle.__init__c�����������������C���s$���dgdd�t�|�j�D��dg�S�)Nz.r���)rj���r���itemsrv���r���r���r���r���I��s ����  zmstyle.xml_start)NN)rt���r���r���ro���r���r���r���r���r���r���B��s��� r���c�������������������@���s"���e�Zd�ZdZdddZdd�ZdS�) moverr���NFc�����������������C���s���||�_�t|�|�d�S�r���r���r���r���r���r���ro���O��s����zmover.__init__c�����������������C���s ���|�j�r|�j��d|�_�t|�S�)NF)r���rh���reverserg���r���rv���r���r���r���r���S��s���� z mover.xml)NFr���r���r���r���r���r���M��s��� r���c�������������������@���s���e�Zd�ZdZdS�)munderr���Nr���r���r���r���r���r���Y��s���r���c�������������������@���s���e�Zd�ZdZdddZdS�) munderoverr���Nc�����������������C���s���t�|�|�d�S�r���)rg���ro���)rm���rh���r���r���r���ro���^��s����zmunderover.__init__)N)rt���r���r���ry���ro���r���r���r���r���r���\��s���r���c�������������������@���s ���e�Zd�ZdZdd�Zdd�ZdS�)mtextr���c�����������������C���s ���||�_�d�S�r���text)rm���r���r���r���r���ro���c��s����zmtext.__init__c�����������������C���s���|�j�gS�r���r���rv���r���r���r���r���f��s����zmtext.xml_bodyN)rt���r���r���ry���ro���r���r���r���r���r���r���a��s���r���Tc�����������������C���sD��d�|��}�|r&t�}t|dd}nt�}ttt|dd}t|�dkr@t|�}|�d�}d}|dkrt|�d�}nd}|dkrn|dkr|d kr|t |}d }n|dkr|t �}d }n|d kr|t �}d }n| �r MathML-tree Returns a MathML-tree parsed from string. inline=True is for inline math and inline=False is for displayed math. tree is the whole tree and node is the current element. Trl���Fr���r���r���\z{}r���rp���NzSyntax error: "%s%s"z+-*/=()[]|<>,.!?':;@_r���r���r���r���&zIllegal character: "%s")ru���splitr���rg���r���r���r���rx���rk���r���r���isalphahandle_keywordr��� SyntaxErrorr���isdigitr���r��� isinstancer���r���rh���r��� sumintprodr���r���r���r���)stringrl���r}���treerY���rN���skipc2rT���nameentryrowrn���subr/���r���r���r���parse_latex_mathi��s����                              r���c�����������������C���s��d}t�|dkr,|d�dkr,|dd��}d}|�dkrr|dsFtd|d7�}t�}tt|}||�|}n|�dkr|dstd |d7�}|���}nL|�d kr|d�d krtd |d }|dkrtd |t |d|�}||d�7�}n|�dkr(t �}||�|}n|�dkrJt �}||�|}n|�dkrdD�]} || rX�qzqXtdt | } || �t �} | | �| }|t�| 7�}nD|�dkrdD�]} || r�qqtd|�}| |_|�}|t�| 7�}n|�dkrXtD�]} || r�q6qtd|tt| �}|t�| 7�}n|�dkrtddd} || �| }nt|�dkr|d�d ks|d��r|d�d krtd|tt|d��}|d7�}n|�d kr,|d�d ks|d�d kr td!|tt|d��}|d7�}n|�d"krF|td#}n|�tkrd|tt|��}n|�tkr|tt|��}nr|�tkr|tt|��}nT|�tkr|t|�}n:|�tkrttt|��d$d%}||�|}n td&|��||fS�)'Nr���r���r���beginz{matrix}z;Environment not supported! Supported environment: "matrix".���endzExpected "\end{matrix}"!)r���Zmathrmr���zExpected "\text{...}"!r���r~���sqrtfracleft)([|r���r���r���zMissing left-brace!right))]r���r���r���r���zMissing right-brace!notz)Expected something to negate: "\not ..."!ZmathbfZbold)ry���Z fontweightmathbbr���z%Expected something like "\mathbb{A}"!r���)mathscrZmathcalz&Expected something like "\mathscr{A}"!colon:Tr���zUnknown LaTeX command: )rx��� startswithr���r���r���r���rk���r���findr���r���r���r���r���r��� negatablesr���r���isupperr���r���r���Greeklettersr��� functionsoverr���)r���r}���r���r���r���tablerT���r���r���r���Zfencedr���operatorstyleZovrr���r���r���r�����s����                           *           r���c�����������������C���s���t�|�|d}d|�S�)zReturn string with MathML code corresponding to `tex_math`. `inline`=True is for inline math and `inline`=False for displayed math. r���r���)r���ru���r���)Ztex_mathrl���Z mathml_treer���r���r��� tex2mathml2��s���� r���)T)T)0r���Zdocutils.utils.math.tex2unicharutilsrg���Z tex2unicharr���r���Z mathalphar���Zmathbinr���updateZmathrelZmathordZmathopZmathopenZ mathcloseZ mathfenceru���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r������sj���������        ������������������������� 7[      ed