docutils.utils.math.math2html module

class Trace[source]

Bases: object

A tracing class

debugmode = False
quietmode = False
showlinesmode = False
prefix = None
classmethod debug(message)[source]

Show a debug message

classmethod message(message)[source]

Show a trace message

classmethod error(message)[source]

Show an error message

classmethod fatal(message)[source]

Show an error message and terminate

classmethod show(message, channel)[source]

Show a message out of a channel

class ContainerConfig[source]

Bases: object

Configuration class from elyxer.config file

extracttext = {'allowed': ['FormulaConstant'], 'extracted': ['AlphaCommand', 'Bracket', 'BracketCommand', 'CombiningFunction', 'EmptyCommand', 'FontFunction', 'Formula', 'FormulaNumber', 'FormulaSymbol', 'OneParamFunction', 'OversetFunction', 'RawText', 'SpacedCommand', 'SymbolFunction', 'TextFunction', 'UndersetFunction']}
class EscapeConfig[source]

Bases: object

Configuration class from elyxer.config file

chars = {'\n': '', "'": '’', '`': '‘'}
entities = {'&': '&amp;', '<': '&lt;', '>': '&gt;'}
class FormulaConfig[source]

Bases: object

Configuration class from elyxer.config file

alphacommands = {'\\AA': 'Å', '\\AE': 'Æ', '\\AmS': '<span class="textsc">AmS</span>', '\\Bbbk': '𝕜', '\\DH': 'Ð', '\\Delta': 'Δ', '\\Gamma': 'Γ', '\\Im': 'ℑ', '\\L': 'Ł', '\\Lambda': 'Λ', '\\O': 'Ø', '\\OE': 'Œ', '\\Omega': 'Ω', '\\Phi': 'Φ', '\\Pi': 'Π', '\\Psi': 'Ψ', '\\Re': 'ℜ', '\\Sigma': 'Σ', '\\TH': 'Þ', '\\Theta': 'Θ', '\\Upsilon': 'Υ', '\\Xi': 'Ξ', '\\aa': 'å', '\\ae': 'æ', '\\aleph': 'ℵ', '\\alpha': 'α', '\\beta': 'β', '\\beth': 'ℶ', '\\chi': 'χ', '\\daleth': 'ℸ', '\\delta': 'δ', '\\dh': 'ð', '\\digamma': 'ϝ', '\\ell': 'ℓ', '\\epsilon': 'ϵ', '\\eta': 'η', '\\eth': 'ð', '\\gamma': 'γ', '\\gimel': 'ℷ', '\\hslash': 'ℏ', '\\i': 'ı', '\\imath': 'ı', '\\iota': 'ι', '\\j': 'ȷ', '\\jmath': 'ȷ', '\\kappa': 'κ', '\\l': 'ł', '\\lambda': 'λ', '\\mu': 'μ', '\\nu': 'ν', '\\o': 'ø', '\\oe': 'œ', '\\omega': 'ω', '\\phi': 'ϕ', '\\pi': 'π', '\\psi': 'ψ', '\\rho': 'ρ', '\\sigma': 'σ', '\\ss': 'ß', '\\tau': 'τ', '\\th': 'þ', '\\theta': 'θ', '\\upsilon': 'υ', '\\varDelta': '𝛥', '\\varGamma': '𝛤', '\\varLambda': '𝛬', '\\varOmega': '𝛺', '\\varPhi': '𝛷', '\\varPi': '𝛱', '\\varPsi': '𝛹', '\\varSigma': '𝛴', '\\varTheta': '𝛩', '\\varUpsilon': '𝛶', '\\varXi': '𝛯', '\\varepsilon': 'ε', '\\varkappa': 'ϰ', '\\varphi': 'φ', '\\varpi': 'ϖ', '\\varrho': 'ϱ', '\\varsigma': 'ς', '\\vartheta': 'ϑ', '\\wp': '℘', '\\xi': 'ξ', '\\zeta': 'ζ'}
array = {'begin': '\\begin', 'cellseparator': '&', 'end': '\\end', 'rowseparator': '\\\\'}
bigbrackets = {'(': ['⎛', '⎜', '⎝'], ')': ['⎞', '⎟', '⎠'], '[': ['⎡', '⎢', '⎣'], ']': ['⎤', '⎥', '⎦'], '{': ['⎧', '⎪', '⎨', '⎩'], '|': ['|'], '}': ['⎫', '⎪', '⎬', '⎭'], '‖': ['‖']}
bracketcommands = {'\\left': 'span class="stretchy"', '\\left.': '<span class="leftdot"></span>', '\\middle': 'span class="stretchy"', '\\right': 'span class="stretchy"', '\\right.': '<span class="rightdot"></span>'}
combiningfunctions = {'\\"': '̈', "\\'": '́', '\\^': '̂', '\\`': '̀', '\\acute': '́', '\\bar': '̄', '\\breve': '̆', '\\c': '̧', '\\check': '̌', '\\ddddot': '⃜', '\\dddot': '⃛', '\\ddot': '̈', '\\dot': '̇', '\\grave': '̀', '\\hat': '̂', '\\mathring': '̊', '\\not': '̸', '\\overleftrightarrow': '⃡', '\\overline': '̅', '\\r': '̊', '\\s': '̩', '\\textcircled': '⃝', '\\textsubring': '̥', '\\tilde': '̃', '\\underbar': '̱', '\\underleftarrow': '⃮', '\\underline': '̲', '\\underrightarrow': '⃯', '\\v': '̌', '\\vec': '⃗', '\\~': '̃'}
commands = {'\\\t': ' ', '\\\n': ' ', '\\ ': ' ', '\\#': '#', '\\$': '$', '\\%': '%', '\\&': '&', '\\,': '\u2006', '\\:': '\u205f', '\\;': '<span class="thickspace"> </span>', '\\AC': '∿', '\\APLcomment': '⍝', '\\APLdownarrowbox': '⍗', '\\APLinput': '⍞', '\\APLinv': '⌹', '\\APLleftarrowbox': '⍇', '\\APLlog': '⍟', '\\APLrightarrowbox': '⍈', '\\APLuparrowbox': '⍐', '\\Aries': '♈', '\\Arrowvert': '‖', '\\Box': '⬜', '\\CIRCLE': '●', '\\Cap': '⋒', '\\CheckedBox': '☑', '\\Circle': '○', '\\Cup': '⋓', '\\Diamond': '◇', '\\Diamondblack': '◆', '\\Diamonddot': '⟐', '\\Finv': 'Ⅎ', '\\Game': '⅁', '\\Gemini': '♊', '\\Jupiter': '♃', '\\LEFTCIRCLE': '◖', '\\LEFTcircle': '◐', '\\LHD': '◀', '\\Lbag': '⟅', '\\Leo': '♌', '\\Libra': '♎', '\\Mars': '♂', '\\Mercury': '☿', '\\Neptune': '♆', '\\P': '¶', '\\Pluto': '♇', '\\Pr': 'Pr', '\\RHD': '▶', '\\RIGHTCIRCLE': '◗', '\\RIGHTcircle': '◑', '\\Rbag': '⟆', '\\S': '§', '\\Saturn': '♄', '\\Scorpio': '♏', '\\Square': '☐', '\\Sun': '☉', '\\Taurus': '♉', '\\Uranus': '♅', '\\Venus': '♀', '\\Vert': '‖', '\\XBox': '☒', '\\Yup': '⅄', '\\\\': '<br/>', '\\_': '_', '\\amalg': '⨿', '\\angle': '∠', '\\aquarius': '♒', '\\arccos': 'arccos', '\\arcsin': 'arcsin', '\\arctan': 'arctan', '\\arg': 'arg', '\\aries': '♈', '\\arrowvert': '⏐', '\\ast': '∗', '\\backprime': '‵', '\\backslash': '\\', '\\barwedge': '⊼', '\\bigcirc': '◯', '\\bigstar': '★', '\\bigtriangledown': '▽', '\\bigtriangleup': '△', '\\bindnasrepma': '⅋', '\\blacklozenge': '⧫', '\\blacksmiley': '☻', '\\blacksquare': '◼', '\\blacktriangle': '▴', '\\blacktriangledown': '▾', '\\blacktriangleup': '▴', '\\bot': '⊥', '\\boxast': '⧆', '\\boxbar': '◫', '\\boxbox': '⧈', '\\boxbslash': '⧅', '\\boxcircle': '⧇', '\\boxdot': '⊡', '\\boxminus': '⊟', '\\boxplus': '⊞', '\\boxslash': '⧄', '\\boxtimes': '⊠', '\\boy': '♂', '\\bracevert': '⎪', '\\bullet': '•', '\\cancer': '♋', '\\cap': '∩', '\\capricornus': '♑', '\\cdot': '⋅', '\\cdots': '⋯', '\\cent': '¢', '\\centerdot': '⬝', '\\checkmark': '✓', '\\circ': '∘', '\\circledR': 'Ⓡ', '\\circledS': 'Ⓢ', '\\circledast': '⊛', '\\circledbslash': '⦸', '\\circledcirc': '⊚', '\\circleddash': '⊝', '\\circledgtr': '⧁', '\\circledless': '⧀', '\\clubsuit': '♣', '\\colon': ': ', '\\complement': '∁', '\\copyright': '©', '\\cos': 'cos', '\\cosh': 'cosh', '\\cot': 'cot', '\\coth': 'coth', '\\csc': 'csc', '\\cup': '∪', '\\curlyvee': '⋎', '\\curlywedge': '⋏', '\\dagger': '†', '\\ddagger': '‡', '\\ddots': '⋱', '\\deg': 'deg', '\\det': 'det', '\\diagdown': '⟍', '\\diagup': '⟋', '\\diameter': '⌀', '\\diamond': '⋄', '\\diamondsuit': '♢', '\\dim': 'dim', '\\div': '÷', '\\divideontimes': '⋇', '\\dotminus': '∸', '\\dotplus': '∔', '\\dots': '…', '\\dotsb': '⋯', '\\dotsc': '…', '\\dotsi': '⋯', '\\dotsm': '⋯', '\\dotso': '…', '\\doublebarwedge': '⩞', '\\earth': '♁', '\\emptyset': '∅', '\\euro': '€', '\\exists': '∃', '\\exp': 'exp', '\\female': '♀', '\\flat': '♭', '\\forall': '∀', '\\fourth': '⁗', '\\frownie': '☹', '\\gcd': 'gcd', '\\gemini': '♊', '\\girl': '♀', '\\gtrdot': '⋗', '\\guillemotleft': '«', '\\guillemotright': '»', '\\hbar': '<i>ħ</i>', '\\heartsuit': '♡', '\\hom': 'hom', '\\infty': '∞', '\\injlim': 'inj\u202flim', '\\intercal': '⊺', '\\interleave': '⫴', '\\invamp': '⅋', '\\invdiameter': '⍉', '\\invneg': '⌐', '\\jupiter': '♃', '\\ker': 'ker', '\\lVert': '‖', '\\land': '∧', '\\langle': '⟨', '\\lbag': '⟅', '\\lbrace': '{', '\\lbrack': '[', '\\lceil': '⌈', '\\ldots': '…', '\\leftmoon': '☾', '\\leftthreetimes': '⋋', '\\leo': '♌', '\\lessdot': '⋖', '\\lfloor': '⌊', '\\lg': 'lg', '\\lgroup': '⟮', '\\libra': '♎', '\\liminf': 'lim\u202finf', '\\limsup': 'lim\u202fsup', '\\llbracket': '⟦', '\\llcorner': '⌞', '\\llparenthesis': '⦇', '\\lmoustache': '⎰', '\\ln': 'ln', '\\lnot': '¬', '\\log': 'log', '\\lor': '∨', '\\lozenge': '◊', '\\lrcorner': '⌟', '\\ltimes': '⋉', '\\lvert': '|', '\\male': '♂', '\\maltese': '✠', '\\mathcent': '¢', '\\mathdollar': '$', '\\mathsterling': '£', '\\measuredangle': '∡', '\\medbullet': '⚫', '\\medcirc': '⚪', '\\medspace': '\u205f', '\\mercury': '☿', '\\mho': '℧', '\\mp': '∓', '\\nabla': '∇', '\\natural': '♮', '\\neg': '¬', '\\neptune': '♆', '\\newline': '<br/>', '\\nexists': '∄', '\\nobreakspace': '\xa0', '\\nolimits': '', '\\nonumber': '', '\\notbackslash': '⍀', '\\odot': '⊙', '\\ominus': '⊖', '\\oplus': '⊕', '\\oslash': '⊘', '\\otimes': '⊗', '\\partial': '∂', '\\pisces': '♓', '\\pluto': '♇', '\\pm': '±', '\\pounds': '£', '\\prime': '′', '\\projlim': 'proj\u202flim', '\\qquad': '\u2001\u2001', '\\quad': '\u2001', '\\quarternote': '♩', '\\rVert': '‖', '\\rangle': '⟩', '\\rbag': '⟆', '\\rbrace': '}', '\\rbrack': ']', '\\rceil': '⌉', '\\rfloor': '⌋', '\\rgroup': '⟯', '\\rightmoon': '☽', '\\rightthreetimes': '⋌', '\\rmoustache': '⎱', '\\rrbracket': '⟧', '\\rrparenthesis': '⦈', '\\rtimes': '⋊', '\\rvert': '|', '\\sagittarius': '♐', '\\saturn': '♄', '\\scorpio': '♏', '\\sec': 'sec', '\\second': '″', '\\setminus': '⧵', '\\sharp': '♯', '\\sin': 'sin', '\\sinh': 'sinh', '\\slash': '∕', '\\smallsetminus': '∖', '\\smalltriangledown': '▿', '\\smalltriangleleft': '◃', '\\smalltriangleright': '▹', '\\smiley': '☺', '\\spadesuit': '♠', '\\spddot': '¨', '\\sphat': '^', '\\sphericalangle': '∢', '\\sptilde': '~', '\\sqcap': '⊓', '\\sqcup': '⊔', '\\square': '◻', '\\sslash': '⫽', '\\star': '⋆', '\\sun': '☼', '\\surd': '√', '\\talloblong': '⫾', '\\tan': 'tan', '\\tanh': 'tanh', '\\taurus': '♉', '\\textasciicircum': '^', '\\textasciitilde': '~', '\\textbackslash': '\\', '\\textcopyright': '©', '\\textdegree': '°', '\\textellipsis': '…', '\\textemdash': '—', '\\textendash': '—', '\\texteuro': '€', '\\textgreater': '>', '\\textless': '<', '\\textordfeminine': 'ª', '\\textordmasculine': 'º', '\\textquotedblleft': '“', '\\textquotedblright': '”', '\\textquoteright': '’', '\\textregistered': '®', '\\textrightarrow': '→', '\\textsection': '§', '\\texttrademark': '™', '\\texttwosuperior': '²', '\\textvisiblespace': ' ', '\\thickspace': '<span class="thickspace"> </span>', '\\thinspace': '\u2006', '\\third': '‴', '\\times': '×', '\\top': '⊤', '\\triangle': '△', '\\triangledown': '▽', '\\triangleleft': '◃', '\\triangleright': '▹', '\\twonotes': '♫', '\\ulcorner': '⌜', '\\uplus': '⊎', '\\uranus': '♅', '\\urcorner': '⌝', '\\varEarth': '♁', '\\varclubsuit': '♧', '\\vardiamondsuit': '♦', '\\varheartsuit': '♥', '\\varnothing': '⌀', '\\varspadesuit': '♤', '\\vdots': '⋮', '\\vee': '∨', '\\veebar': '⊻', '\\vert': '|', '\\virgo': '♍', '\\wasylozenge': '⌑', '\\wedge': '∧', '\\wr': '≀', '\\yen': '¥', '\\{': '{', '\\|': '‖', '\\}': '}'}
cmddict = {' ': ' ', '#': '#', '$': '$', '%': '%', '&': '&', ',': '\u2006', ':': '\u205f', 'AC': '∿', 'APLcomment': '⍝', 'APLdownarrowbox': '⍗', 'APLinput': '⍞', 'APLinv': '⌹', 'APLleftarrowbox': '⍇', 'APLlog': '⍟', 'APLrightarrowbox': '⍈', 'APLuparrowbox': '⍐', 'Aries': '♈', 'Box': '⬜', 'CIRCLE': '●', 'Cap': '⋒', 'CheckedBox': '☑', 'Circle': '○', 'Cup': '⋓', 'Diamond': '◇', 'Diamondblack': '◆', 'Diamonddot': '⟐', 'Finv': 'Ⅎ', 'Game': '⅁', 'Gemini': '♊', 'Jupiter': '♃', 'LEFTCIRCLE': '◖', 'LEFTcircle': '◐', 'LHD': '◀', 'Lbag': '⟅', 'Leo': '♌', 'Libra': '♎', 'Mars': '♂', 'Mercury': '☿', 'Neptune': '♆', 'P': '¶', 'Pluto': '♇', 'RHD': '▶', 'RIGHTCIRCLE': '◗', 'RIGHTcircle': '◑', 'Rbag': '⟆', 'S': '§', 'Saturn': '♄', 'Scorpio': '♏', 'Square': '☐', 'Sun': '☉', 'Taurus': '♉', 'Uranus': '♅', 'Venus': '♀', 'Vert': '‖', 'XBox': '☒', 'Yup': '⅄', '_': '_', 'amalg': '⨿', 'angle': '∠', 'aquarius': '♒', 'aries': '♈', 'arrowvert': '⏐', 'ast': '∗', 'backprime': '‵', 'backslash': '\\', 'barwedge': '⊼', 'bigcirc': '◯', 'bigstar': '★', 'bigtriangledown': '▽', 'bigtriangleup': '△', 'bindnasrepma': '⅋', 'blacklozenge': '⧫', 'blacksmiley': '☻', 'blacksquare': '◼', 'blacktriangle': '▴', 'blacktriangledown': '▾', 'blacktriangleup': '▴', 'bot': '⊥', 'boxast': '⧆', 'boxbar': '◫', 'boxbox': '⧈', 'boxbslash': '⧅', 'boxcircle': '⧇', 'boxdot': '⊡', 'boxminus': '⊟', 'boxplus': '⊞', 'boxslash': '⧄', 'boxtimes': '⊠', 'boy': '♂', 'bracevert': '⎪', 'bullet': '•', 'cancer': '♋', 'cap': '∩', 'capricornus': '♑', 'cdot': '⋅', 'cdots': '⋯', 'cent': '¢', 'checkmark': '✓', 'circ': '∘', 'circledR': 'Ⓡ', 'circledS': 'Ⓢ', 'circledast': '⊛', 'circledbslash': '⦸', 'circledcirc': '⊚', 'circleddash': '⊝', 'circledgtr': '⧁', 'circledless': '⧀', 'clubsuit': '♣', 'complement': '∁', 'cup': '∪', 'curlyvee': '⋎', 'curlywedge': '⋏', 'dagger': '†', 'ddagger': '‡', 'ddots': '⋱', 'diagdown': '⟍', 'diagup': '⟋', 'diameter': '⌀', 'diamond': '⋄', 'diamondsuit': '♢', 'div': '÷', 'divideontimes': '⋇', 'dotplus': '∔', 'doublebarwedge': '⩞', 'earth': '♁', 'emptyset': '∅', 'exists': '∃', 'female': '♀', 'flat': '♭', 'forall': '∀', 'fourth': '⁗', 'frownie': '☹', 'gemini': '♊', 'girl': '♀', 'gtrdot': '⋗', 'heartsuit': '♡', 'infty': '∞', 'intercal': '⊺', 'interleave': '⫴', 'invamp': '⅋', 'invdiameter': '⍉', 'invneg': '⌐', 'jupiter': '♃', 'land': '∧', 'langle': '⟨', 'lbag': '⟅', 'lbrace': '{', 'lbrack': '[', 'lceil': '⌈', 'ldots': '…', 'leftmoon': '☾', 'leftthreetimes': '⋋', 'leo': '♌', 'lessdot': '⋖', 'lfloor': '⌊', 'lgroup': '⟮', 'libra': '♎', 'llbracket': '⟦', 'llcorner': '⌞', 'llparenthesis': '⦇', 'lmoustache': '⎰', 'lnot': '¬', 'lor': '∨', 'lozenge': '◊', 'lrcorner': '⌟', 'ltimes': '⋉', 'male': '♂', 'maltese': '✠', 'mathcent': '¢', 'mathdollar': '$', 'mathsterling': '£', 'measuredangle': '∡', 'medbullet': '⚫', 'medcirc': '⚪', 'medspace': '\u205f', 'mercury': '☿', 'mho': '℧', 'mp': '∓', 'nabla': '∇', 'natural': '♮', 'neg': '¬', 'neptune': '♆', 'nexists': '∄', 'notbackslash': '⍀', 'odot': '⊙', 'ominus': '⊖', 'oplus': '⊕', 'oslash': '⊘', 'otimes': '⊗', 'partial': '∂', 'pisces': '♓', 'pluto': '♇', 'pm': '±', 'pounds': '£', 'prime': '′', 'quad': '\u2001', 'quarternote': '♩', 'rangle': '⟩', 'rbag': '⟆', 'rbrace': '}', 'rbrack': ']', 'rceil': '⌉', 'rfloor': '⌋', 'rgroup': '⟯', 'rightmoon': '☽', 'rightthreetimes': '⋌', 'rmoustache': '⎱', 'rrbracket': '⟧', 'rrparenthesis': '⦈', 'rtimes': '⋊', 'sagittarius': '♐', 'saturn': '♄', 'scorpio': '♏', 'second': '″', 'setminus': '⧵', 'sharp': '♯', 'slash': '∕', 'smallsetminus': '∖', 'smalltriangledown': '▿', 'smalltriangleleft': '◃', 'smalltriangleright': '▹', 'smiley': '☺', 'spadesuit': '♠', 'spddot': '¨', 'sphat': '^', 'sphericalangle': '∢', 'sptilde': '~', 'sqcap': '⊓', 'sqcup': '⊔', 'square': '◻', 'sslash': '⫽', 'star': '⋆', 'sun': '☼', 'surd': '√', 'talloblong': '⫾', 'taurus': '♉', 'thinspace': '\u2006', 'third': '‴', 'times': '×', 'top': '⊤', 'triangleleft': '◃', 'triangleright': '▹', 'twonotes': '♫', 'ulcorner': '⌜', 'uplus': '⊎', 'uranus': '♅', 'urcorner': '⌝', 'varEarth': '♁', 'varclubsuit': '♧', 'vardiamondsuit': '♦', 'varheartsuit': '♥', 'varspadesuit': '♤', 'vdots': '⋮', 'vee': '∨', 'veebar': '⊻', 'vert': '|', 'virgo': '♍', 'wasylozenge': '⌑', 'wedge': '∧', 'wr': '≀', 'yen': '¥', '{': '{', '|': '‖', '}': '}'}
oversetfunctions = {'\\bar': '‒', '\\dddot': '<span class="smallsymbol">⋯</span>', '\\overleftarrow': '⟵', '\\overleftrightarrow': '⟷', '\\overrightarrow': '⟶', '\\vec': '<span class="smallsymbol">→</span>', '\\widehat': '^', '\\widetilde': '~'}
undersetfunctions = {'\\underleftarrow': '⟵', '\\underleftrightarrow': '⟷', '\\underrightarrow': '⟶'}
endings = {'bracket': '}', 'complex': '\\]', 'endafter': '}', 'endbefore': '\\end{', 'squarebracket': ']'}
environments = {'align': ['r', 'l'], 'eqnarray': ['r', 'c', 'l'], 'gathered': ['l', 'l'], 'smallmatrix': ['c', 'c']}
fontfunctions = {'\\boldsymbol': 'b', '\\mathbb': 'span class="blackboard"', '\\mathbb{A}': '𝔸', '\\mathbb{B}': '𝔹', '\\mathbb{C}': 'ℂ', '\\mathbb{D}': '𝔻', '\\mathbb{E}': '𝔼', '\\mathbb{F}': '𝔽', '\\mathbb{G}': '𝔾', '\\mathbb{H}': 'ℍ', '\\mathbb{J}': '𝕁', '\\mathbb{K}': '𝕂', '\\mathbb{L}': '𝕃', '\\mathbb{N}': 'ℕ', '\\mathbb{O}': '𝕆', '\\mathbb{P}': 'ℙ', '\\mathbb{Q}': 'ℚ', '\\mathbb{R}': 'ℝ', '\\mathbb{S}': '𝕊', '\\mathbb{T}': '𝕋', '\\mathbb{W}': '𝕎', '\\mathbb{Z}': 'ℤ', '\\mathbf': 'b', '\\mathcal': 'span class="scriptfont"', '\\mathcal{B}': 'ℬ', '\\mathcal{E}': 'ℰ', '\\mathcal{F}': 'ℱ', '\\mathcal{H}': 'ℋ', '\\mathcal{I}': 'ℐ', '\\mathcal{L}': 'ℒ', '\\mathcal{M}': 'ℳ', '\\mathcal{R}': 'ℛ', '\\mathfrak': 'span class="fraktur"', '\\mathfrak{C}': 'ℭ', '\\mathfrak{F}': '𝔉', '\\mathfrak{H}': 'ℌ', '\\mathfrak{I}': 'ℑ', '\\mathfrak{R}': 'ℜ', '\\mathfrak{Z}': 'ℨ', '\\mathit': 'i', '\\mathring{A}': 'Å', '\\mathring{U}': 'Ů', '\\mathring{a}': 'å', '\\mathring{u}': 'ů', '\\mathring{w}': 'ẘ', '\\mathring{y}': 'ẙ', '\\mathrm': 'span class="mathrm"', '\\mathscr': 'span class="mathscr"', '\\mathscr{B}': 'ℬ', '\\mathscr{E}': 'ℰ', '\\mathscr{F}': 'ℱ', '\\mathscr{H}': 'ℋ', '\\mathscr{I}': 'ℐ', '\\mathscr{L}': 'ℒ', '\\mathscr{M}': 'ℳ', '\\mathscr{R}': 'ℛ', '\\mathsf': 'span class="mathsf"', '\\mathtt': 'span class="mathtt"', '\\operatorname': 'span class="mathrm"'}
hybridfunctions = {'\\addcontentsline': ['{$p!}{$q!}{$r!}', 'f0{}', 'ignored'], '\\addtocontents': ['{$p!}{$q!}', 'f0{}', 'ignored'], '\\backmatter': ['', 'f0{}', 'ignored'], '\\binom': ['{$1}{$2}', 'f2{(}f0{f1{$1}f1{$2}}f2{)}', 'span class="binom"', 'span class="binomstack"', 'span class="bigdelimiter size2"'], '\\boxed': ['{$1}', 'f0{$1}', 'span class="boxed"'], '\\cfrac': ['[$p!]{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fullfraction"', 'span class="numerator align-$p"', 'span class="denominator"', 'span class="ignored"'], '\\color': ['{$p!}{$1}', 'f0{$1}', 'span style="color: $p;"'], '\\colorbox': ['{$p!}{$1}', 'f0{$1}', 'span class="colorbox" style="background: $p;"'], '\\dbinom': ['{$1}{$2}', '(f0{f1{f2{$1}}f1{f2{\u2005}}f1{f2{$2}}})', 'span class="binomial"', 'span class="binomrow"', 'span class="binomcell"'], '\\dfrac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fullfraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\displaystyle': ['{$1}', 'f0{$1}', 'span class="displaystyle"'], '\\fancyfoot': ['[$p!]{$q!}', 'f0{}', 'ignored'], '\\fancyhead': ['[$p!]{$q!}', 'f0{}', 'ignored'], '\\fbox': ['{$1}', 'f0{$1}', 'span class="fbox"'], '\\fboxrule': ['{$p!}', 'f0{}', 'ignored'], '\\fboxsep': ['{$p!}', 'f0{}', 'ignored'], '\\fcolorbox': ['{$p!}{$q!}{$1}', 'f0{$1}', 'span class="boxed" style="border-color: $p; background: $q;"'], '\\frac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\framebox': ['[$p!][$q!]{$1}', 'f0{$1}', 'span class="framebox align-$q" style="width: $p;"'], '\\frontmatter': ['', 'f0{}', 'ignored'], '\\href': ['[$o]{$u!}{$t!}', 'f0{$t}', 'a href="$u"'], '\\hspace': ['{$p!}', 'f0{ }', 'span class="hspace" style="width: $p;"'], '\\leftroot': ['{$p!}', 'f0{ }', 'span class="leftroot" style="width: $p;px"'], '\\nicefrac': ['{$1}{$2}', 'f0{f1{$1}⁄f2{$2}}', 'span class="fraction"', 'sup class="numerator"', 'sub class="denominator"', 'span class="ignored"'], '\\parbox': ['[$p!]{$w!}{$1}', 'f0{1}', 'div class="Boxed" style="width: $w;"'], '\\raisebox': ['{$p!}{$1}', 'f0{$1.font}', 'span class="raisebox" style="vertical-align: $p;"'], '\\renewenvironment': ['{$1!}{$2!}{$3!}', ''], '\\rule': ['[$v!]{$w!}{$h!}', 'f0/', 'hr class="line" style="width: $w; height: $h;"'], '\\scriptscriptstyle': ['{$1}', 'f0{$1}', 'span class="scriptscriptstyle"'], '\\scriptstyle': ['{$1}', 'f0{$1}', 'span class="scriptstyle"'], '\\sqrt': ['[$0]{$1}', 'f0{f1{$0}f2{√}f4{(}f3{$1}f4{)}}', 'span class="sqrt"', 'sup class="root"', 'span class="radical"', 'span class="root"', 'span class="ignored"'], '\\stackrel': ['{$1}{$2}', 'f0{f1{$1}f2{$2}}', 'span class="stackrel"', 'span class="upstackrel"', 'span class="downstackrel"'], '\\tbinom': ['{$1}{$2}', '(f0{f1{f2{$1}}f1{f2{\u2005}}f1{f2{$2}}})', 'span class="binomial"', 'span class="binomrow"', 'span class="binomcell"'], '\\textcolor': ['{$p!}{$1}', 'f0{$1}', 'span style="color: $p;"'], '\\textstyle': ['{$1}', 'f0{$1}', 'span class="textstyle"'], '\\tfrac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="textfraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\thispagestyle': ['{$p!}', 'f0{}', 'ignored'], '\\unit': ['[$0]{$1}', '$0f0{$1.font}', 'span class="unit"'], '\\unitfrac': ['[$0]{$1}{$2}', '$0f0{f1{$1.font}⁄f2{$2.font}}', 'span class="fraction"', 'sup class="unit"', 'sub class="unit"'], '\\uproot': ['{$p!}', 'f0{ }', 'span class="uproot" style="width: $p;px"'], '\\url': ['{$u!}', 'f0{$u}', 'a href="$u"'], '\\vspace': ['{$p!}', 'f0{ }', 'span class="vspace" style="height: $p;"']}
hybridsizes = {'\\binom': '$1+$2', '\\cfrac': '$1+$2', '\\dbinom': '$1+$2+1', '\\dfrac': '$1+$2', '\\frac': '$1+$2', '\\tbinom': '$1+$2+1'}
labelfunctions = {'\\label': 'a name="#"'}
limitcommands = {'\\bigcap': '<span class="bigoperator">⋂</span>', '\\bigcup': '<span class="bigoperator">⋃</span>', '\\biginterleave': '⫼', '\\bigodot': '<span class="bigoperator">⨀</span>', '\\bigoplus': '<span class="bigoperator">⨁</span>', '\\bigotimes': '<span class="bigoperator">⨂</span>', '\\bigsqcap': '<span class="bigoperator">⨅</span>', '\\bigsqcup': '<span class="bigoperator">⨆</span>', '\\biguplus': '<span class="bigoperator">⨄</span>', '\\bigvee': '<span class="bigoperator">⋁</span>', '\\bigwedge': '<span class="bigoperator">⋀</span>', '\\coprod': '<span class="bigoperator">∐</span>', '\\fint': '<span class="bigoperator integral">⨏</span>', '\\idotsint': '<span class="bigoperator integral">∫⋯∫</span>', '\\iiiint': '<span class="bigoperator integral">⨌</span>', '\\iiint': '<span class="bigoperator integral">∭</span>', '\\iint': '<span class="bigoperator integral">∬</span>', '\\inf': 'inf', '\\int': '<span class="bigoperator integral">∫</span>', '\\intop': '<span class="bigoperator integral">∫</span>', '\\lim': 'lim', '\\max': 'max', '\\min': 'min', '\\oiiint': '<span class="bigoperator integral">∰</span>', '\\oiint': '<span class="bigoperator integral">∯</span>', '\\oint': '<span class="bigoperator integral">∮</span>', '\\ointclockwise': '<span class="bigoperator integral">∲</span>', '\\ointctrclockwise': '<span class="bigoperator integral">∳</span>', '\\ointop': '<span class="bigoperator integral">∮</span>', '\\prod': '<span class="bigoperator">∏</span>', '\\smallint': '<span class="smallsymbol integral">∫</span>', '\\sqint': '<span class="bigoperator integral">⨖</span>', '\\sum': '<span class="bigoperator">∑</span>', '\\sup': 'sup', '\\varointclockwise': '<span class="bigoperator integral">∲</span>', '\\varprod': '<span class="bigoperator">⨉</span>', '\\zcmp': '⨟', '\\zhide': '⧹', '\\zpipe': '⨠', '\\zproject': '⨡'}
modified = {'\n': '', ' ': '', '$': '', '&': '\t', "'": '’', '+': '\u2009+\u2009', ',': ',\u2009', '-': '\u2009−\u2009', '/': '\u2009⁄\u2009', ':': ' : ', '<': '\u2009&lt;\u2009', '=': '\u2009=\u2009', '>': '\u2009&gt;\u2009', '@': '', '~': '\xa0'}
onefunctions = {'\\Big': 'span class="bigdelimiter size2"', '\\Bigg': 'span class="bigdelimiter size4"', '\\Biggl': 'span class="bigdelimiter size4"', '\\Biggr': 'span class="bigdelimiter size4"', '\\Bigl': 'span class="bigdelimiter size2"', '\\Bigr': 'span class="bigdelimiter size2"', '\\begin{array}': 'span class="arraydef"', '\\big': 'span class="bigdelimiter size1"', '\\bigg': 'span class="bigdelimiter size3"', '\\biggl': 'span class="bigdelimiter size3"', '\\biggr': 'span class="bigdelimiter size3"', '\\bigl': 'span class="bigdelimiter size1"', '\\bigr': 'span class="bigdelimiter size1"', '\\centering': 'span class="align-center"', '\\ensuremath': 'span class="ensuremath"', '\\hphantom': 'span class="phantom"', '\\noindent': 'span class="noindent"', '\\overbrace': 'span class="overbrace"', '\\overline': 'span class="overline"', '\\phantom': 'span class="phantom"', '\\underbrace': 'span class="underbrace"', '\\underline': '', '\\vphantom': 'span class="phantom"'}
spacedcommands = {'\\Bot': '⫫', '\\Bumpeq': '≎', '\\Coloneqq': '⩴', '\\Doteq': '≑', '\\Downarrow': '⇓', '\\Leftarrow': '⇐', '\\Leftrightarrow': '⇔', '\\Lleftarrow': '⇚', '\\Longleftarrow': '⟸', '\\Longleftrightarrow': '⟺', '\\Longmapsfrom': '⟽', '\\Longmapsto': '⟾', '\\Longrightarrow': '⟹', '\\Lsh': '↰', '\\Mapsfrom': '⤆', '\\Mapsto': '⤇', '\\Nearrow': '⇗', '\\Nwarrow': '⇖', '\\Perp': '⫫', '\\Rightarrow': '⇒', '\\Rrightarrow': '⇛', '\\Rsh': '↱', '\\Searrow': '⇘', '\\Subset': '⋐', '\\Supset': '⋑', '\\Swarrow': '⇙', '\\Top': '⫪', '\\Uparrow': '⇑', '\\Updownarrow': '⇕', '\\VDash': '⊫', '\\Vdash': '⊩', '\\Vvdash': '⊪', '\\apprge': '≳', '\\apprle': '≲', '\\approx': '≈', '\\approxeq': '≊', '\\asymp': '≍', '\\backepsilon': '∍', '\\backsim': '∽', '\\backsimeq': '⋍', '\\barin': '⋶', '\\barleftharpoon': '⥫', '\\barrightharpoon': '⥭', '\\because': '∵', '\\between': '≬', '\\blacktriangleleft': '◂', '\\blacktriangleright': '▸', '\\bowtie': '⋈', '\\bumpeq': '≏', '\\circeq': '≗', '\\circlearrowleft': '↺', '\\circlearrowright': '↻', '\\coloneq': '≔', '\\coloneqq': '≔', '\\cong': '≅', '\\corresponds': '≙', '\\curlyeqprec': '⋞', '\\curlyeqsucc': '⋟', '\\curvearrowleft': '↶', '\\curvearrowright': '↷', '\\dasharrow': '⇢', '\\dashleftarrow': '⇠', '\\dashrightarrow': '⇢', '\\dashv': '⊣', '\\dlsh': '↲', '\\doteq': '≐', '\\doteqdot': '≑', '\\downarrow': '↓', '\\downdownarrows': '⇊', '\\downdownharpoons': '⥥', '\\downharpoonleft': '⇃', '\\downharpoonright': '⇂', '\\downuparrows': '⇵', '\\downupharpoons': '⥯', '\\drsh': '↳', '\\eqcirc': '≖', '\\eqcolon': '≕', '\\eqqcolon': '≕', '\\eqsim': '≂', '\\eqslantgtr': '⪖', '\\eqslantless': '⪕', '\\equiv': '≡', '\\fallingdotseq': '≒', '\\frown': '⌢', '\\ge': '≥', '\\geq': '≥', '\\geqq': '≧', '\\geqslant': '⩾', '\\gets': '←', '\\gg': '≫', '\\ggcurly': '⪼', '\\ggg': '⋙', '\\gggtr': '⋙', '\\gnapprox': '⪊', '\\gneq': '⪈', '\\gneqq': '≩', '\\gnsim': '⋧', '\\gtrapprox': '⪆', '\\gtreqless': '⋛', '\\gtreqqless': '⪌', '\\gtrless': '≷', '\\gtrsim': '≳', '\\hash': '⋕', '\\hookleftarrow': '↩', '\\hookrightarrow': '↪', '\\iddots': '⋰', '\\impliedby': '⟸', '\\implies': '⟹', '\\in': '∈', '\\le': '≤', '\\leadsto': '⤳', '\\leftarrow': '←', '\\leftarrowtail': '↢', '\\leftarrowtriangle': '⇽', '\\leftbarharpoon': '⥪', '\\leftharpoondown': '↽', '\\leftharpoonup': '↼', '\\leftleftarrows': '⇇', '\\leftleftharpoons': '⥢', '\\leftrightarrow': '↔', '\\leftrightarrows': '⇆', '\\leftrightarrowtriangle': '⇿', '\\leftrightharpoon': '⥊', '\\leftrightharpoons': '⇋', '\\leftrightsquigarrow': '↭', '\\leftslice': '⪦', '\\leftsquigarrow': '⇜', '\\leftturn': '↺', '\\leq': '≤', '\\leqq': '≦', '\\leqslant': '⩽', '\\lessapprox': '⪅', '\\lesseqgtr': '⋚', '\\lesseqqgtr': '⪋', '\\lessgtr': '≶', '\\lesssim': '≲', '\\lhd': '⊲', '\\lightning': '↯', '\\ll': '≪', '\\llcurly': '⪻', '\\lll': '⋘', '\\llless': '⋘', '\\lnapprox': '⪉', '\\lneq': '⪇', '\\lneqq': '≨', '\\lnsim': '⋦', '\\longleftarrow': '⟵', '\\longleftrightarrow': '⟷', '\\longmapsfrom': '⟻', '\\longmapsto': '⟼', '\\longrightarrow': '⟶', '\\looparrowleft': '↫', '\\looparrowright': '↬', '\\lrtimes': '⋈', '\\mapsfrom': '↤', '\\mapsto': '↦', '\\mid': '∣', '\\models': '⊧', '\\multimap': '⊸', '\\multimapboth': '⧟', '\\multimapdotbothA': '⊶', '\\multimapdotbothB': '⊷', '\\multimapinv': '⟜', '\\nLeftarrow': '⇍', '\\nLeftrightarrow': '⇎', '\\nRightarrow': '⇏', '\\nVDash': '⊯', '\\nVdash': '⊮', '\\ncong': '≇', '\\ne': '≠', '\\nearrow': '↗', '\\neq': '≠', '\\ngeq': '≱', '\\ngeqq': '≧̸', '\\ngeqslant': '⩾̸', '\\ngtr': '≯', '\\ngtrless': '≹', '\\ni': '∋', '\\nleftarrow': '↚', '\\nleftrightarrow': '↮', '\\nleq': '≰', '\\nleqq': '≦̸', '\\nleqslant': '⩽̸', '\\nless': '≮', '\\nlessgtr': '≸', '\\nmid': '∤', '\\notasymp': '≭', '\\notin': '∉', '\\notni': '∌', '\\notowner': '∌', '\\notslash': '⌿', '\\nparallel': '∦', '\\nprec': '⊀', '\\npreceq': '⋠', '\\nrightarrow': '↛', '\\nshortmid': '<span class="smallsymbol">∤</span>', '\\nshortparallel': '<span class="smallsymbol">∦</span>', '\\nsim': '≁', '\\nsimeq': '≄', '\\nsqsubset': '≶⊏', '\\nsubseteq': '⊈', '\\nsubseteqq': '⫅̸', '\\nsucc': '⊁', '\\nsucceq': '⋡', '\\nsupseteq': '⊉', '\\nsupseteqq': '⫆̸', '\\ntriangleleft': '⋪', '\\ntrianglelefteq': '⋬', '\\ntriangleright': '⋫', '\\ntrianglerighteq': '⋭', '\\nvDash': '⊭', '\\nvdash': '⊬', '\\nwarrow': '↖', '\\owns': '∋', '\\parallel': '∥', '\\perp': '⟂', '\\pitchfork': '⋔', '\\prec': '≺', '\\precapprox': '⪷', '\\preccurlyeq': '≼', '\\preceq': '⪯', '\\preceqq': '⪳', '\\precnapprox': '⪹', '\\precneqq': '⪵', '\\precnsim': '⋨', '\\precsim': '≾', '\\propto': '∝', '\\restriction': '↾', '\\rhd': '⊳', '\\rightarrow': '→', '\\rightarrowtail': '↣', '\\rightarrowtriangle': '⇾', '\\rightbarharpoon': '⥬', '\\rightharpoondown': '⇁', '\\rightharpoonup': '⇀', '\\rightleftarrows': '⇄', '\\rightleftharpoon': '⥋', '\\rightleftharpoons': '⇌', '\\rightrightarrows': '⇉', '\\rightrightharpoons': '⥤', '\\rightslice': '⪧', '\\rightsquigarrow': '⇝', '\\rightturn': '↻', '\\risingdotseq': '≓', '\\searrow': '↘', '\\shortmid': '<span class="smallsymbol">∣</span>', '\\shortparallel': '<span class="smallsymbol">∥</span>', '\\sim': '∼', '\\simeq': '≃', '\\smallfrown': '<span class="smallsymbol">⌢</span>', '\\smallsmile': '<span class="smallsymbol">⌣</span>', '\\smile': '⌣', '\\sqsubset': '⊏', '\\sqsubseteq': '⊑', '\\sqsupset': '⊐', '\\sqsupseteq': '⊒', '\\strictfi': '⥼', '\\strictif': '⥽', '\\subset': '⊂', '\\subseteq': '⊆', '\\subseteqq': '⫅', '\\subsetneq': '⊊', '\\subsetneqq': '⫋', '\\succ': '≻', '\\succapprox': '⪸', '\\succcurlyeq': '≽', '\\succeq': '⪰', '\\succeqq': '⪴', '\\succnapprox': '⪺', '\\succneqq': '⪶', '\\succnsim': '⋩', '\\succsim': '≿', '\\supset': '⊃', '\\supseteq': '⊇', '\\supseteqq': '⫆', '\\supsetneq': '⊋', '\\supsetneqq': '⫌', '\\swarrow': '↙', '\\therefore': '∴', '\\thickapprox': '<span class="boldsymbol">≈</span>', '\\thicksim': '<span class="boldsymbol">∼</span>', '\\to': '→', '\\trianglelefteq': '⊴', '\\triangleq': '≜', '\\trianglerighteq': '⊵', '\\twoheadleftarrow': '↞', '\\twoheadrightarrow': '↠', '\\uparrow': '↑', '\\updownarrow': '↕', '\\updownarrows': '⇅', '\\updownharpoons': '⥮', '\\upharpoonleft': '↿', '\\upharpoonright': '↾', '\\upuparrows': '⇈', '\\upupharpoons': '⥣', '\\vDash': '⊨', '\\varpropto': '<span class="mathsf">∝</span>', '\\vartriangle': '▵', '\\vartriangleleft': '⊲', '\\vartriangleright': '⊳', '\\vdash': '⊢', '\\wasytherefore': '∴'}
starts = {'beginafter': '}', 'beginbefore': '\\begin{', 'bracket': '{', 'command': '\\', 'comment': '%', 'complex': '\\[', 'simple': '$', 'squarebracket': '[', 'unnumbered': '*'}
symbolfunctions = {'^': 'sup', '_': 'sub'}
textfunctions = {'\\mbox': 'span class="mbox"', '\\text': 'span class="text"', '\\textbf': 'span class="textbf"', '\\textit': 'span class="textit"', '\\textnormal': 'span class="textnormal"', '\\textrm': 'span class="textrm"', '\\textsc': 'span class="textsc"', '\\textsf': 'span class="textsf"', '\\textsl': 'span class="textsl"', '\\texttt': 'span class="texttt"', '\\textup': 'span class="normal"'}
unmodified = {'characters': ['.', '*', '€', '(', ')', '[', ']', '·', '!', ';', '|', '§', '"', '?']}
key = 'wasytherefore'
value = '∴'
class CommandLineParser(options)[source]

Bases: object

A parser for runtime options

parseoptions(args)[source]

Parse command line options

readoption(args)[source]

Read the key and value for an option

readquoted(args, initial)[source]

Read a value between quotes

readequalskey(arg, args)[source]

Read a key using equals

class Options[source]

Bases: object

A set of runtime options

location = None
debug = False
quiet = False
version = False
help = False
simplemath = False
showlines = True
branches = {}
parseoptions(args)[source]

Parse command line options

processoptions()[source]

Process all options parsed.

usage()[source]

Show correct usage

showoptions()[source]

Show all possible options

showversion()[source]

Return the current eLyXer version string

class Cloner[source]

Bases: object

An object used to clone other objects.

classmethod clone(original)[source]

Return an exact copy of an object.

classmethod create(type)[source]

Create an object of a given class.

class ContainerExtractor(config)[source]

Bases: object

A class to extract certain containers.

The config parameter is a map containing three lists: allowed, copied and extracted. Each of the three is a list of class names for containers. Allowed containers are included as is into the result. Cloned containers are cloned and placed into the result. Extracted containers are looked into. All other containers are silently ignored.

extract(container)[source]

Extract a group of selected containers from a container.

process(container, list)[source]

Add allowed containers.

safeclone(container)[source]

Return a new container with contents only in a safe list, recursively.

class Parser[source]

Bases: object

A generic parser

parseheader(reader)[source]

Parse the header

parseparameter(reader)[source]

Parse a parameter

parseending(reader, process)[source]

Parse until the current ending is found

parsecontainer(reader, contents)[source]
__str__()[source]

Return a description

class LoneCommand[source]

Bases: Parser

A parser for just one command line

parse(reader)[source]

Read nothing

class TextParser(container)[source]

Bases: Parser

A parser for a command and a bit of text

stack = []
parse(reader)[source]

Parse lines as long as they are text

isending(reader)[source]

Check if text is ending

class ExcludingParser[source]

Bases: Parser

A parser that excludes the final line

parse(reader)[source]

Parse everything up to (and excluding) the final line

class BoundedParser[source]

Bases: ExcludingParser

A parser bound by a final line

parse(reader)[source]

Parse everything, including the final line

class BoundedDummy[source]

Bases: Parser

A bound parser that ignores everything

parse(reader)[source]

Parse the contents of the container

class StringParser[source]

Bases: Parser

Parses just a string

parseheader(reader)[source]

Do nothing, just take note

parse(reader)[source]

Parse a single line

class ContainerOutput[source]

Bases: object

The generic HTML output for a container.

gethtml(container)[source]

Show an error.

isempty()[source]

Decide if the output is empty: by default, not empty.

class EmptyOutput[source]

Bases: ContainerOutput

gethtml(container)[source]

Return empty HTML code.

isempty()[source]

This output is particularly empty.

class FixedOutput[source]

Bases: ContainerOutput

Fixed output

gethtml(container)[source]

Return constant HTML code

class ContentsOutput[source]

Bases: ContainerOutput

Outputs the contents converted to HTML

gethtml(container)[source]

Return the HTML code

class TaggedOutput[source]

Bases: ContentsOutput

Outputs an HTML tag surrounding the contents.

tag = None
breaklines = False
empty = False
settag(tag, breaklines=False, empty=False)[source]

Set the value for the tag and other attributes.

setbreaklines(breaklines)[source]

Set the value for breaklines.

gethtml(container)[source]

Return the HTML code.

open(container)[source]

Get opening line.

close(container)[source]

Get closing line.

selfclosing(container)[source]

Get self-closing line.

checktag(container)[source]

Check that the tag is valid.

class FilteredOutput[source]

Bases: ContentsOutput

Returns the output in the contents, but filtered:

__init__()[source]

Initialize the filters.

addfilter(original, replacement)[source]

Add a new filter: replace the original by the replacement.

gethtml(container)[source]

Return the HTML code

filter(line)[source]

Filter a single line with all available filters.

class StringOutput[source]

Bases: ContainerOutput

Returns a bare string as output

gethtml(container)[source]

Return a bare string

class Globable[source]

Bases: object

A bit of text which can be globbed (lumped together in bits). Methods current(), skipcurrent(), checkfor() and isout() have to be implemented by subclasses.

leavepending = False
checkbytemark()[source]

Check for a Unicode byte mark and skip it.

isout()[source]

Find out if we are out of the position yet.

current()[source]

Return the current character.

checkfor(string)[source]

Check for the given string in the current position.

finished()[source]

Find out if the current text has finished.

skipcurrent()[source]

Return the current character and skip it.

glob(currentcheck)[source]

Glob a bit of text that satisfies a check on the current char.

globalpha()[source]

Glob a bit of alpha text

globnumber()[source]

Glob a row of digits.

isidentifier()[source]

Return if the current character is alphanumeric or _.

globidentifier()[source]

Glob alphanumeric and _ symbols.

isvalue()[source]

Return if the current character is a value character:

globvalue()[source]

Glob a value: any symbols but brackets.

skipspace()[source]

Skip all whitespace at current position.

globincluding(magicchar)[source]

Glob a bit of text up to (including) the magic char.

globexcluding(excluded)[source]

Glob a bit of text up until (excluding) any excluded character.

pushending(ending, optional=False)[source]

Push a new ending to the bottom

popending(expected=None)[source]

Pop the ending found at the current position

nextending()[source]

Return the next ending in the queue.

class EndingList[source]

Bases: object

A list of position endings

add(ending, optional=False)[source]

Add a new ending to the list

pickpending(pos)[source]

Pick any pending endings from a parse position.

checkin(pos)[source]

Search for an ending

pop(pos)[source]

Remove the ending at the current position

findending(pos)[source]

Find the ending at the current position

checkpending()[source]

Check if there are any pending endings

__str__()[source]

Printable representation

class PositionEnding(ending, optional)[source]

Bases: object

An ending for a parsing position

checkin(pos)[source]

Check for the ending

__str__()[source]

Printable representation

class Position[source]

Bases: Globable

A position in a text to parse. Including those in Globable, functions to implement by subclasses are: skip(), identifier(), extract(), isout() and current().

skip(string)[source]

Skip a string

identifier()[source]

Return an identifier for the current position.

extract(length)[source]

Extract the next string of the given length, or None if not enough text,

checkfor(string)[source]

Check for a string at the given position.

checkforlower(string)[source]

Check for a string in lower case.

skipcurrent()[source]

Return the current character and skip it.

__next__()[source]

Advance the position and return the next character.

checkskip(string)[source]

Check for a string at the given position; if there, skip it

error(message)[source]

Show an error message and the position identifier.

class TextPosition(text)[source]

Bases: Position

A parse position based on a raw text.

__init__(text)[source]

Create the position from some text.

skip(string)[source]

Skip a string of characters.

identifier()[source]

Return a sample of the remaining text.

isout()[source]

Find out if we are out of the text yet.

current()[source]

Return the current character, assuming we are not out.

extract(length)[source]

Extract the next string of the given length, or None if not enough text.

class Container[source]

Bases: object

A container for text and objects in a lyx file

partkey = None
parent = None
begin = None
process()[source]

Process contents

gethtml()[source]

Get the resulting HTML

escape(line, replacements={'&': '&amp;', '<': '&lt;', '>': '&gt;'})[source]

Escape a line with replacements from a map

escapeentities(line)[source]

Escape all Unicode characters to HTML entities.

searchall(type)[source]

Search for all embedded containers of a given type

searchremove(type)[source]

Search for all containers of a type and remove them

searchprocess(type, process)[source]

Search for elements of a given type and process them

locateprocess(locate, process)[source]

Search for all embedded containers and process them

recursivesearch(locate, recursive, process)[source]

Perform a recursive search in the container.

extracttext()[source]

Extract all text from allowed containers.

group(index, group, isingroup)[source]

Group some adjoining elements into a group

remove(index)[source]

Remove a container but leave its contents

tree(level=0)[source]

Show in a tree

getparameter(name)[source]

Get the value of a parameter, if present.

getparameterlist(name)[source]

Get the value of a comma-separated parameter as a list.

hasemptyoutput()[source]

Check if the parent’s output is empty.

__str__()[source]

Get a description

class BlackBox[source]

Bases: Container

A container that does not output anything

class StringContainer[source]

Bases: Container

A container for a single string

parsed = None
process()[source]

Replace special chars from the contents.

replacespecial(line)[source]

Replace all special chars from a line

changeline(line)[source]
extracttext()[source]

Return all text.

__str__()[source]

Return a printable representation.

class Constant(text)[source]

Bases: StringContainer

A constant string

class DocumentParameters[source]

Bases: object

Global parameters for the document.

displaymode = False
class FormulaParser[source]

Bases: Parser

Parses a formula

parseheader(reader)[source]

See if the formula is inlined

parsetype(reader)[source]

Get the formula type from the first line.

parse(reader)[source]

Parse the formula until the end

parseformula(reader)[source]

Parse the formula contents

parsesingleliner(reader, start, ending)[source]

Parse a formula in one line

parsemultiliner(reader, start, ending)[source]

Parse a formula in multiple lines

class FormulaBit[source]

Bases: Container

A bit of a formula

type = None
size = 1
original = ''
__init__()[source]

The formula bit type can be ‘alpha’, ‘number’, ‘font’.

setfactory(factory)[source]

Set the internal formula factory.

add(bit)[source]

Add any kind of formula bit already processed

skiporiginal(string, pos)[source]

Skip a string and add it to the original formula

computesize()[source]

Compute the size of the bit as the max of the sizes of all contents.

clone()[source]

Return a copy of itself.

__str__()[source]

Get a string representation

class TaggedBit[source]

Bases: FormulaBit

A tagged string in a formula

constant(constant, tag)[source]

Set the constant and the tag

complete(contents, tag, breaklines=False)[source]

Set the constant and the tag

selfcomplete(tag)[source]

Set the self-closing tag, no contents (as in <hr/>).

class FormulaConstant(string)[source]

Bases: Constant

A constant string in a formula

__init__(string)[source]

Set the constant string

computesize()[source]

Compute the size of the constant: always 1.

clone()[source]

Return a copy of itself.

__str__()[source]

Return a printable representation.

class RawText[source]

Bases: FormulaBit

A bit of text inside a formula

detect(pos)[source]

Detect a bit of raw text

parsebit(pos)[source]

Parse alphabetic text

class FormulaSymbol[source]

Bases: FormulaBit

A symbol inside a formula

modified = {'\n': '', ' ': '', '$': '', '&': '\t', "'": '’', '+': '\u2009+\u2009', ',': ',\u2009', '-': '\u2009−\u2009', '/': '\u2009⁄\u2009', ':': ' : ', '<': '\u2009&lt;\u2009', '=': '\u2009=\u2009', '>': '\u2009&gt;\u2009', '@': '', '~': '\xa0'}
unmodified = ['.', '*', '€', '(', ')', '[', ']', '·', '!', ';', '|', '§', '"', '?']
detect(pos)[source]

Detect a symbol

parsebit(pos)[source]

Parse the symbol

addsymbol(symbol, pos)[source]

Add a symbol

class FormulaNumber[source]

Bases: FormulaBit

A string of digits in a formula

detect(pos)[source]

Detect a digit

parsebit(pos)[source]

Parse a bunch of digits

class Comment[source]

Bases: FormulaBit

A LaTeX comment: % to the end of the line.

start = '%'
detect(pos)[source]

Detect the %.

parsebit(pos)[source]

Parse to the end of the line.

class WhiteSpace[source]

Bases: FormulaBit

Some white space inside a formula.

detect(pos)[source]

Detect the white space.

parsebit(pos)[source]

Parse all whitespace.

__str__()[source]

Return a printable representation.

class Bracket[source]

Bases: FormulaBit

A {} bracket inside a formula

start = '{'
ending = '}'
__init__()[source]

Create a (possibly literal) new bracket

detect(pos)[source]

Detect the start of a bracket

parsebit(pos)[source]

Parse the bracket

parsetext(pos)[source]

Parse a text bracket

parseliteral(pos)[source]

Parse a literal bracket

parsecomplete(pos, innerparser)[source]

Parse the start and end marks

innerformula(pos)[source]

Parse a whole formula inside the bracket

innertext(pos)[source]

Parse some text inside the bracket, following textual rules.

innerliteral(pos)[source]

Parse a literal inside the bracket, which does not generate HTML.

class SquareBracket[source]

Bases: Bracket

A [] bracket inside a formula

start = '['
ending = ']'
clone()[source]

Return a new square bracket with the same contents.

class MathsProcessor[source]

Bases: object

A processor for a maths construction inside the FormulaProcessor.

process(contents, index)[source]

Process an element inside a formula.

__str__()[source]

Return a printable description.

class FormulaProcessor[source]

Bases: object

A processor specifically for formulas.

processors = [<docutils.utils.math.math2html.LimitsProcessor object>, <docutils.utils.math.math2html.BracketProcessor object>]
process(bit)[source]

Process the contents of every formula bit, recursively.

processcontents(bit)[source]

Process the contents of a formula bit.

processinsides(bit)[source]

Process the insides (limits, brackets) in a formula bit.

traversewhole(formula)[source]

Traverse over the contents to alter variables and space units.

traverse(bit)[source]

Traverse a formula and yield a flattened structure of (bit, list) pairs.

italicize(bit, contents)[source]

Italicize the given bit of text.

class Formula[source]

Bases: Container

A LaTeX formula

process()[source]

Convert the formula to tags

classic()[source]

Make the contents using classic output generation with XHTML and CSS.

parse(pos)[source]

Parse using a parse position instead of self.parser.

parsedollarinline(pos)[source]

Parse a $…$ formula.

parsedollarblock(pos)[source]

Parse a $$…$$ formula.

parsedollar(pos)[source]

Parse to the next $.

parseinlineto(pos, limit)[source]

Parse a (…) formula.

parseblockto(pos, limit)[source]

Parse a […] formula.

parseupto(pos, limit)[source]

Parse a formula that ends with the given command.

__str__()[source]

Return a printable representation.

class WholeFormula[source]

Bases: FormulaBit

Parse a whole formula

detect(pos)[source]

Not outside the formula is enough.

parsebit(pos)[source]

Parse with any formula bit

class FormulaFactory[source]

Bases: object

Construct bits of formula

types = [<class 'docutils.utils.math.math2html.FormulaSymbol'>, <class 'docutils.utils.math.math2html.RawText'>, <class 'docutils.utils.math.math2html.FormulaNumber'>, <class 'docutils.utils.math.math2html.Bracket'>, <class 'docutils.utils.math.math2html.Comment'>, <class 'docutils.utils.math.math2html.WhiteSpace'>, <class 'docutils.utils.math.math2html.FormulaCommand'>, <class 'docutils.utils.math.math2html.SymbolFunction'>]
skippedtypes = [<class 'docutils.utils.math.math2html.Comment'>, <class 'docutils.utils.math.math2html.WhiteSpace'>]
defining = False
__init__()[source]

Initialize the map of instances.

detecttype(type, pos)[source]

Detect a bit of a given type.

instance(type)[source]

Get an instance of the given type.

create(type)[source]

Create a new formula bit of the given type.

clearskipped(pos)[source]

Clear any skipped types.

skipany(pos)[source]

Skip any skipped types.

parseany(pos)[source]

Parse any formula bit at the current location.

parsetype(type, pos)[source]

Parse the given type and return it.

parseformula(formula)[source]

Parse a string of text that contains a whole formula.

class FormulaCommand[source]

Bases: FormulaBit

A LaTeX command inside a formula

types = [<class 'docutils.utils.math.math2html.AlphaCommand'>, <class 'docutils.utils.math.math2html.EmptyCommand'>, <class 'docutils.utils.math.math2html.OneParamFunction'>, <class 'docutils.utils.math.math2html.FontFunction'>, <class 'docutils.utils.math.math2html.TextFunction'>, <class 'docutils.utils.math.math2html.SpacedCommand'>, <class 'docutils.utils.math.math2html.BeginCommand'>, <class 'docutils.utils.math.math2html.OversetFunction'>, <class 'docutils.utils.math.math2html.UndersetFunction'>, <class 'docutils.utils.math.math2html.CombiningFunction'>, <class 'docutils.utils.math.math2html.LimitCommand'>, <class 'docutils.utils.math.math2html.BracketCommand'>, <class 'docutils.utils.math.math2html.HybridFunction'>]
start = '\\'
commandmap = None
detect(pos)[source]

Find the current command.

parsebit(pos)[source]

Parse the command.

parsewithcommand(command, pos)[source]

Parse the command type once we have the command.

parsecommandtype(command, type, pos)[source]

Parse a given command type.

extractcommand(pos)[source]

Extract the command from the current position.

emptycommand(pos)[source]

Check for an empty command: look for command disguised as ending. Special case against ‘{ { } }’ situation.

parseupgreek(command, pos)[source]

Parse the Greek up command..

class CommandBit[source]

Bases: FormulaCommand

A formula bit that includes a command

setcommand(command)[source]

Set the command in the bit

parseparameter(pos)[source]

Parse a parameter at the current position

parsesquare(pos)[source]

Parse a square bracket

parseliteral(pos)[source]

Parse a literal bracket.

parsesquareliteral(pos)[source]

Parse a square bracket literally.

parsetext(pos)[source]

Parse a text parameter.

class EmptyCommand[source]

Bases: CommandBit

An empty command (without parameters)

commandmap = {'\\\t': ' ', '\\\n': ' ', '\\ ': ' ', '\\#': '#', '\\$': '$', '\\%': '%', '\\&': '&', '\\,': '\u2006', '\\:': '\u205f', '\\;': '<span class="thickspace"> </span>', '\\AC': '∿', '\\APLcomment': '⍝', '\\APLdownarrowbox': '⍗', '\\APLinput': '⍞', '\\APLinv': '⌹', '\\APLleftarrowbox': '⍇', '\\APLlog': '⍟', '\\APLrightarrowbox': '⍈', '\\APLuparrowbox': '⍐', '\\Aries': '♈', '\\Arrowvert': '‖', '\\Box': '⬜', '\\CIRCLE': '●', '\\Cap': '⋒', '\\CheckedBox': '☑', '\\Circle': '○', '\\Cup': '⋓', '\\Diamond': '◇', '\\Diamondblack': '◆', '\\Diamonddot': '⟐', '\\Finv': 'Ⅎ', '\\Game': '⅁', '\\Gemini': '♊', '\\Jupiter': '♃', '\\LEFTCIRCLE': '◖', '\\LEFTcircle': '◐', '\\LHD': '◀', '\\Lbag': '⟅', '\\Leo': '♌', '\\Libra': '♎', '\\Mars': '♂', '\\Mercury': '☿', '\\Neptune': '♆', '\\P': '¶', '\\Pluto': '♇', '\\Pr': 'Pr', '\\RHD': '▶', '\\RIGHTCIRCLE': '◗', '\\RIGHTcircle': '◑', '\\Rbag': '⟆', '\\S': '§', '\\Saturn': '♄', '\\Scorpio': '♏', '\\Square': '☐', '\\Sun': '☉', '\\Taurus': '♉', '\\Uranus': '♅', '\\Venus': '♀', '\\Vert': '‖', '\\XBox': '☒', '\\Yup': '⅄', '\\\\': '<br/>', '\\_': '_', '\\amalg': '⨿', '\\angle': '∠', '\\aquarius': '♒', '\\arccos': 'arccos', '\\arcsin': 'arcsin', '\\arctan': 'arctan', '\\arg': 'arg', '\\aries': '♈', '\\arrowvert': '⏐', '\\ast': '∗', '\\backprime': '‵', '\\backslash': '\\', '\\barwedge': '⊼', '\\bigcirc': '◯', '\\bigstar': '★', '\\bigtriangledown': '▽', '\\bigtriangleup': '△', '\\bindnasrepma': '⅋', '\\blacklozenge': '⧫', '\\blacksmiley': '☻', '\\blacksquare': '◼', '\\blacktriangle': '▴', '\\blacktriangledown': '▾', '\\blacktriangleup': '▴', '\\bot': '⊥', '\\boxast': '⧆', '\\boxbar': '◫', '\\boxbox': '⧈', '\\boxbslash': '⧅', '\\boxcircle': '⧇', '\\boxdot': '⊡', '\\boxminus': '⊟', '\\boxplus': '⊞', '\\boxslash': '⧄', '\\boxtimes': '⊠', '\\boy': '♂', '\\bracevert': '⎪', '\\bullet': '•', '\\cancer': '♋', '\\cap': '∩', '\\capricornus': '♑', '\\cdot': '⋅', '\\cdots': '⋯', '\\cent': '¢', '\\centerdot': '⬝', '\\checkmark': '✓', '\\circ': '∘', '\\circledR': 'Ⓡ', '\\circledS': 'Ⓢ', '\\circledast': '⊛', '\\circledbslash': '⦸', '\\circledcirc': '⊚', '\\circleddash': '⊝', '\\circledgtr': '⧁', '\\circledless': '⧀', '\\clubsuit': '♣', '\\colon': ': ', '\\complement': '∁', '\\copyright': '©', '\\cos': 'cos', '\\cosh': 'cosh', '\\cot': 'cot', '\\coth': 'coth', '\\csc': 'csc', '\\cup': '∪', '\\curlyvee': '⋎', '\\curlywedge': '⋏', '\\dagger': '†', '\\ddagger': '‡', '\\ddots': '⋱', '\\deg': 'deg', '\\det': 'det', '\\diagdown': '⟍', '\\diagup': '⟋', '\\diameter': '⌀', '\\diamond': '⋄', '\\diamondsuit': '♢', '\\dim': 'dim', '\\div': '÷', '\\divideontimes': '⋇', '\\dotminus': '∸', '\\dotplus': '∔', '\\dots': '…', '\\dotsb': '⋯', '\\dotsc': '…', '\\dotsi': '⋯', '\\dotsm': '⋯', '\\dotso': '…', '\\doublebarwedge': '⩞', '\\earth': '♁', '\\emptyset': '∅', '\\euro': '€', '\\exists': '∃', '\\exp': 'exp', '\\female': '♀', '\\flat': '♭', '\\forall': '∀', '\\fourth': '⁗', '\\frownie': '☹', '\\gcd': 'gcd', '\\gemini': '♊', '\\girl': '♀', '\\gtrdot': '⋗', '\\guillemotleft': '«', '\\guillemotright': '»', '\\hbar': '<i>ħ</i>', '\\heartsuit': '♡', '\\hom': 'hom', '\\infty': '∞', '\\injlim': 'inj\u202flim', '\\intercal': '⊺', '\\interleave': '⫴', '\\invamp': '⅋', '\\invdiameter': '⍉', '\\invneg': '⌐', '\\jupiter': '♃', '\\ker': 'ker', '\\lVert': '‖', '\\land': '∧', '\\langle': '⟨', '\\lbag': '⟅', '\\lbrace': '{', '\\lbrack': '[', '\\lceil': '⌈', '\\ldots': '…', '\\leftmoon': '☾', '\\leftthreetimes': '⋋', '\\leo': '♌', '\\lessdot': '⋖', '\\lfloor': '⌊', '\\lg': 'lg', '\\lgroup': '⟮', '\\libra': '♎', '\\liminf': 'lim\u202finf', '\\limsup': 'lim\u202fsup', '\\llbracket': '⟦', '\\llcorner': '⌞', '\\llparenthesis': '⦇', '\\lmoustache': '⎰', '\\ln': 'ln', '\\lnot': '¬', '\\log': 'log', '\\lor': '∨', '\\lozenge': '◊', '\\lrcorner': '⌟', '\\ltimes': '⋉', '\\lvert': '|', '\\male': '♂', '\\maltese': '✠', '\\mathcent': '¢', '\\mathdollar': '$', '\\mathsterling': '£', '\\measuredangle': '∡', '\\medbullet': '⚫', '\\medcirc': '⚪', '\\medspace': '\u205f', '\\mercury': '☿', '\\mho': '℧', '\\mp': '∓', '\\nabla': '∇', '\\natural': '♮', '\\neg': '¬', '\\neptune': '♆', '\\newline': '<br/>', '\\nexists': '∄', '\\nobreakspace': '\xa0', '\\nolimits': '', '\\nonumber': '', '\\notbackslash': '⍀', '\\odot': '⊙', '\\ominus': '⊖', '\\oplus': '⊕', '\\oslash': '⊘', '\\otimes': '⊗', '\\partial': '∂', '\\pisces': '♓', '\\pluto': '♇', '\\pm': '±', '\\pounds': '£', '\\prime': '′', '\\projlim': 'proj\u202flim', '\\qquad': '\u2001\u2001', '\\quad': '\u2001', '\\quarternote': '♩', '\\rVert': '‖', '\\rangle': '⟩', '\\rbag': '⟆', '\\rbrace': '}', '\\rbrack': ']', '\\rceil': '⌉', '\\rfloor': '⌋', '\\rgroup': '⟯', '\\rightmoon': '☽', '\\rightthreetimes': '⋌', '\\rmoustache': '⎱', '\\rrbracket': '⟧', '\\rrparenthesis': '⦈', '\\rtimes': '⋊', '\\rvert': '|', '\\sagittarius': '♐', '\\saturn': '♄', '\\scorpio': '♏', '\\sec': 'sec', '\\second': '″', '\\setminus': '⧵', '\\sharp': '♯', '\\sin': 'sin', '\\sinh': 'sinh', '\\slash': '∕', '\\smallsetminus': '∖', '\\smalltriangledown': '▿', '\\smalltriangleleft': '◃', '\\smalltriangleright': '▹', '\\smiley': '☺', '\\spadesuit': '♠', '\\spddot': '¨', '\\sphat': '^', '\\sphericalangle': '∢', '\\sptilde': '~', '\\sqcap': '⊓', '\\sqcup': '⊔', '\\square': '◻', '\\sslash': '⫽', '\\star': '⋆', '\\sun': '☼', '\\surd': '√', '\\talloblong': '⫾', '\\tan': 'tan', '\\tanh': 'tanh', '\\taurus': '♉', '\\textasciicircum': '^', '\\textasciitilde': '~', '\\textbackslash': '\\', '\\textcopyright': '©', '\\textdegree': '°', '\\textellipsis': '…', '\\textemdash': '—', '\\textendash': '—', '\\texteuro': '€', '\\textgreater': '>', '\\textless': '<', '\\textordfeminine': 'ª', '\\textordmasculine': 'º', '\\textquotedblleft': '“', '\\textquotedblright': '”', '\\textquoteright': '’', '\\textregistered': '®', '\\textrightarrow': '→', '\\textsection': '§', '\\texttrademark': '™', '\\texttwosuperior': '²', '\\textvisiblespace': ' ', '\\thickspace': '<span class="thickspace"> </span>', '\\thinspace': '\u2006', '\\third': '‴', '\\times': '×', '\\top': '⊤', '\\triangle': '△', '\\triangledown': '▽', '\\triangleleft': '◃', '\\triangleright': '▹', '\\twonotes': '♫', '\\ulcorner': '⌜', '\\uplus': '⊎', '\\uranus': '♅', '\\urcorner': '⌝', '\\varEarth': '♁', '\\varclubsuit': '♧', '\\vardiamondsuit': '♦', '\\varheartsuit': '♥', '\\varnothing': '⌀', '\\varspadesuit': '♤', '\\vdots': '⋮', '\\vee': '∨', '\\veebar': '⊻', '\\vert': '|', '\\virgo': '♍', '\\wasylozenge': '⌑', '\\wedge': '∧', '\\wr': '≀', '\\yen': '¥', '\\{': '{', '\\|': '‖', '\\}': '}'}
parsebit(pos)[source]

Parse a command without parameters

class SpacedCommand[source]

Bases: CommandBit

An empty command which should have math spacing in formulas.

commandmap = {'\\Bot': '⫫', '\\Bumpeq': '≎', '\\Coloneqq': '⩴', '\\Doteq': '≑', '\\Downarrow': '⇓', '\\Leftarrow': '⇐', '\\Leftrightarrow': '⇔', '\\Lleftarrow': '⇚', '\\Longleftarrow': '⟸', '\\Longleftrightarrow': '⟺', '\\Longmapsfrom': '⟽', '\\Longmapsto': '⟾', '\\Longrightarrow': '⟹', '\\Lsh': '↰', '\\Mapsfrom': '⤆', '\\Mapsto': '⤇', '\\Nearrow': '⇗', '\\Nwarrow': '⇖', '\\Perp': '⫫', '\\Rightarrow': '⇒', '\\Rrightarrow': '⇛', '\\Rsh': '↱', '\\Searrow': '⇘', '\\Subset': '⋐', '\\Supset': '⋑', '\\Swarrow': '⇙', '\\Top': '⫪', '\\Uparrow': '⇑', '\\Updownarrow': '⇕', '\\VDash': '⊫', '\\Vdash': '⊩', '\\Vvdash': '⊪', '\\apprge': '≳', '\\apprle': '≲', '\\approx': '≈', '\\approxeq': '≊', '\\asymp': '≍', '\\backepsilon': '∍', '\\backsim': '∽', '\\backsimeq': '⋍', '\\barin': '⋶', '\\barleftharpoon': '⥫', '\\barrightharpoon': '⥭', '\\because': '∵', '\\between': '≬', '\\blacktriangleleft': '◂', '\\blacktriangleright': '▸', '\\bowtie': '⋈', '\\bumpeq': '≏', '\\circeq': '≗', '\\circlearrowleft': '↺', '\\circlearrowright': '↻', '\\coloneq': '≔', '\\coloneqq': '≔', '\\cong': '≅', '\\corresponds': '≙', '\\curlyeqprec': '⋞', '\\curlyeqsucc': '⋟', '\\curvearrowleft': '↶', '\\curvearrowright': '↷', '\\dasharrow': '⇢', '\\dashleftarrow': '⇠', '\\dashrightarrow': '⇢', '\\dashv': '⊣', '\\dlsh': '↲', '\\doteq': '≐', '\\doteqdot': '≑', '\\downarrow': '↓', '\\downdownarrows': '⇊', '\\downdownharpoons': '⥥', '\\downharpoonleft': '⇃', '\\downharpoonright': '⇂', '\\downuparrows': '⇵', '\\downupharpoons': '⥯', '\\drsh': '↳', '\\eqcirc': '≖', '\\eqcolon': '≕', '\\eqqcolon': '≕', '\\eqsim': '≂', '\\eqslantgtr': '⪖', '\\eqslantless': '⪕', '\\equiv': '≡', '\\fallingdotseq': '≒', '\\frown': '⌢', '\\ge': '≥', '\\geq': '≥', '\\geqq': '≧', '\\geqslant': '⩾', '\\gets': '←', '\\gg': '≫', '\\ggcurly': '⪼', '\\ggg': '⋙', '\\gggtr': '⋙', '\\gnapprox': '⪊', '\\gneq': '⪈', '\\gneqq': '≩', '\\gnsim': '⋧', '\\gtrapprox': '⪆', '\\gtreqless': '⋛', '\\gtreqqless': '⪌', '\\gtrless': '≷', '\\gtrsim': '≳', '\\hash': '⋕', '\\hookleftarrow': '↩', '\\hookrightarrow': '↪', '\\iddots': '⋰', '\\impliedby': '⟸', '\\implies': '⟹', '\\in': '∈', '\\le': '≤', '\\leadsto': '⤳', '\\leftarrow': '←', '\\leftarrowtail': '↢', '\\leftarrowtriangle': '⇽', '\\leftbarharpoon': '⥪', '\\leftharpoondown': '↽', '\\leftharpoonup': '↼', '\\leftleftarrows': '⇇', '\\leftleftharpoons': '⥢', '\\leftrightarrow': '↔', '\\leftrightarrows': '⇆', '\\leftrightarrowtriangle': '⇿', '\\leftrightharpoon': '⥊', '\\leftrightharpoons': '⇋', '\\leftrightsquigarrow': '↭', '\\leftslice': '⪦', '\\leftsquigarrow': '⇜', '\\leftturn': '↺', '\\leq': '≤', '\\leqq': '≦', '\\leqslant': '⩽', '\\lessapprox': '⪅', '\\lesseqgtr': '⋚', '\\lesseqqgtr': '⪋', '\\lessgtr': '≶', '\\lesssim': '≲', '\\lhd': '⊲', '\\lightning': '↯', '\\ll': '≪', '\\llcurly': '⪻', '\\lll': '⋘', '\\llless': '⋘', '\\lnapprox': '⪉', '\\lneq': '⪇', '\\lneqq': '≨', '\\lnsim': '⋦', '\\longleftarrow': '⟵', '\\longleftrightarrow': '⟷', '\\longmapsfrom': '⟻', '\\longmapsto': '⟼', '\\longrightarrow': '⟶', '\\looparrowleft': '↫', '\\looparrowright': '↬', '\\lrtimes': '⋈', '\\mapsfrom': '↤', '\\mapsto': '↦', '\\mid': '∣', '\\models': '⊧', '\\multimap': '⊸', '\\multimapboth': '⧟', '\\multimapdotbothA': '⊶', '\\multimapdotbothB': '⊷', '\\multimapinv': '⟜', '\\nLeftarrow': '⇍', '\\nLeftrightarrow': '⇎', '\\nRightarrow': '⇏', '\\nVDash': '⊯', '\\nVdash': '⊮', '\\ncong': '≇', '\\ne': '≠', '\\nearrow': '↗', '\\neq': '≠', '\\ngeq': '≱', '\\ngeqq': '≧̸', '\\ngeqslant': '⩾̸', '\\ngtr': '≯', '\\ngtrless': '≹', '\\ni': '∋', '\\nleftarrow': '↚', '\\nleftrightarrow': '↮', '\\nleq': '≰', '\\nleqq': '≦̸', '\\nleqslant': '⩽̸', '\\nless': '≮', '\\nlessgtr': '≸', '\\nmid': '∤', '\\notasymp': '≭', '\\notin': '∉', '\\notni': '∌', '\\notowner': '∌', '\\notslash': '⌿', '\\nparallel': '∦', '\\nprec': '⊀', '\\npreceq': '⋠', '\\nrightarrow': '↛', '\\nshortmid': '<span class="smallsymbol">∤</span>', '\\nshortparallel': '<span class="smallsymbol">∦</span>', '\\nsim': '≁', '\\nsimeq': '≄', '\\nsqsubset': '≶⊏', '\\nsubseteq': '⊈', '\\nsubseteqq': '⫅̸', '\\nsucc': '⊁', '\\nsucceq': '⋡', '\\nsupseteq': '⊉', '\\nsupseteqq': '⫆̸', '\\ntriangleleft': '⋪', '\\ntrianglelefteq': '⋬', '\\ntriangleright': '⋫', '\\ntrianglerighteq': '⋭', '\\nvDash': '⊭', '\\nvdash': '⊬', '\\nwarrow': '↖', '\\owns': '∋', '\\parallel': '∥', '\\perp': '⟂', '\\pitchfork': '⋔', '\\prec': '≺', '\\precapprox': '⪷', '\\preccurlyeq': '≼', '\\preceq': '⪯', '\\preceqq': '⪳', '\\precnapprox': '⪹', '\\precneqq': '⪵', '\\precnsim': '⋨', '\\precsim': '≾', '\\propto': '∝', '\\restriction': '↾', '\\rhd': '⊳', '\\rightarrow': '→', '\\rightarrowtail': '↣', '\\rightarrowtriangle': '⇾', '\\rightbarharpoon': '⥬', '\\rightharpoondown': '⇁', '\\rightharpoonup': '⇀', '\\rightleftarrows': '⇄', '\\rightleftharpoon': '⥋', '\\rightleftharpoons': '⇌', '\\rightrightarrows': '⇉', '\\rightrightharpoons': '⥤', '\\rightslice': '⪧', '\\rightsquigarrow': '⇝', '\\rightturn': '↻', '\\risingdotseq': '≓', '\\searrow': '↘', '\\shortmid': '<span class="smallsymbol">∣</span>', '\\shortparallel': '<span class="smallsymbol">∥</span>', '\\sim': '∼', '\\simeq': '≃', '\\smallfrown': '<span class="smallsymbol">⌢</span>', '\\smallsmile': '<span class="smallsymbol">⌣</span>', '\\smile': '⌣', '\\sqsubset': '⊏', '\\sqsubseteq': '⊑', '\\sqsupset': '⊐', '\\sqsupseteq': '⊒', '\\strictfi': '⥼', '\\strictif': '⥽', '\\subset': '⊂', '\\subseteq': '⊆', '\\subseteqq': '⫅', '\\subsetneq': '⊊', '\\subsetneqq': '⫋', '\\succ': '≻', '\\succapprox': '⪸', '\\succcurlyeq': '≽', '\\succeq': '⪰', '\\succeqq': '⪴', '\\succnapprox': '⪺', '\\succneqq': '⪶', '\\succnsim': '⋩', '\\succsim': '≿', '\\supset': '⊃', '\\supseteq': '⊇', '\\supseteqq': '⫆', '\\supsetneq': '⊋', '\\supsetneqq': '⫌', '\\swarrow': '↙', '\\therefore': '∴', '\\thickapprox': '<span class="boldsymbol">≈</span>', '\\thicksim': '<span class="boldsymbol">∼</span>', '\\to': '→', '\\trianglelefteq': '⊴', '\\triangleq': '≜', '\\trianglerighteq': '⊵', '\\twoheadleftarrow': '↞', '\\twoheadrightarrow': '↠', '\\uparrow': '↑', '\\updownarrow': '↕', '\\updownarrows': '⇅', '\\updownharpoons': '⥮', '\\upharpoonleft': '↿', '\\upharpoonright': '↾', '\\upuparrows': '⇈', '\\upupharpoons': '⥣', '\\vDash': '⊨', '\\varpropto': '<span class="mathsf">∝</span>', '\\vartriangle': '▵', '\\vartriangleleft': '⊲', '\\vartriangleright': '⊳', '\\vdash': '⊢', '\\wasytherefore': '∴'}
parsebit(pos)[source]

Place as contents the command translated and spaced.

class AlphaCommand[source]

Bases: EmptyCommand

A command without parameters whose result is alphabetical.

commandmap = {'\\AA': 'Å', '\\AE': 'Æ', '\\AmS': '<span class="textsc">AmS</span>', '\\Bbbk': '𝕜', '\\DH': 'Ð', '\\Delta': 'Δ', '\\Gamma': 'Γ', '\\Im': 'ℑ', '\\L': 'Ł', '\\Lambda': 'Λ', '\\O': 'Ø', '\\OE': 'Œ', '\\Omega': 'Ω', '\\Phi': 'Φ', '\\Pi': 'Π', '\\Psi': 'Ψ', '\\Re': 'ℜ', '\\Sigma': 'Σ', '\\TH': 'Þ', '\\Theta': 'Θ', '\\Upsilon': 'Υ', '\\Xi': 'Ξ', '\\aa': 'å', '\\ae': 'æ', '\\aleph': 'ℵ', '\\alpha': 'α', '\\beta': 'β', '\\beth': 'ℶ', '\\chi': 'χ', '\\daleth': 'ℸ', '\\delta': 'δ', '\\dh': 'ð', '\\digamma': 'ϝ', '\\ell': 'ℓ', '\\epsilon': 'ϵ', '\\eta': 'η', '\\eth': 'ð', '\\gamma': 'γ', '\\gimel': 'ℷ', '\\hslash': 'ℏ', '\\i': 'ı', '\\imath': 'ı', '\\iota': 'ι', '\\j': 'ȷ', '\\jmath': 'ȷ', '\\kappa': 'κ', '\\l': 'ł', '\\lambda': 'λ', '\\mu': 'μ', '\\nu': 'ν', '\\o': 'ø', '\\oe': 'œ', '\\omega': 'ω', '\\phi': 'ϕ', '\\pi': 'π', '\\psi': 'ψ', '\\rho': 'ρ', '\\sigma': 'σ', '\\ss': 'ß', '\\tau': 'τ', '\\th': 'þ', '\\theta': 'θ', '\\upsilon': 'υ', '\\varDelta': '𝛥', '\\varGamma': '𝛤', '\\varLambda': '𝛬', '\\varOmega': '𝛺', '\\varPhi': '𝛷', '\\varPi': '𝛱', '\\varPsi': '𝛹', '\\varSigma': '𝛴', '\\varTheta': '𝛩', '\\varUpsilon': '𝛶', '\\varXi': '𝛯', '\\varepsilon': 'ε', '\\varkappa': 'ϰ', '\\varphi': 'φ', '\\varpi': 'ϖ', '\\varrho': 'ϱ', '\\varsigma': 'ς', '\\vartheta': 'ϑ', '\\wp': '℘', '\\xi': 'ξ', '\\zeta': 'ζ'}
greek_capitals = ('\\Xi', '\\Theta', '\\Pi', '\\Sigma', '\\Gamma', '\\Lambda', '\\Phi', '\\Psi', '\\Delta', '\\Upsilon', '\\Omega')
parsebit(pos)[source]

Parse the command and set type to alpha

class OneParamFunction[source]

Bases: CommandBit

A function of one parameter

commandmap = {'\\Big': 'span class="bigdelimiter size2"', '\\Bigg': 'span class="bigdelimiter size4"', '\\Biggl': 'span class="bigdelimiter size4"', '\\Biggr': 'span class="bigdelimiter size4"', '\\Bigl': 'span class="bigdelimiter size2"', '\\Bigr': 'span class="bigdelimiter size2"', '\\begin{array}': 'span class="arraydef"', '\\big': 'span class="bigdelimiter size1"', '\\bigg': 'span class="bigdelimiter size3"', '\\biggl': 'span class="bigdelimiter size3"', '\\biggr': 'span class="bigdelimiter size3"', '\\bigl': 'span class="bigdelimiter size1"', '\\bigr': 'span class="bigdelimiter size1"', '\\centering': 'span class="align-center"', '\\ensuremath': 'span class="ensuremath"', '\\hphantom': 'span class="phantom"', '\\noindent': 'span class="noindent"', '\\overbrace': 'span class="overbrace"', '\\overline': 'span class="overline"', '\\phantom': 'span class="phantom"', '\\underbrace': 'span class="underbrace"', '\\underline': '', '\\vphantom': 'span class="phantom"'}
simplified = False
parsebit(pos)[source]

Parse a function with one parameter

simplifyifpossible()[source]

Try to simplify to a single character.

class SymbolFunction[source]

Bases: CommandBit

Find a function which is represented by a symbol (like _ or ^)

commandmap = {'^': 'sup', '_': 'sub'}
detect(pos)[source]

Find the symbol

parsebit(pos)[source]

Parse the symbol

class TextFunction[source]

Bases: CommandBit

A function where parameters are read as text.

commandmap = {'\\mbox': 'span class="mbox"', '\\text': 'span class="text"', '\\textbf': 'span class="textbf"', '\\textit': 'span class="textit"', '\\textnormal': 'span class="textnormal"', '\\textrm': 'span class="textrm"', '\\textsc': 'span class="textsc"', '\\textsf': 'span class="textsf"', '\\textsl': 'span class="textsl"', '\\texttt': 'span class="texttt"', '\\textup': 'span class="normal"'}
parsebit(pos)[source]

Parse a text parameter

process()[source]

Set the type to font

class FontFunction[source]

Bases: OneParamFunction

A function of one parameter that changes the font.

commandmap = {'\\boldsymbol': 'b', '\\mathbb': 'span class="blackboard"', '\\mathbb{A}': '𝔸', '\\mathbb{B}': '𝔹', '\\mathbb{C}': 'ℂ', '\\mathbb{D}': '𝔻', '\\mathbb{E}': '𝔼', '\\mathbb{F}': '𝔽', '\\mathbb{G}': '𝔾', '\\mathbb{H}': 'ℍ', '\\mathbb{J}': '𝕁', '\\mathbb{K}': '𝕂', '\\mathbb{L}': '𝕃', '\\mathbb{N}': 'ℕ', '\\mathbb{O}': '𝕆', '\\mathbb{P}': 'ℙ', '\\mathbb{Q}': 'ℚ', '\\mathbb{R}': 'ℝ', '\\mathbb{S}': '𝕊', '\\mathbb{T}': '𝕋', '\\mathbb{W}': '𝕎', '\\mathbb{Z}': 'ℤ', '\\mathbf': 'b', '\\mathcal': 'span class="scriptfont"', '\\mathcal{B}': 'ℬ', '\\mathcal{E}': 'ℰ', '\\mathcal{F}': 'ℱ', '\\mathcal{H}': 'ℋ', '\\mathcal{I}': 'ℐ', '\\mathcal{L}': 'ℒ', '\\mathcal{M}': 'ℳ', '\\mathcal{R}': 'ℛ', '\\mathfrak': 'span class="fraktur"', '\\mathfrak{C}': 'ℭ', '\\mathfrak{F}': '𝔉', '\\mathfrak{H}': 'ℌ', '\\mathfrak{I}': 'ℑ', '\\mathfrak{R}': 'ℜ', '\\mathfrak{Z}': 'ℨ', '\\mathit': 'i', '\\mathring{A}': 'Å', '\\mathring{U}': 'Ů', '\\mathring{a}': 'å', '\\mathring{u}': 'ů', '\\mathring{w}': 'ẘ', '\\mathring{y}': 'ẙ', '\\mathrm': 'span class="mathrm"', '\\mathscr': 'span class="mathscr"', '\\mathscr{B}': 'ℬ', '\\mathscr{E}': 'ℰ', '\\mathscr{F}': 'ℱ', '\\mathscr{H}': 'ℋ', '\\mathscr{I}': 'ℐ', '\\mathscr{L}': 'ℒ', '\\mathscr{M}': 'ℳ', '\\mathscr{R}': 'ℛ', '\\mathsf': 'span class="mathsf"', '\\mathtt': 'span class="mathtt"', '\\operatorname': 'span class="mathrm"'}
process()[source]

Simplify if possible using a single character.

class BigBracket(size, bracket, alignment='l')[source]

Bases: object

A big bracket generator.

__init__(size, bracket, alignment='l')[source]

Set the size and symbol for the bracket.

getpiece(index)[source]

Return the nth piece for the bracket.

getpiece1(index)[source]

Return the only piece for a single-piece bracket.

getpiece3(index)[source]

Get the nth piece for a 3-piece bracket: parenthesis or square bracket.

getpiece4(index)[source]

Get the nth piece for a 4-piece bracket: curly bracket.

getcell(index)[source]

Get the bracket piece as an array cell.

getcontents()[source]

Get the bracket as an array or as a single bracket.

getsinglebracket()[source]

Return the bracket as a single sign.

class FormulaEquation[source]

Bases: CommandBit

A simple numbered equation.

piece = 'equation'
parsebit(pos)[source]

Parse the array

class FormulaCell[source]

Bases: FormulaCommand

An array cell inside a row

setalignment(alignment)[source]
parsebit(pos)[source]

Parse the command.

class FormulaRow[source]

Bases: FormulaCommand

An array row inside an array

cellseparator = '&'
setalignments(alignments)[source]
parsebit(pos)[source]

Parse a whole row

createcell(index)[source]

Create the cell that corresponds to the given index.

class MultiRowFormula[source]

Bases: CommandBit

A formula with multiple rows.

parserows(pos)[source]

Parse all rows, finish when no more row ends

iteraterows(pos)[source]

Iterate over all rows, end when no more row ends

addempty()[source]

Add an empty row.

addrow(row)[source]

Add a row to the contents and to the list of rows.

class FormulaArray[source]

Bases: MultiRowFormula

An array within a formula

piece = 'array'
parsebit(pos)[source]

Parse the array

parsealignments(pos)[source]

Parse the different alignments

class FormulaMatrix[source]

Bases: MultiRowFormula

A matrix (array with center alignment).

piece = 'matrix'
parsebit(pos)[source]

Parse the matrix, set alignments to ‘c’.

class FormulaCases[source]

Bases: MultiRowFormula

A cases statement

piece = 'cases'
parsebit(pos)[source]

Parse the cases

class EquationEnvironment[source]

Bases: MultiRowFormula

A begin{}…end equation environment with rows and cells.

parsebit(pos)[source]

Parse the whole environment.

class BeginCommand[source]

Bases: CommandBit

A begin{}…end command and what it entails (array, cases, aligned)

commandmap = {'\\begin': ''}
types = [<class 'docutils.utils.math.math2html.FormulaEquation'>, <class 'docutils.utils.math.math2html.FormulaArray'>, <class 'docutils.utils.math.math2html.FormulaCases'>, <class 'docutils.utils.math.math2html.FormulaMatrix'>]
parsebit(pos)[source]

Parse the begin command

findbit(piece)[source]

Find the command bit corresponding to the begin{piece}

class CombiningFunction[source]

Bases: OneParamFunction

commandmap = {'\\"': '̈', "\\'": '́', '\\^': '̂', '\\`': '̀', '\\acute': '́', '\\bar': '̄', '\\breve': '̆', '\\c': '̧', '\\check': '̌', '\\ddddot': '⃜', '\\dddot': '⃛', '\\ddot': '̈', '\\dot': '̇', '\\grave': '̀', '\\hat': '̂', '\\mathring': '̊', '\\not': '̸', '\\overleftrightarrow': '⃡', '\\overline': '̅', '\\r': '̊', '\\s': '̩', '\\textcircled': '⃝', '\\textsubring': '̥', '\\tilde': '̃', '\\underbar': '̱', '\\underleftarrow': '⃮', '\\underline': '̲', '\\underrightarrow': '⃯', '\\v': '̌', '\\vec': '⃗', '\\~': '̃'}
parsebit(pos)[source]

Parse a combining function.

parsesingleparameter(pos)[source]

Parse a parameter, or a single letter.

class OversetFunction[source]

Bases: OneParamFunction

A function that decorates some bit of text with an overset.

commandmap = {'\\bar': '‒', '\\dddot': '<span class="smallsymbol">⋯</span>', '\\overleftarrow': '⟵', '\\overleftrightarrow': '⟷', '\\overrightarrow': '⟶', '\\vec': '<span class="smallsymbol">→</span>', '\\widehat': '^', '\\widetilde': '~'}
parsebit(pos)[source]

Parse an overset-function

class UndersetFunction[source]

Bases: OneParamFunction

A function that decorates some bit of text with an underset.

commandmap = {'\\underleftarrow': '⟵', '\\underleftrightarrow': '⟷', '\\underrightarrow': '⟶'}
parsebit(pos)[source]

Parse an underset-function

class LimitCommand[source]

Bases: EmptyCommand

A command which accepts limits above and below, in display mode.

commandmap = {'\\bigcap': '<span class="bigoperator">⋂</span>', '\\bigcup': '<span class="bigoperator">⋃</span>', '\\biginterleave': '⫼', '\\bigodot': '<span class="bigoperator">⨀</span>', '\\bigoplus': '<span class="bigoperator">⨁</span>', '\\bigotimes': '<span class="bigoperator">⨂</span>', '\\bigsqcap': '<span class="bigoperator">⨅</span>', '\\bigsqcup': '<span class="bigoperator">⨆</span>', '\\biguplus': '<span class="bigoperator">⨄</span>', '\\bigvee': '<span class="bigoperator">⋁</span>', '\\bigwedge': '<span class="bigoperator">⋀</span>', '\\coprod': '<span class="bigoperator">∐</span>', '\\fint': '<span class="bigoperator integral">⨏</span>', '\\idotsint': '<span class="bigoperator integral">∫⋯∫</span>', '\\iiiint': '<span class="bigoperator integral">⨌</span>', '\\iiint': '<span class="bigoperator integral">∭</span>', '\\iint': '<span class="bigoperator integral">∬</span>', '\\inf': 'inf', '\\int': '<span class="bigoperator integral">∫</span>', '\\intop': '<span class="bigoperator integral">∫</span>', '\\lim': 'lim', '\\max': 'max', '\\min': 'min', '\\oiiint': '<span class="bigoperator integral">∰</span>', '\\oiint': '<span class="bigoperator integral">∯</span>', '\\oint': '<span class="bigoperator integral">∮</span>', '\\ointclockwise': '<span class="bigoperator integral">∲</span>', '\\ointctrclockwise': '<span class="bigoperator integral">∳</span>', '\\ointop': '<span class="bigoperator integral">∮</span>', '\\prod': '<span class="bigoperator">∏</span>', '\\smallint': '<span class="smallsymbol integral">∫</span>', '\\sqint': '<span class="bigoperator integral">⨖</span>', '\\sum': '<span class="bigoperator">∑</span>', '\\sup': 'sup', '\\varointclockwise': '<span class="bigoperator integral">∲</span>', '\\varprod': '<span class="bigoperator">⨉</span>', '\\zcmp': '⨟', '\\zhide': '⧹', '\\zpipe': '⨠', '\\zproject': '⨡'}
parsebit(pos)[source]

Parse a limit command.

class LimitPreviousCommand[source]

Bases: LimitCommand

A command to limit the previous command.

commandmap = None
parsebit(pos)[source]

Do nothing.

__str__()[source]

Return a printable representation.

class LimitsProcessor[source]

Bases: MathsProcessor

A processor for limits inside an element.

process(contents, index)[source]

Process the limits for an element.

checklimits(contents, index)[source]

Check if the current position has a limits command.

limitsahead(contents, index)[source]

Limit the current element based on the next.

modifylimits(contents, index)[source]

Modify a limits commands so that the limits appear above and below.

getlimit(contents, index)[source]

Get the limit for a limits command.

modifyscripts(contents, index)[source]

Modify the super- and subscript to appear vertically aligned.

checkscript(contents, index)[source]

Check if the current element is a sub- or superscript.

checkcommand(contents, index, type)[source]

Check for the given type as the current element.

getscript(contents, index)[source]

Get the sub- or superscript.

class BracketCommand[source]

Bases: OneParamFunction

A command which defines a bracket.

commandmap = {'\\left': 'span class="stretchy"', '\\left.': '<span class="leftdot"></span>', '\\middle': 'span class="stretchy"', '\\right': 'span class="stretchy"', '\\right.': '<span class="rightdot"></span>'}
parsebit(pos)[source]

Parse the bracket.

create(direction, character)[source]

Create the bracket for the given character.

class BracketProcessor[source]

Bases: MathsProcessor

A processor for bracket commands.

process(contents, index)[source]

Convert the bracket using Unicode pieces, if possible.

processleft(contents, index)[source]

Process a left bracket.

checkleft(contents, index)[source]

Check if the command at the given index is left.

checkright(contents, index)[source]

Check if the command at the given index is right.

checkdirection(bit, command)[source]

Check if the given bit is the desired bracket command.

findright(contents, index)[source]

Find the right bracket starting at the given index, or 0.

findmax(contents, leftindex, rightindex)[source]

Find the max size of the contents between the two given indices.

resize(command, size)[source]

Resize a bracket command to the given size.

class ParameterDefinition[source]

Bases: object

The definition of a parameter in a hybrid function.

parambrackets = [('[', ']'), ('{', '}')]
parse(pos)[source]

Parse a parameter definition: [$0], {$x}, {$1!}…

read(pos, function)[source]

Read the parameter itself using the definition.

__str__()[source]

Return a printable representation.

class ParameterFunction[source]

Bases: CommandBit

A function with a variable number of parameters defined in a template.

readparams(readtemplate, pos)[source]

Read the params according to the template.

paramdefs(readtemplate)[source]

Read each param definition in the template

getparam(name)[source]

Get a parameter as parsed.

getvalue(name)[source]

Get the value of a parameter.

getliteralvalue(name)[source]

Get the literal value of a parameter.

class HybridFunction[source]

Bases: ParameterFunction

A parameter function where the output is also defined using a template. The template can use a number of functions; each function has an associated tag. Example: [f0{$1},span class=”fbox”] defines a function f0 which corresponds to a span of class fbox, yielding <span class=”fbox”>$1</span>. Literal parameters can be used in tags definitions:

[f0{$1},span style=”color: $p;”]

yields <span style=”color: $p;”>$1</span>, where $p is a literal parameter. Sizes can be specified in hybridsizes, e.g. adding parameter sizes. By default the resulting size is the max of all arguments. Sizes are used to generate the right parameters. A function followed by a single / is output as a self-closing XHTML tag:

[f0/,hr]

will generate <hr/>.

commandmap = {'\\addcontentsline': ['{$p!}{$q!}{$r!}', 'f0{}', 'ignored'], '\\addtocontents': ['{$p!}{$q!}', 'f0{}', 'ignored'], '\\backmatter': ['', 'f0{}', 'ignored'], '\\binom': ['{$1}{$2}', 'f2{(}f0{f1{$1}f1{$2}}f2{)}', 'span class="binom"', 'span class="binomstack"', 'span class="bigdelimiter size2"'], '\\boxed': ['{$1}', 'f0{$1}', 'span class="boxed"'], '\\cfrac': ['[$p!]{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fullfraction"', 'span class="numerator align-$p"', 'span class="denominator"', 'span class="ignored"'], '\\color': ['{$p!}{$1}', 'f0{$1}', 'span style="color: $p;"'], '\\colorbox': ['{$p!}{$1}', 'f0{$1}', 'span class="colorbox" style="background: $p;"'], '\\dbinom': ['{$1}{$2}', '(f0{f1{f2{$1}}f1{f2{\u2005}}f1{f2{$2}}})', 'span class="binomial"', 'span class="binomrow"', 'span class="binomcell"'], '\\dfrac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fullfraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\displaystyle': ['{$1}', 'f0{$1}', 'span class="displaystyle"'], '\\fancyfoot': ['[$p!]{$q!}', 'f0{}', 'ignored'], '\\fancyhead': ['[$p!]{$q!}', 'f0{}', 'ignored'], '\\fbox': ['{$1}', 'f0{$1}', 'span class="fbox"'], '\\fboxrule': ['{$p!}', 'f0{}', 'ignored'], '\\fboxsep': ['{$p!}', 'f0{}', 'ignored'], '\\fcolorbox': ['{$p!}{$q!}{$1}', 'f0{$1}', 'span class="boxed" style="border-color: $p; background: $q;"'], '\\frac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="fraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\framebox': ['[$p!][$q!]{$1}', 'f0{$1}', 'span class="framebox align-$q" style="width: $p;"'], '\\frontmatter': ['', 'f0{}', 'ignored'], '\\href': ['[$o]{$u!}{$t!}', 'f0{$t}', 'a href="$u"'], '\\hspace': ['{$p!}', 'f0{ }', 'span class="hspace" style="width: $p;"'], '\\leftroot': ['{$p!}', 'f0{ }', 'span class="leftroot" style="width: $p;px"'], '\\nicefrac': ['{$1}{$2}', 'f0{f1{$1}⁄f2{$2}}', 'span class="fraction"', 'sup class="numerator"', 'sub class="denominator"', 'span class="ignored"'], '\\parbox': ['[$p!]{$w!}{$1}', 'f0{1}', 'div class="Boxed" style="width: $w;"'], '\\raisebox': ['{$p!}{$1}', 'f0{$1.font}', 'span class="raisebox" style="vertical-align: $p;"'], '\\renewenvironment': ['{$1!}{$2!}{$3!}', ''], '\\rule': ['[$v!]{$w!}{$h!}', 'f0/', 'hr class="line" style="width: $w; height: $h;"'], '\\scriptscriptstyle': ['{$1}', 'f0{$1}', 'span class="scriptscriptstyle"'], '\\scriptstyle': ['{$1}', 'f0{$1}', 'span class="scriptstyle"'], '\\sqrt': ['[$0]{$1}', 'f0{f1{$0}f2{√}f4{(}f3{$1}f4{)}}', 'span class="sqrt"', 'sup class="root"', 'span class="radical"', 'span class="root"', 'span class="ignored"'], '\\stackrel': ['{$1}{$2}', 'f0{f1{$1}f2{$2}}', 'span class="stackrel"', 'span class="upstackrel"', 'span class="downstackrel"'], '\\tbinom': ['{$1}{$2}', '(f0{f1{f2{$1}}f1{f2{\u2005}}f1{f2{$2}}})', 'span class="binomial"', 'span class="binomrow"', 'span class="binomcell"'], '\\textcolor': ['{$p!}{$1}', 'f0{$1}', 'span style="color: $p;"'], '\\textstyle': ['{$1}', 'f0{$1}', 'span class="textstyle"'], '\\tfrac': ['{$1}{$2}', 'f0{f3{(}f1{$1}f3{)/(}f2{$2}f3{)}}', 'span class="textfraction"', 'span class="numerator"', 'span class="denominator"', 'span class="ignored"'], '\\thispagestyle': ['{$p!}', 'f0{}', 'ignored'], '\\unit': ['[$0]{$1}', '$0f0{$1.font}', 'span class="unit"'], '\\unitfrac': ['[$0]{$1}{$2}', '$0f0{f1{$1.font}⁄f2{$2.font}}', 'span class="fraction"', 'sup class="unit"', 'sub class="unit"'], '\\uproot': ['{$p!}', 'f0{ }', 'span class="uproot" style="width: $p;px"'], '\\url': ['{$u!}', 'f0{$u}', 'a href="$u"'], '\\vspace': ['{$p!}', 'f0{ }', 'span class="vspace" style="height: $p;"']}
parsebit(pos)[source]

Parse a function with [] and {} parameters

writeparams(writetemplate)[source]

Write all params according to the template

writepos(pos)[source]

Write all params as read in the parse position.

writeparam(pos)[source]

Write a single param of the form $0, $x…

writefunction(pos)[source]

Write a single function f0,…,fn.

readtag(pos)[source]

Get the tag corresponding to the given index. Does parameter substitution.

writebracket(direction, character)[source]

Return a new bracket looking at the given direction.

computehybridsize()[source]

Compute the size of the hybrid function.

class HybridSize[source]

Bases: object

The size associated with a hybrid function.

configsizes = {'\\binom': '$1+$2', '\\cfrac': '$1+$2', '\\dbinom': '$1+$2+1', '\\dfrac': '$1+$2', '\\frac': '$1+$2', '\\tbinom': '$1+$2+1'}
getsize(function)[source]

Read the size for a function and parse it.

math2html(formula)[source]

Convert some TeX math to HTML.

main()[source]

Main function, called if invoked from the command line