@LXc&@s:dZddljjjZi dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6Zi dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26ZejZej Z e j ej e j ej e j eje j eje j eje j ejd3jgd4d5d6d7gD]Ze e^qZZd8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]g&Zid^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dldm6dndo6dpdq6drds6dtdu6dvdw6dxdy6dzd{6d|d}6d~d6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zi4dd_6dda6ddc6dde6ddg6ddi6ddk6ddm6ddo6ddq6dds6ddu6ddw6ddy6dd{6dd}6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zidd6dd6dd6ZdddYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZ defdYZ!defdYZ"defdYZ#defdYZ$defdYZ%defdYZ&defdYZ'defdYZ(defd YZ)d efd YZ*d efd YZ+defdYZ,defdYZ-e.dZ/dZ0e.dZ1dS(s2Convert LaTex math code into presentational MathMLiNu´tacuteu¯tbaru˘tbreveuˇtchecku˙tdotu¨tddotu⃛tdddotu`tgraveu^thatu˚tmathringu⃡toverleftrightarrowu˜ttildeu⃗tvecuΦtPhiuΞtXiuΣtSigmauΨtPsiuΔtDeltauΘtThetauϒtUpsilonuΠtPiuΩtOmegauΓtGammauΛtLambdattsumtinttointtprodtarccostarcsintarctantargtcostcoshtcottcothtcsctdegtdettdimtexptgcdthomtinftkertlgtlimtliminftlimsuptlntlogtmaxtmintPrtsectsintsinhtsupttanttanhtinjlimt varinjlimt varlimsuptprojlimt varliminft varprojlimu𝔸tAu𝔹tBuℂtCu𝔻tDu𝔼tEu𝔽tFu𝔾tGuℍtHu𝕀tIu𝕁tJu𝕂tKu𝕃tLu𝕄tMuℕtNu𝕆tOuℙtPuℚtQuℝtRu𝕊tSu𝕋tTu𝕌tUu𝕍tVu𝕎tWu𝕏tXu𝕐tYuℤtZu𝒜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𝒶tau𝒷tbu𝒸tcu𝒹tduℯteu𝒻tfuℊtgu𝒽thu𝒾tiu𝒿tju𝓀tku𝓁tlu𝓂tmu𝓃tnuℴtou𝓅tpu𝓆tqu𝓇tru𝓈tsu𝓉ttu𝓊tuu𝓋tvu𝓌twu𝓍txu𝓎tyu𝓏tzu≠t=u∉s\inu≢s\equivtmathcBsteZdZdZd d dZdZdZdZdZ dZ dZ d Z d Z d ZRS( sBase class for MathML elements.i@BcCstg|_|dk rXt|tkrHx+|D]}|j|q.WqX|j|n|dk rp||_ndS(s\math([children]) -> MathML element children can be one child or a list of children.N(tchildrentNonettypetlisttappendtinline(tselfRyR~tchild((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt__init__s    cCsTt|drF|jjddjg|jD]}t|^q+S|jjSdS(NRys(%s)t,(thasattrt __class__t__name__tjoinRytrepr(RR((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt__repr__s +cCst|j|jkS(sRoom for more children?(tlenRyt nchildren(R((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pytfullscCsR|j st|jj|||_|}x|jrM|j}q5W|S(svappend(child) -> element Appends child and returns self if self is not full or first non-full parent.(RtAssertionErrorRyR}tparent(RRtnode((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR}s  cCs|jd}|jd=|S(sAdelete_child() -> child Delete last child and return it.i(Ry(RR((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt delete_childs  cCs)|j}x|jr$|j}q W|S(sKclose() -> parent Close element and return first non-full element.(RR(RR((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pytcloses  cCs|j|j|jS(sxml() -> xml-string(t xml_starttxml_bodytxml_end(R((sK/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pytxmlscCsIt|ds d|jjgSd}|jr:d|gSd|gSdS(NR~s<%s>s"http://www.w3.org/1998/Math/MathMLss ���(���R���R���R���R~���(���R���t���xmlns(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s ����  c���������C���s���d�|��j��j�g�S(���Ns���(���R���R���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s����c���������C���s1���g��}�x$�|��j��D]�}�|�j�|�j����q�W|�S(���N(���Ry���t���extendR���(���R���R���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s����N(���R���t ���__module__t���__doc__R���Rz���R���R���R���R}���R���R���R���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyRx������s���     t���mrowc�����������B���s���e��Z�d����Z�RS(���c���������C���s���d�|��j��j�g�S(���Ns��� <%s>(���R���R���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s����(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s���t���mtablec�����������B���s���e��Z�d����Z�RS(���c���������C���s���d�|��j��j�g�S(���Ns��� <%s>(���R���R���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s����(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR������s���t���mtrc�����������B���s���e��Z�RS(����(���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����t���mtdc�����������B���s���e��Z�RS(����(���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����t���mxc�����������B���s&���e��Z�d��Z�d�Z�d���Z�d���Z�RS(���s���Base class for mo, mi, and mni����c���������C���s ���|�|��_��d��S(���N(���t���data(���R���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����c���������C���s ���|��j��g�S(���N(���R���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR��� ��s����(���R���R���R���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s��� t���moc�����������B���s%���e��Z�i�d��d�6d�d�6Z�d���Z�RS(���s���<t���c���������C���s���|��j��j�|��j�|��j��g�S(���N(���t ���translationt���getR���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����(���R���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s���t���mic�����������B���s���e��Z�RS(����(���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����t���mnc�����������B���s���e��Z�RS(����(���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����t���msubc�����������B���s���e��Z�d��Z�RS(���i���(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s���t���msupc�����������B���s���e��Z�d��Z�RS(���i���(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s���t���msqrtc�����������B���s���e��Z�d��Z�RS(���i���(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s���t���mrootc�����������B���s���e��Z�d��Z�RS(���i���(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s���t���mfracc�����������B���s���e��Z�d��Z�RS(���i���(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���"��s���t���msubsupc�����������B���s&���e��Z�d��Z�d�e�d��Z�d���Z�RS(���i���c���������C���s���|�|��_��t�j�|��|��d��S(���N(���t���reversedRx���R���(���R���Ry���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���'��s���� c���������C���sF���|��j��r9�|��j�d�|��j�d�g�|��j�d�d�+t�|��_��n��t�j�|���S(���Ni���i���i���(���R���Ry���t���FalseRx���R���(���R���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���+��s���� $ N(���R���R���R���Rz���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���%��s���t���mfencedc�����������B���sC���e��Z�i�d��d�6d�d�6d�d�6d�d�6d�d �6Z�d ���Z�d ���Z�RS( ���t���{s���\{u���〈s���\langlet���}s���\}u���〉s���\rangleR���t���.c���������C���s���|�|��_��t�j�|���d��S(���N(���t���openparRx���R���(���R���t���par(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���6��s���� c���������C���sG���|��j��j�|��j�|��j��}�|��j��j�|��j�|��j��}�d�|�|�f�g�S(���Ns���(���R���R���R���t���closepar(���R���t���openR���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���:��s����(���R���R���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���2��s ���  t���mspacec�����������B���s���e��Z�d��Z�RS(���i����(���R���R���R���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���?��s���t���mstylec�����������B���s ���e��Z�d�d�d���Z�d���Z�RS(���c���������K���s5���|�d��k �r�|�|��_�n��t�j�|��|��|�|��_�d��S(���N(���Rz���R���Rx���R���t���attrs(���R���Ry���R���t���kwargs(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR���C��s����  c���������C���s2���d�g�g��|��j��j���D]�}�d�|�^�q�d�g�S(���Ns���|�j �t�|���}�n|�j���rb|�j �t�|���}�n|�d �k�r|�j �t �|���}�n|�d �k�r|�j���} �t�| �t��rt�| �j�d �t�} �n9�t�| �t ��r| �j�t�k�rt�| ��} �n �t�| ��} �|�j �| ��| �}�nF|�d�k�r|�j���} �t�| �t��rMt�| �j��}�np�t�| �t ��rz| �j�t�k�rzt�| ��}�nC�t�| �t��r| �j�d�j�t�k�rt�| �j��}�n �t�| ��}�|�j �|��|�}�n�|�d�k�rt���} �|�j �| ��| �}�n\�|�d�k�r|�j���}�nA�|�d�k�rJt���} �|�j���j �| ��| �}�n�t�d�|���|��|�}��qc�W|�S(���s���parse_latex_math(string [,inline]) -> 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.t��� R~���i����i���R���s���\s���{}i���R���u���Syntax error: "%s%s"s���+-*/=()[]|<>,.!?':;@t���_R���t���^R���R���t���&u���Illegal character: "%s"(���R���t���splitR���Rx���t���TrueR���R���R���R���R���R}���R���R���t���isalphat���handle_keywordR���t ���SyntaxErrorR���t���isdigitR���R���t ���isinstanceR���R���Ry���R���t ���sumintprodR���R���R���R���(���t���stringR~���R���t���treeRj���R_���t���skipt���c2Re���t���namet���entryt���rowR���t���subR:���(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt���parse_latex_mathi��s����                                           c���������C���sq��d�}�t��|��d�k�r;�|�d�d�k�r;�|�d�}�d�}�n��|��d�k�r�|�j�d��se�t�d���n��|�d�7}�t���}�t�t�|���}�|�j�|��|�}�n|��d�k�r�|�j�d��s�t�d ���n��|�d�7}�|�j���j���j���}�nx|��d1�k�rq|�d�d �k�rt�d ���n��|�j�d��}�|�d�k�rDt�d ���n��|�j�t �|�d�|�!��}�|�|�d�7}�n|��d�k�rt ���}�|�j�|��|�}�n|��d�k�rt ���}�|�j�|��|�}�n|��d�k�r]x?�d�d�d�d�d�d�g�D]�} �|�j�| ��rPqqWt�d���t �| ��} �|�j�| ��t ���} �| �j�| ��| �}�|�t��| ��7}�n |��d�k�rx?�d�d�d�d�d�d�g�D]�} �|�j�| ��rPqqWt�d���|�j���}�| �|�_�|�j���}�|�t��| ��7}�n|��d �k�rGx-�t�D]�} �|�j�| ��rPqqWt�d!���|�j�t�t�| ���}�|�t��| ��7}�n |��d"�k�r~t�d#�d�d$�d%��} �|�j�| ��| �}�n|��d&�k�r|�d�d �k�s|�d�j��� s|�d'�d�k�rt�d(���n��|�j�t�t�|�d���}�|�d)�7}�ns|��d2�k�rY|�d�d �k�s |�d'�d�k�r/t�d,���n��|�j�t�t�|�d���}�|�d)�7}�n|��d-�k�r}|�j�t�d.���}�n�|��t�k�r|�j�t�t�|����}�n�|��t�k�r|�j�t�t�|����}�n�|��t�k�r|�j�t�t�|����}�nr�|��t�k�r|�j�t�|����}�nN�|��t�k�rWt�t�t�|���d/�t�}�|�j�|��|�}�n�t�d0�|����|�|�f�S(3���Ni����R���i���t���begins���{matrix}u;���Environment not supported! Supported environment: "matrix".i���t���endu���Expected "\end{matrix}"!R���t���mathrmR���u���Expected "\text{...}"!R���it���sqrtt���fract���leftt���(t���[t���|s���\{s���\langleR���u���Missing left-brace!t���rightt���)t���]s���\}s���\rangleu���Missing right-brace!t���notu)���Expected something to negate: "\not ..."!t���mathbfR���t ���fontweightt���boldt���mathbbi���u%���Expected something like "\mathbb{A}"!i���t���mathscrt���mathcalu&���Expected something like "\mathscr{A}"!t���colont���:R���u���Unknown LaTeX command: (���R���R���(���R���R���(���R���t ���startswithR���R���R���R���R}���R���t���findR���R���R���R���R���R���t ���negatablesR���R���t���isupperR���R���R���t���Greekt���letterst���specialt ���functionst���overR���R���(���R���R���R���R���R���t���tableRe���R���R���R���t���fencedR���t���operatort���stylet���ovr(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyR�����s����"                                     1            c���������C���s%���t��|��d�|�}�d�j�|�j����S(���s���Return string with MathML code corresponding to `tex_math`. `inline`=True is for inline math and `inline`=False for displayed math. R~���R���(���R���R���R���(���t���tex_mathR~���t ���mathml_tree(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt ���tex2mathml2��s����(����(2���R���t���docutils.utils.math.tex2unichart���utilsRx���t ���tex2unicharR���R���t ���mathalphaR���t���mathbinR���t���updatet���mathrelt���mathordt���mathopt���mathopent ���mathcloset ���mathfenceR���t���symbolR���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���(����(����(����sK���/opt/awscli/lib/python2.7/site-packages/docutils/utils/math/latex2mathml.pyt������s"��     )     [      e d