Module: Ritex::MathML
- Defined in:
- lib/ritex/mathml/entities.rb,
lib/ritex/mathml/markup.rb,
lib/ritex/mathml/functions.rb
Overview
As many MathML-specific aspected of Ritex are stored in this module as possible. Note that the rdoc documentation for this module is woefully incorrect because we programmatically modify the globals in this package.
Constant Summary collapse
- MARKUP =
A simple mapping between markup elements used in parser.y and actual MathML elements.
{ :subsup => "msubsup", :sub => "msub", :sup => "msup", :num => "mn", :var => "mi", :group => "mrow", :op => "mo", :unaryminus => ['mo', 'lspace="verythinmathspace" rspace="0em"'], :array => "mtable", :row => "mtr", :cell => "mtd", :math => ["math", 'xmlns="http://www.w3.org/1998/Math/MathML" display="inline"'], :displaymath => ["math", 'xmlns="http://www.w3.org/1998/Math/MathML" display="block"'], }
- DEFAULTS =
Default entities, mostly stolen from www.orcca.on.ca/mathml/texmml/texmml.xml. We overwrite many of these below.
{ "{" => "<mo>{</mo>", "}" => "<mo>}</mo>", "Vert" => "<mo>∥</mo>", "vert" => "<mo>∣</mo>", "lbrack" => "<mo>[</mo>", "lbrace" => "<mo>{</mo>", "lfloor" => "<mo>⌊</mo>", "lceil" => "<mo>⌈</mo>", "langle" => "<mo>〈</mo>", "lgroup" => "<mo>(</mo>", "rbrack" => "<mo>]</mo>", "rbrace" => "<mo>}</mo>", "backslash" => "<mo>\\</mo>", "rfloor" => "<mo>⌋</mo>", "rceil" => "<mo>⌉</mo>", "rangle" => "<mo>〉</mo>", "rgroup" => "<mo>)</mo>", "uparrow" => "<mo>↑</mo>", "Uparrow" => "<mo>⇑</mo>", "downarrow" => "<mo>↓</mo>", "Downarrow" => "<mo>⇓</mo>", "updownarrow" => "<mo>⇅</mo>", "Updownarrow" => "<mo>⇕</mo>", "leftarrow" => "<mo>←</mo>", "gets" => "<mo>←</mo>", "Leftarrow" => "<mo>⇐</mo>", "rightarrow" => "<mo>→</mo>", "to" => "<mo>→</mo>", "Rightarrow" => "<mo>⇒</mo>", "leftrightarrow" => "<mo>⇆</mo>", "Leftrightarrow" => "<mo>⇔</mo>", "mapsto" => "<mo>↦</mo>", "hookleftarrow" => "<mo>↩</mo>", "leftharpoonup" => "<mo>↼</mo>", "leftharpoondown" => "<mo>↽</mo>", "rightleftharpoons" => "<mo>⇌</mo>", "longleftarrow" => "<mo>←</mo>", "Longleftarrow" => "<mo>⇐</mo>", "longrightarrow" => "<mo>→</mo>", "Longrightarrow" => "<mo>⇒</mo>", "longleftrightarrow" => "<mo>↔</mo>", "Longleftrightarrow" => "<mo>⇔</mo>", "longmapsto" => "<mo>↦</mo>", "leadsto" => "<mo>⇝</mo>", "hookrightarrow" => "<mo>↪</mo>", "rightharpoonup" => "<mo>⇀</mo>", "rightharpoondown" => "<mo>⇁</mo>", "nearrow" => "<mo>↗</mo>", "searrow" => "<mo>↘</mo>", "swarrow" => "<mo>↙</mo>", "nwarrow" => "<mo>↖</mo>", "arrowvert" => "<mo>∣</mo>", "Arrowvert" => "<mo>∥</mo>", "bracevert" => "<mo mathvariant='bold'>∣</mo>", "lmoustache" => "<mo>⎰</mo>", "rmoustache" => "<mo>⎱</mo>", "leftarrowfill" => "<mo stretchy='true'>←</mo>", "rightarrowfill" => "<mo stretchy='true'>→</mo>", "iff" => "<mo>⇔</mo>", "dashrightarrow" => "<mo>⇢</mo>", "dashleftarrow" => "<mo>⇠</mo>", "leftleftarrows" => "<mo>⇇</mo>", "leftrightarrows" => "<mo>⇆</mo>", "Lleftarrow" => "<mo>⇚</mo>", "twoheadleftarrow" => "<mo>↞</mo>", "leftarrowtail" => "<mo>↢</mo>", "looparrowleft" => "<mo>↫</mo>", "leftrightharpoons" => "<mo>⇋</mo>", "curvearrowleft" => "<mo>↶</mo>", "circlearrowleft" => "<mo>↺</mo>", "Lsh" => "<mo>↰</mo>", "upuparrows" => "<mo>⇈</mo>", "upharpoonleft" => "<mo>↿</mo>", "downharpoonleft" => "<mo>⇃</mo>", "multimap" => "<mo>⊸</mo>", "leftrightsquigarrow" => "<mo>↭</mo>", "rightrightarrows" => "<mo>⇉</mo>", "rightleftarrows" => "<mo>⇄</mo>", "twoheadrightarrow" => "<mo>↠</mo>", "rightarrowtail" => "<mo>↣</mo>", "looparrowright" => "<mo>↬</mo>", "rightleftharpoons" => "<mo>⇌</mo>", "curvearrowright" => "<mo>↷</mo>", "circlearrowright" => "<mo>↻</mo>", "Rsh" => "<mo>↱</mo>", "downdownarrows" => "<mo>⇊</mo>", "upharpoonright" => "<mo>↾</mo>", "rightsquigarrow" => "<mo>⇝</mo>", "nleftarrow" => "<mo>↚</mo>", "nrightarrow" => "<mo>↛</mo>", "nLeftarrow" => "<mo>⇍</mo>", "nRightarrow" => "<mo>⇏</mo>", "nleftrightarrow" => "<mo>↮</mo>", "nLeftrightarrow" => "<mo>⇎</mo>", "dotplus" => "<mo>∔</mo>", "smallsetminus" => "<mo>∖</mo>", "Cap" => "<mo>⋒</mo>", "Cup" => "<mo>⋓</mo>", "barwedge" => "<mo>⊼</mo>", "doublebarwedge" => "<mo>⌆</mo>", "veebar" => "<mo>⊻</mo>", "boxminus" => "<mo>⊟</mo>", "boxtimes" => "<mo>⊠</mo>", "boxdot" => "<mo>⊡</mo>", "boxplus" => "<mo>⊞</mo>", "divideontimes" => "<mo>⋇</mo>", "ltimes" => "<mo>⋉</mo>", "rtimes" => "<mo>⋊</mo>", "leftthreetimes" => "<mo>⋋</mo>", "rightthreetimes" => "<mo>⋌</mo>", "curlywedge" => "<mo>⋏</mo>", "curlyvee" => "<mo>⋏</mo>", "circleddash" => "<mo>⊝</mo>", "circledast" => "<mo>⊛</mo>", "circledcirc" => "<mo>⊚</mo>", "centerdot" => "<mo>⋅</mo>", "intercal" => "<mo>⊺</mo>", "digamma" => "<mo>Ϝ</mo>", "varkappa" => "<mo>ϰ</mo>", "beth" => "<mo>ℶ</mo>", "daleth" => "<mo>ℸ</mo>", "gimel" => "<mo>ℷ</mo>", "ulcorner" => "<mo>⌜</mo>", "urcorner" => "<mo>⌝</mo>", "llcorner" => "<mo>⌞</mo>", "lrcorner" => "<mo>⌟</mo>", "leqq" => "<mo>≦</mo>", "leqslant" => "<mo>⩽</mo>", "eqslantless" => "<mo>⪕</mo>", "lessapprox" => "<mo>⪅</mo>", "lesssim" => "<mo>≲</mo>", "approxeq" => "<mo>≊</mo>", "lessdot" => "<mo>⋖</mo>", "lll" => "<mo>⋘</mo>", "lessgtr" => "<mo>≶</mo>", "lesseqgtr" => "<mo>⋚</mo>", "lesseqqgtr" => "<mo>⪋</mo>", "doteqdot" => "<mo>≑</mo>", "risingdotseq" => "<mo>≓</mo>", "fallingdotseq" => "<mo>≒</mo>", "backsim" => "<mo>∽</mo>", "backsimeq" => "<mo>⋍</mo>", "subseteqq" => "<mo>⫅</mo>", "Subset" => "<mo>⋐</mo>", "sqsubset" => "<mo>⊏</mo>", "preccurlyeq" => "<mo>≼</mo>", "curlyeqprec" => "<mo>⋞</mo>", "precsim" => "<mo>≾</mo>", "precapprox" => "<mo>⪷</mo>", "vartriangleleft" => "<mo>⊲</mo>", "trianglelefteq" => "<mo>⊴</mo>", "Vvdash" => "<mo>⊪</mo>", "smallsmile" => "<mo>⌣</mo>", "smallfrown" => "<mo>⌢</mo>", "bumpeq" => "<mo>≏</mo>", "Bumpeq" => "<mo>≎</mo>", "geqq" => "<mo>≧</mo>", "geqslant" => "<mo>⩾</mo>", "eqslantgtr" => "<mo>⪖</mo>", "eqslantgtr" => "<mo>⋝</mo>", "gtrsim" => "<mo>≳</mo>", "gtrapprox" => "<mo>⪆</mo>", "gtrdot" => "<mo>⋗</mo>", "ggg" => "<mo>⋙</mo>", "gtrless" => "<mo>≷</mo>", "gtreqless" => "<mo>⋛</mo>", "gtreqqless" => "<mo>⪌</mo>", "eqcirc" => "<mo>≖</mo>", "circeq" => "<mo>≗</mo>", "triangleq" => "<mo>≜</mo>", "thicksim" => "<mo>∼</mo>", "supseteqq" => "<mo>⫆</mo>", "thickapprox" => "<mo>≈</mo>", "Supset" => "<mo>⋑</mo>", "sqsupset" => "<mo>⊐</mo>", "succcurlyeq" => "<mo>≽</mo>", "curlyeqsucc" => "<mo>⋟</mo>", "succsim" => "<mo>≿</mo>", "succapprox" => "<mo>⪸</mo>", "vartriangleright" => "<mo>⊳</mo>", "trianglerighteq" => "<mo>⊵</mo>", "Vdash" => "<mo>⊩</mo>", "shortmid" => "<mo>∣</mo>", "shortparallel" => "<mo>∥</mo>", "between" => "<mo>≬</mo>", "pitchfork" => "<mo>⏔</mo>", "varpropto" => "<mo>∝</mo>", "blacktriangleleft" => "<mo>◀</mo>", "therefore" => "<mo>∴</mo>", "backepsilon" => "<mo>∋</mo>", "blacktriangleright" => "<mo>▶</mo>", "because" => "<mo>∵</mo>", "nless" => "<mo>≮</mo>", "nleq" => "<mo>≰</mo>", "lneq" => "<mo>⪇</mo>", "lneqq" => "<mo>≨</mo>", "lnsim" => "<mo>⋦</mo>", "lnapprox" => "<mo>⪉</mo>", "precnsim" => "<mo>⋨</mo>", "precnapprox" => "<mo>⪹</mo>", "nsim" => "<mo>≁</mo>", "nmid" => "<mo>∤</mo>", "nvdash" => "<mo>⊬</mo>", "nvDash" => "<mo>⊭</mo>", "ntriangleleft" => "<mo>⋪</mo>", "ntrianglelefteq" => "<mo>⋬</mo>", "nsubseteq" => "<mo>⊈</mo>", "subsetneq" => "<mo>⊊</mo>", "subsetneqq" => "<mo>⫋</mo>", "ntrianglelefteq" => "<mo>⋬</mo>", "ngtr" => "<mo>≯</mo>", "ngeq" => "<mo>≱</mo>", "gneq" => "<mo>⪈</mo>", "gneqq" => "<mo>≩</mo>", "gnsim" => "<mo>⋧</mo>", "gnapprox" => "<mo>⪊</mo>", "succnsim" => "<mo>⋩</mo>", "succnapprox" => "<mo>⪺</mo>", "ncong" => "<mo>≇</mo>", "nshortparallel" => "<mo>∦</mo>", "nparallel" => "<mo>∦</mo>", "nVDash" => "<mo>⊯</mo>", "ntriangleright" => "<mo>⋫</mo>", "ntrianglerighteq" => "<mo>⋭</mo>", "nsupseteq" => "<mo>⊉</mo>", "nsupseteq" => "<mo>⊉</mo>", "supsetneq" => "<mo>⊋</mo>", "supsetneqq" => "<mo>⫌</mo>", "hbar" => "<mo>ħ</mo>", "hslash" => "<mo>ℏ</mo>", "vartriangle" => "<mo>△</mo>", "triangledown" => "<mo>▽</mo>", "square" => "<mo>□</mo>", "lozenge" => "<mo>◊</mo>", "circledS" => "<mo>Ⓢ</mo>", "measuredangle" => "<mo>∡</mo>", "nexists" => "<mo>∄</mo>", "mho" => "<mo>℧</mo>", "Finv" => "<mo>Ⅎ</mo>", "backprime" => "<mo>‵</mo>", "varnothing" => "<mo>Ø</mo>", "blacktriangle" => "<mo>▲</mo>", "blacktriangledown" => "<mo>▼</mo>", "blacksquare" => "<mo>■</mo>", "blacklozenge" => "<mo>◊</mo>", "bigstar" => "<mo>★</mo>", "sphericalangle" => "<mo>∢</mo>", "complement" => "<mo>∁</mo>", "eth" => "<mo>ð</mo>", "qed" => "<mo>□</mo>", "i" => "<mo>ı</mo>", "j" => "<mo>j</mo>", "alpha" => "<mi>α</mi>", "beta" => "<mi>β</mi>", "gamma" => "<mi>γ</mi>", "delta" => "<mi>δ</mi>", "epsilon" => "<mi>ε</mi>", "varepsilon" => "<mi>ε</mi>", "zeta" => "<mi>ζ</mi>", "eta" => "<mi>η</mi>", "theta" => "<mi>θ</mi>", "vartheta" => "<mi>ϑ</mi>", "iota" => "<mi>ι</mi>", "kappa" => "<mi>κ</mi>", "lambda" => "<mi>λ</mi>", "mu" => "<mi>μ</mi>", "nu" => "<mi>ν</mi>", "xi" => "<mi>ξ</mi>", "pi" => "<mi>π</mi>", "varpi" => "<mi>ϖ</mi>", "rho" => "<mi>ρ</mi>", "varrho" => "<mi>ϱ</mi>", "varsigma" => "<mi>ς</mi>", "sigma" => "<mi>σ</mi>", "tau" => "<mi>τ</mi>", "upsilon" => "<mi>υ</mi>", "phi" => "<mi>φ</mi>", "varphi" => "<mi>ϕ</mi>", "chi" => "<mi>χ</mi>", "psi" => "<mi>ψ</mi>", "omega" => "<mi>ω</mi>", "Gamma" => "<mi>Γ</mi>", "Delta" => "<mi>Δ</mi>", "Theta" => "<mi>Θ</mi>", "Lambda" => "<mi>Λ</mi>", "Xi" => "<mi>Ξ</mi>", "Pi" => "<mi>Π</mi>", "Sigma" => "<mi>Σ</mi>", "Upsilon" => "<mi>Υ</mi>", "Phi" => "<mi>Φ</mi>", "Psi" => "<mi>Ψ</mi>", "Omega" => "<mi>Ω</mi>", "varGamma" => "<mi>Γ</mi>", "varDelta" => "<mi>Δ</mi>", "varTheta" => "<mi>Θ</mi>", "varLambda" => "<mi>Λ</mi>", "varXi" => "<mi>Ξ</mi>", "varPi" => "<mi>Π</mi>", "varSigma" => "<mi>Σ</mi>", "varUpsilon" => "<mi>Υ</mi>", "varPhi" => "<mi>Φ</mi>", "varPsi" => "<mi>Ψ</mi>", "varOmega" => "<mi>Ω</mi>", "colon" => "<mo>:</mo>", "&" => "<mo>&</mo>", "aleph" => "<mo>ℵ</mo>", "imath" => "<mo>⍳</mo>", "jmath" => "<mo>j</mo>", "ell" => "<mo>ℓ</mo>", "wp" => "<mo>℘</mo>", "Re" => "<mo>ℜ</mo>", "Im" => "<mo>ℑ</mo>", "prime" => "<mo>′</mo>", "emptyset" => "<mo>∅</mo>", "nabla" => "<mo>∇</mo>", "surd" => "<mo>√</mo>", "partial" => "<mo>∂</mo>", "top" => "<mo>Τ</mo>", "bot" => "<mo>Υ</mo>", "vdash" => "<mo>⊢</mo>", "dashv" => "<mo>⊣</mo>", "forall" => "<mo>∀</mo>", "exists" => "<mo>∃</mo>", "neg" => "<mo>¬</mo>", "flat" => "<mo>♭</mo>", "natural" => "<mo>♮</mo>", "sharp" => "<mo>♯</mo>", "angle" => "<mo>∠</mo>", "Box" => "<mo>▫</mo>", "Diamond" => "<mo>◊</mo>", "triangle" => "<mo>△</mo>", "clubsuit" => "<mo>♣</mo>", "diamondsuit" => "<mo>♦</mo>", "heartsuit" => "<mo>♥</mo>", "spadesuit" => "<mo>♠</mo>", "Join" => "<mo>⋈</mo>", "infty" => "<mo>∞</mo>", "lnot" => "<mo>⌐</mo>", "bull" => "<mo>▪</mo>", "cents" => "<mo>¢</mo>", "sum" => "<mo>∑</mo>", "prod" => "<mo>∏</mo>", "coprod" => "<mo>∐</mo>", "int" => "<mo>∫</mo>", "iint" => "<mo>∬</mo>", "iiint" => "<mo>∭</mo>", "iiiint" => "<mo>⨌</mo>", "idotsint" => "<mo>∫</mo>", "oint" => "<mo>∮</mo>", "bigcap" => "<mo>∩</mo>", "bigcup" => "<mo>∪</mo>", "bigsqcup" => "<mo>⊔</mo>", "bigvee" => "<mo>⋁</mo>", "bigwedge" => "<mo>⋀</mo>", "bigodot" => "<mo>⊙</mo>", "bigotimes" => "<mo>⊗</mo>", "bigoplus" => "<mo>⊕</mo>", "biguplus" => "<mo>⊎</mo>", "oe" => "<mo>œ</mo>", "OE" => "<mo>Œ</mo>", "ae" => "<mo>æ</mo>", "AE" => "<mo>Æ</mo>", "aa" => "<mo>å</mo>", "AA" => "<mo>Å</mo>", "o" => "<mo>ø</mo>", "O" => "<mo>Ø</mo>", "l" => "<mo>ł</mo>", "L" => "<mo>Ł</mo>", "SS" => "<mo>ß</mo>", "S" => "<mo>§</mo>", "copyright" => "<mo>©</mo>", "P" => "<mo>¶</mo>", "pounds" => "<mo>£</mo>", "pm" => "<mo>±</mo>", "mp" => "<mo>±</mo>", "times" => "<mo>×</mo>", "div" => "<mo>÷</mo>", "cdot" => "<mo>⋅</mo>", "ast" => "<mo>*</mo>", "star" => "<mo>⋆</mo>", "dagger" => "<mo>†</mo>", "dag" => "<mo>†</mo>", "ddagger" => "<mo>‡</mo>", "ddag" => "<mo>‡</mo>", "amalg" => "<mo>∐</mo>", "cap" => "<mo>∩</mo>", "cup" => "<mo>∪</mo>", "uplus" => "<mo>⊎</mo>", "sqcap" => "<mo>⊓</mo>", "sqcup" => "<mo>⊔</mo>", "vee" => "<mo>∨</mo>", "wedge" => "<mo>∧</mo>", "oplus" => "<mo>⊕</mo>", "ominus" => "<mo>⊖</mo>", "otimes" => "<mo>⊗</mo>", "oslash" => "<mo>⊘</mo>", "odot" => "<mo>⊙</mo>", "circ" => "<mo>∘</mo>", "bullet" => "<mo>∙</mo>", "diamond" => "<mo>⋄</mo>", "lhd" => "<mo>⊲</mo>", "rhd" => "<mo>⊳</mo>", "unlhd" => "<mo>⊴</mo>", "unrhd" => "<mo>⊵</mo>", "bigcirc" => "<mo>◯</mo>", "bigtriangleup" => "<mo>△</mo>", "bigtriangledown" => "<mo>▽</mo>", "triangleleft" => "<mo>◅</mo>", "triangleright" => "<mo>▻</mo>", "setminus" => "<mo>∖</mo>", "wr" => "<mo>≀</mo>", "lor" => "<mo>∨</mo>", "land" => "<mo>∧</mo>", "cdots" => "<mo>⋯</mo>", "ddots" => "<mo>⋱</mo>", "vdots" => "<mo>⋮</mo>", "ldots" => "<mo>…</mo>", "dots" => "<mo>⋯</mo>", "dotsb" => "<mo>⋯</mo>", "dotsc" => "<mo>…</mo>", "dotsi" => "<mo>⋯</mo>", "dotsm" => "<mo>⋯</mo>", "dotso" => "<mo>⋯</mo>", "=" => "<mo>=</mo>", "leq" => "<mo>≤</mo>", "le" => "<mo>≤</mo>", "ll" => "<mo>≪</mo>", "geq" => "<mo>≥</mo>", "ge" => "<mo>≥</mo>", "gg" => "<mo>≫</mo>", "ne" => "<mo>≠</mo>", "neq" => "<mo>≠</mo>", "doteq" => "<mo>≐</mo>", "subset" => "<mo>⊂</mo>", "subseteq" => "<mo>⊆</mo>", "sqsubseteq" => "<mo>⊑</mo>", "supset" => "<mo>⊃</mo>", "supseteq" => "<mo>⊇</mo>", "sqsupseteq" => "<mo>⊒</mo>", "in" => "<mo>∈</mo>", "ni" => "<mo>∋</mo>", "models" => "<mo>⊧</mo>", "perp" => "<mo>⊥</mo>", "approx" => "<mo>≈</mo>", "cong" => "<mo>≅</mo>", "equiv" => "<mo>≍</mo>", "propto" => "<mo>∝</mo>", "prec" => "<mo>≺</mo>", "preceq" => "<mo>≼</mo>", "parallel" => "<mo>∥</mo>", "sim" => "<mo>∼</mo>", "simeq" => "<mo>≃</mo>", "asymp" => "<mo>≍</mo>", "smile" => "<mo>⌣</mo>", "frown" => "<mo>⌢</mo>", "bowtie" => "<mo>⋈</mo>", "succ" => "<mo>≻</mo>", "succeq" => "<mo>≽</mo>", "mid" => "<mo>∣</mo>", "owns" => "<mo>∋</mo>", "notin" => "<mo>∉</mo>", "arccos" => "<mi>arccos</mi>", "arcsin" => "<mi>arcsin</mi>", "arctan" => "<mi>arctan</mi>", "arg" => "<mi>arg</mi>", "cos" => "<mi>cos</mi>", "cosh" => "<mi>cosh</mi>", "cot" => "<mi>cot</mi>", "coth" => "<mi>coth</mi>", "csc" => "<mi>csc</mi>", "deg" => "<mi>deg</mi>", "det" => "<mi>det</mi>", "dim" => "<mi>dim</mi>", "exp" => "<mi>exp</mi>", "gcd" => "<mi>gcd</mi>", "hom" => "<mi>hom</mi>", "inf" => "<mi>inf</mi>", "ker" => "<mi>ker</mi>", "lg" => "<mi>lg</mi>", "lim" => "<mi>lim</mi>", "liminf" => "<mi>lim inf</mi>", "limsup" => "<mi>lim sum</mi>", "ln" => "<mi>ln</mi>", "log" => "<mi>log</mi>", "bmod" => "<mi>mod</mi>", "mod" => "<mi lspace='1em'>mod</mi>", "max" => "<mi>max</mi>", "min" => "<mi>min</mi>", "Pr" => "<mi>Pr</mi>", "sec" => "<mi>sec</mi>", "sin" => "<mi>sin</mi>", "sinh" => "<mi>sin</mi>", "sup" => "<mi>sup</mi>", "tan" => "<mi>tan</mi>", "tanh" => "<mi>tanh</mi>", "," => "<mo> </mo>", "thinspace" => "<mo> </mo>", "implies" => "<mo>⇒</mo>", "injlim" => "<mo>inj lim</mo>", "projlim" => "<mo>proj lim</mo>", "nobreakdash" => "<mo>‑</mo>", "lvert" => "<mo form='prefix'>|</mo>", "rvert" => "<mo form='postfix'>|</mo>", "lVert" => "<mo form='prefix'>‖</mo>", "rVert" => "<mo form='postfix'>‖</mo>", }
- NUMS =
numbers
generate "mn", "", { ["infty", "infinity"] => "infin", }
- GREEK =
greek letters
generate "mi", "", { "omicron" => "oscr", "epsilon" => "epsi", }, %w(alpha beta gamma delta epsilon varepsilon zeta eta theta vartheta iota kappa lambda mu nu xi pi varpi rho varrho sigma varsigma tau upsilon phi varphi chi psi omega Gamma Delta Theta Lambda Xi Pi Sigma Upsilon Phi Psi Omega)
- OPERATORS =
regular operators (“MOL” in itex2MML parlance)
generate "mo", "", { "in" => "Element", "bottom" => "perp", "neg" => "not", "mid" => "VerticalBar", "|" => "DoubleVerticalBar", ["int", "integral"] => "Integral", ["iint", "doubleintegral"] => "Int", ["iiint", "tripleintegral"] => "tint", ["iiiint", "quadtrupleintegral"] => "qint", }, [ ["Longleftrightarrow", "iff"], "Leftrightarrow", ["impliedby", "Leftarrow"], ["implies", "Rightarrow"], "hookleftarrow", ["embedsin", "hookrightarrow"], "longleftarrow", "longrightarrow", "leftarrow", ["to", "rightarrow"], "leftrightarrow", ["mapsto", "map"], ["nearrow", "nearr"], ["nwarrow", "nwarr"], ["searrow", "searr"], ["swarrow", "swarr"], ["neArrow", "neArr"], ["nwArrow", "nwArr"], ["seArrow", "seArr"], ["swArrow", "swArr"], ["downarrow", "darr"], ["uparrow", "uparr"], ["downuparrow", "updownarrow", "duparr", "updarr"], ["union", "cup"], ["neq", "ne"], ["oint", "contourintegral", "conint"], "times", "otimes", "oplus", "wedge", ] + %w(lfloor lceil lang langle gt lt subset subseteq prec parallel nparallel perp gg geq ge le leq nsubset nsubseteq notin ni nmid preceq npreceq ll ngeq nleq supset supseteq approx sim triangleleft cong succ nsucc ngtr nsupset nsupseteq propto equiv triangleright ncong succeq nsucceq amalg setminus smallsetminus pm circ ltimes div rtimes Im bot emptyset prime therefore flat vee Re exists hbar because sharp bullet aleph nexists imath not top wp natural square angle forall jmath partial ell bigtriangleup bigtriangledown beth nprec Subset)
- NOTATION =
notation (“MO”)
generate "mo", "", { "cdot" => "sdot", "ddots" => "dtdot", "ldots" => "ltdot", "vdots" => "vellip", "qed" => "squf", }, %w(rfloor rceil rang rangle)
- UNARY_OPERATORS =
unary operators (“MOB”)
generate "mo", 'lspace="thinmathspace" rspace="thinmathspace"', { "sum" => "Sum", ["bigwedge", "Wedge"] => "xwedge", }, [ ["bigcup", "Union"], ["product", "prod"], ["coproduct", "coprod"], ["bigotimes", "Otimes"], ["bigoplus", "Oplus"], ]
- SPACES =
spaces
{ "," => '<mspace width="thinmathspace"/>', "thinspace" => '<mspace width="thinmathspace"/>', "medspace" => '<mspace width="mediummathspace"/>', " " => '<mspace width="mediummathspace"/>', "thickspace" => '<mspace width="thickmathspace"/>', "quad" => '<mspace width="verythickmathspace"/>', "!" => '<mspace width="-0.1667 em"/>', "negspace" => '<mspace width="-0.1667 em"/>', }
- MATH_FUNCTIONS =
functions
{}
- TOKENS =
{ "-" => "−", "&" => "&", ">" => ">", "<" => "<", }
- ENTITIES =
DEFAULTS.merge(NUMS).merge(GREEK).merge(OPERATORS).merge(NOTATION).merge(UNARY_OPERATORS).merge(SPACES).merge(MATH_FUNCTIONS)
- FUNCTIONS =
{ "frac" => lambda { |a, b| markup a + b, "mfrac" }, "binom" => lambda { |a, b| markup a + b, "mfrac", 'linethickness="0"' }, "textstyle" => lambda { |x| markup x, "mstyle", 'displaystyle="false"' }, "displaystyle" => lambda { |x| markup x, "mstyle", 'displaystyle="true"' }, "underset" => lambda { |a, b| markup b + a, "munder" }, "overset" => lambda { |a, b| markup b + a, "mover" }, "root" => lambda { |a, b| markup b + a, "mroot" }, "sqrt" => lambda { |x| markup x, "msqrt" }, "phantom" => lambda { |x| markup x, "mphantom" }, "underoverset" => lambda { |a, b, c| markup c + a + b, "munderover" }, "scriptsize" => lambda { markup x, "mstyle", 'scriptlevel="1"' }, "scriptscriptsize" => lambda { markup x, "mstyle", 'scriptlevel="2"' }, "textsize" => lambda { markup x, "mstyle", 'scriptlevel="0"' }, ## not implemented stuff--just pass through for now "toggle" => lambda { |x| x }, "fghighlight" => lambda { |x| x }, "bghighlight" => lambda { |x| x }, "tensor" => lambda { |x| x }, "multiscripts" => lambda { |x| x }, "statusline" => lambda { |x| x }, "ulap" => lambda { |x| x }, "llap" => lambda { |x| x }, "rlap" => lambda { |x| x }, "dlap" => lambda { |x| x }, }
- ENVS =
“environments”–things that require strings, i.e. where spaces matter.
{ "text" => lambda { |x| markup x, "mtext" }, "mathcal" => lambda { |x| markup x.map_chars { |c| "&#{c}scr;" }, "mi" }, "mathfr" => lambda { |x| markup x.map_chars { |c| "&#{c}fr;" }, "mi" }, "mathop" => lambda { |x| markup x, 'mo', 'lspace="0em" rspace="thinmathspace"' }, "mathbb" => lambda { |x| markup x.map_chars { |c| "&#{c}opf;" }, "mi" }, "href" => lambda { |x| "<mrow xlink:type=\"simple\" xlink:show=\"replace\" xlink:href=\"#{x}\">#{x}</mrow>" }, "mathit" => lambda { |x| markup x, "mstyle", 'fontstyle="italic"' }, "mathrm" => lambda { |x| markup x, "mstyle", 'fontstyle="normal" fontweight="normal"' }, "mathbf" => lambda { |x| markup x, "mstyle", 'fontweight="bold"' }, "space" => lambda { |h, d, w| "<mspace height=\".#{h}ex\"/ depth=\".#{d}ex\" width=\".#{w}em\">" }, ## these next guys are for array options. we just treat them as environments ## that produce xml options for the mtable tag. so minimal checking at parse time. "align" => lambda { |x| "align='#{x}'" }, "colalign" => lambda { |x| "columnalign='#{x}'" }, "rowalign" => lambda { |x| "rowalign='#{x}'" }, "padding" => lambda { |x| "rowspacing='#{x}' columnspacing='#{x}'" }, "equalrows" => lambda { |x| "equalrows='#{x}'" }, "equalcols" => lambda { |x| "equalcolumns='#{x}'" }, "collines" => lambda { |x| "columnlines='#{x}'" }, "rowlines" => lambda { |x| "rowlines='#{x}'" }, "colspan" => lambda { |x| "columnspan='#{x}'" }, "rowspan" => lambda { |x| "rowspan='#{x}'" }, "frame" => lambda { |x| "frame='#{x}'" }, ## cell options "rowspan" => lambda { |x| "rowspan='#{x}'" }, "colspan" => lambda { |x| "columnspan='#{x}'" }, }
Class Method Summary collapse
-
.generate(element, opts, hash = {}, array = []) ⇒ Object
Generate a hash table of entities from a shorthand version involving a hash table and an array.
- .lookup(*a) ⇒ Object
- .markup(*a) ⇒ Object
Class Method Details
.generate(element, opts, hash = {}, array = []) ⇒ Object
Generate a hash table of entities from a shorthand version involving a hash table and an array.
- element
-
the HTML element to wrap the entities with
- opts
-
arguments to the opening HTML element
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/ritex/mathml/entities.rb', line 532 def generate(element, opts, hash={}, array=[]) ret = {} endt = "</#{element}>" startt = unless opts.nil? || opts.empty? "<#{element} #{opts}>" else "<#{element}>" end array.each do |e| if Array === e e.each { |i| ret[i] = "#{startt}&#{e.last};#{endt}" } else ret[e] = "#{startt}&#{e};#{endt}" end end hash.each do |e, v| if Array === e e.each { |i| ret[i] = "#{startt}&#{v};#{endt}" } else ret[e] = "#{startt}&#{v};#{endt}" end end ret end |
.lookup(*a) ⇒ Object
21 |
# File 'lib/ritex/mathml/functions.rb', line 21 def lookup *a; [:lookup, a] end |
.markup(*a) ⇒ Object
20 |
# File 'lib/ritex/mathml/functions.rb', line 20 def markup *a; [:markup, a] end |