From 11011d7c373c655830053b155eeaf632c2658ac7 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 24 Jun 2021 17:50:34 +1000 Subject: Updated. - added mathjax (freed) - added rss.py - updated publish.el - etc. --- Makefile | 1 + css/page.css | 7 + html-templates/postamble.html | 8 + html-templates/preamble.html | 14 + js/MathJax.js | 26 + js/analytics.js | 13 + js/mathjax/MathJax.js | 3328 ++++++++++++++++++++ js/mathjax/config/AM_CHTML-full.js | 23 + js/mathjax/config/AM_CHTML.js | 23 + js/mathjax/config/AM_HTMLorMML-full.js | 24 + js/mathjax/config/AM_HTMLorMML.js | 24 + js/mathjax/config/AM_SVG-full.js | 23 + js/mathjax/config/AM_SVG.js | 23 + js/mathjax/config/Accessible-full.js | 32 + js/mathjax/config/Accessible.js | 32 + js/mathjax/config/MML_CHTML-full.js | 23 + js/mathjax/config/MML_CHTML.js | 23 + js/mathjax/config/MML_HTMLorMML-full.js | 24 + js/mathjax/config/MML_HTMLorMML.js | 24 + js/mathjax/config/MML_SVG-full.js | 23 + js/mathjax/config/MML_SVG.js | 23 + js/mathjax/config/MMLorHTML.js | 113 + js/mathjax/config/Safe.js | 39 + js/mathjax/config/TeX-AMS-MML_HTMLorMML-full.js | 24 + js/mathjax/config/TeX-AMS-MML_HTMLorMML.js | 24 + js/mathjax/config/TeX-AMS-MML_SVG-full.js | 23 + js/mathjax/config/TeX-AMS-MML_SVG.js | 23 + js/mathjax/config/TeX-AMS_CHTML-full.js | 23 + js/mathjax/config/TeX-AMS_CHTML.js | 23 + js/mathjax/config/TeX-AMS_HTML-full.js | 23 + js/mathjax/config/TeX-AMS_HTML.js | 23 + js/mathjax/config/TeX-AMS_SVG-full.js | 23 + js/mathjax/config/TeX-AMS_SVG.js | 23 + js/mathjax/config/TeX-MML-AM_CHTML-full.js | 23 + js/mathjax/config/TeX-MML-AM_CHTML.js | 23 + js/mathjax/config/TeX-MML-AM_HTMLorMML-full.js | 24 + js/mathjax/config/TeX-MML-AM_HTMLorMML.js | 24 + js/mathjax/config/TeX-MML-AM_SVG-full.js | 23 + js/mathjax/config/TeX-MML-AM_SVG.js | 23 + js/mathjax/config/default.js | 1106 +++++++ js/mathjax/extensions/AssistiveMML.js | 167 + js/mathjax/extensions/CHTML-preview.js | 32 + js/mathjax/extensions/FontWarnings.js | 315 ++ js/mathjax/extensions/HTML-CSS/handle-floats.js | 51 + js/mathjax/extensions/HelpDialog.js | 205 ++ js/mathjax/extensions/MatchWebFonts.js | 311 ++ js/mathjax/extensions/MathEvents.js | 624 ++++ js/mathjax/extensions/MathML/content-mathml.js | 1745 ++++++++++ js/mathjax/extensions/MathML/mml3.js | 786 +++++ js/mathjax/extensions/MathMenu.js | 1666 ++++++++++ js/mathjax/extensions/MathZoom.js | 368 +++ js/mathjax/extensions/Safe.js | 430 +++ js/mathjax/extensions/TeX/AMScd.js | 160 + js/mathjax/extensions/TeX/AMSmath.js | 665 ++++ js/mathjax/extensions/TeX/AMSsymbols.js | 351 +++ js/mathjax/extensions/TeX/HTML.js | 108 + js/mathjax/extensions/TeX/action.js | 85 + js/mathjax/extensions/TeX/autobold.js | 52 + js/mathjax/extensions/TeX/autoload-all.js | 85 + js/mathjax/extensions/TeX/bbox.js | 104 + js/mathjax/extensions/TeX/begingroup.js | 294 ++ js/mathjax/extensions/TeX/boldsymbol.js | 77 + js/mathjax/extensions/TeX/cancel.js | 112 + js/mathjax/extensions/TeX/color.js | 283 ++ js/mathjax/extensions/TeX/enclose.js | 93 + js/mathjax/extensions/TeX/extpfeil.js | 104 + js/mathjax/extensions/TeX/mathchoice.js | 109 + js/mathjax/extensions/TeX/mediawiki-texvc.js | 138 + js/mathjax/extensions/TeX/mhchem.js | 522 +++ js/mathjax/extensions/TeX/mhchem3/mhchem.js | 1776 +++++++++++ js/mathjax/extensions/TeX/newcommand.js | 272 ++ js/mathjax/extensions/TeX/noErrors.js | 407 +++ js/mathjax/extensions/TeX/noUndefined.js | 74 + js/mathjax/extensions/TeX/text-macros.js | 489 +++ js/mathjax/extensions/TeX/unicode.js | 172 + js/mathjax/extensions/TeX/verb.js | 63 + js/mathjax/extensions/a11y/accessibility-menu.js | 186 ++ js/mathjax/extensions/a11y/auto-collapse.js | 500 +++ js/mathjax/extensions/a11y/collapsible.js | 743 +++++ js/mathjax/extensions/a11y/explorer.js | 827 +++++ js/mathjax/extensions/a11y/invalid_keypress.mp3 | Bin 0 -> 9030 bytes js/mathjax/extensions/a11y/invalid_keypress.ogg | Bin 0 -> 5353 bytes js/mathjax/extensions/a11y/mathjax-sre.js | 1633 ++++++++++ js/mathjax/extensions/a11y/mathmaps/de.js | 104 + js/mathjax/extensions/a11y/mathmaps/en.js | 110 + js/mathjax/extensions/a11y/mathmaps/es.js | 104 + js/mathjax/extensions/a11y/mathmaps/fr.js | 104 + js/mathjax/extensions/a11y/mathmaps/mathmaps_ie.js | 518 +++ js/mathjax/extensions/a11y/mathmaps/nemeth.js | 104 + js/mathjax/extensions/a11y/semantic-enrich.js | 208 ++ js/mathjax/extensions/a11y/wgxpath.install.js | 77 + js/mathjax/extensions/asciimath2jax.js | 256 ++ js/mathjax/extensions/fast-preview.js | 157 + js/mathjax/extensions/jsMath2jax.js | 107 + js/mathjax/extensions/mml2jax.js | 265 ++ js/mathjax/extensions/tex2jax.js | 321 ++ js/mathjax/extensions/toMathML.js | 243 ++ js/mathjax/jax/element/mml/jax.js | 1815 +++++++++++ js/mathjax/jax/element/mml/optable/Arrows.js | 124 + js/mathjax/jax/element/mml/optable/BasicLatin.js | 67 + .../jax/element/mml/optable/CombDiacritMarks.js | 37 + .../jax/element/mml/optable/CombDiactForSymbols.js | 38 + js/mathjax/jax/element/mml/optable/Dingbats.js | 40 + .../jax/element/mml/optable/GeneralPunctuation.js | 44 + .../jax/element/mml/optable/GeometricShapes.js | 68 + .../jax/element/mml/optable/GreekAndCoptic.js | 37 + .../jax/element/mml/optable/Latin1Supplement.js | 39 + .../jax/element/mml/optable/LetterlikeSymbols.js | 38 + .../jax/element/mml/optable/MathOperators.js | 230 ++ .../jax/element/mml/optable/MiscMathSymbolsA.js | 44 + .../jax/element/mml/optable/MiscMathSymbolsB.js | 170 + .../element/mml/optable/MiscSymbolsAndArrows.js | 38 + .../jax/element/mml/optable/MiscTechnical.js | 42 + .../jax/element/mml/optable/SpacingModLetters.js | 40 + .../jax/element/mml/optable/SuppMathOperators.js | 291 ++ .../jax/element/mml/optable/SupplementalArrowsA.js | 42 + .../jax/element/mml/optable/SupplementalArrowsB.js | 164 + js/mathjax/jax/input/AsciiMath/config.js | 48 + js/mathjax/jax/input/AsciiMath/jax.js | 1543 +++++++++ js/mathjax/jax/input/MathML/config.js | 43 + js/mathjax/jax/input/MathML/entities/a.js | 92 + js/mathjax/jax/input/MathML/entities/b.js | 118 + js/mathjax/jax/input/MathML/entities/c.js | 116 + js/mathjax/jax/input/MathML/entities/d.js | 114 + js/mathjax/jax/input/MathML/entities/e.js | 94 + js/mathjax/jax/input/MathML/entities/f.js | 62 + js/mathjax/jax/input/MathML/entities/fr.js | 81 + js/mathjax/jax/input/MathML/entities/g.js | 85 + js/mathjax/jax/input/MathML/entities/h.js | 54 + js/mathjax/jax/input/MathML/entities/i.js | 88 + js/mathjax/jax/input/MathML/entities/j.js | 37 + js/mathjax/jax/input/MathML/entities/k.js | 39 + js/mathjax/jax/input/MathML/entities/l.js | 181 ++ js/mathjax/jax/input/MathML/entities/m.js | 63 + js/mathjax/jax/input/MathML/entities/n.js | 222 ++ js/mathjax/jax/input/MathML/entities/o.js | 92 + js/mathjax/jax/input/MathML/entities/opf.js | 81 + js/mathjax/jax/input/MathML/entities/p.js | 86 + js/mathjax/jax/input/MathML/entities/q.js | 37 + js/mathjax/jax/input/MathML/entities/r.js | 140 + js/mathjax/jax/input/MathML/entities/s.js | 172 + js/mathjax/jax/input/MathML/entities/scr.js | 81 + js/mathjax/jax/input/MathML/entities/t.js | 88 + js/mathjax/jax/input/MathML/entities/u.js | 94 + js/mathjax/jax/input/MathML/entities/v.js | 75 + js/mathjax/jax/input/MathML/entities/w.js | 37 + js/mathjax/jax/input/MathML/entities/x.js | 49 + js/mathjax/jax/input/MathML/entities/y.js | 43 + js/mathjax/jax/input/MathML/entities/z.js | 44 + js/mathjax/jax/input/MathML/jax.js | 783 +++++ js/mathjax/jax/input/TeX/config.js | 56 + js/mathjax/jax/input/TeX/jax.js | 2373 ++++++++++++++ .../output/CommonHTML/autoload/annotation-xml.js | 62 + .../jax/output/CommonHTML/autoload/maction.js | 180 ++ .../jax/output/CommonHTML/autoload/menclose.js | 332 ++ .../jax/output/CommonHTML/autoload/mglyph.js | 96 + .../output/CommonHTML/autoload/mmultiscripts.js | 298 ++ js/mathjax/jax/output/CommonHTML/autoload/ms.js | 75 + .../jax/output/CommonHTML/autoload/mtable.js | 604 ++++ .../jax/output/CommonHTML/autoload/multiline.js | 799 +++++ js/mathjax/jax/output/CommonHTML/config.js | 66 + .../jax/output/CommonHTML/fonts/TeX/AMS-Regular.js | 291 ++ .../CommonHTML/fonts/TeX/Caligraphic-Bold.js | 101 + .../output/CommonHTML/fonts/TeX/Fraktur-Bold.js | 127 + .../output/CommonHTML/fonts/TeX/Fraktur-Regular.js | 127 + .../jax/output/CommonHTML/fonts/TeX/Main-Bold.js | 210 ++ .../output/CommonHTML/fonts/TeX/Math-BoldItalic.js | 210 ++ .../output/CommonHTML/fonts/TeX/SansSerif-Bold.js | 154 + .../CommonHTML/fonts/TeX/SansSerif-Italic.js | 154 + .../CommonHTML/fonts/TeX/SansSerif-Regular.js | 154 + .../output/CommonHTML/fonts/TeX/Script-Regular.js | 90 + .../CommonHTML/fonts/TeX/Typewriter-Regular.js | 157 + .../output/CommonHTML/fonts/TeX/fontdata-extra.js | 242 ++ .../jax/output/CommonHTML/fonts/TeX/fontdata.js | 1786 +++++++++++ js/mathjax/jax/output/CommonHTML/jax.js | 2845 +++++++++++++++++ js/mathjax/jax/output/NativeMML/config.js | 54 + js/mathjax/jax/output/NativeMML/jax.js | 1433 +++++++++ js/mathjax/jax/output/PlainSource/config.js | 51 + js/mathjax/jax/output/PlainSource/jax.js | 186 ++ js/mathjax/jax/output/PreviewHTML/config.js | 56 + js/mathjax/jax/output/PreviewHTML/jax.js | 1098 +++++++ js/mathjax/local/local.js | 42 + mathjax-librejs.sh | 5 + pages/index.org | 13 + pages/links.org | 69 + pages/notations.org | 53 + posts/2019-03-13-a-tail-of-two-densities.org | 2 +- publish.el | 7 +- rss.py | 111 + 189 files changed, 48389 insertions(+), 3 deletions(-) create mode 100644 css/page.css create mode 100644 html-templates/postamble.html create mode 100644 html-templates/preamble.html create mode 100644 js/MathJax.js create mode 100644 js/analytics.js create mode 100644 js/mathjax/MathJax.js create mode 100644 js/mathjax/config/AM_CHTML-full.js create mode 100644 js/mathjax/config/AM_CHTML.js create mode 100644 js/mathjax/config/AM_HTMLorMML-full.js create mode 100644 js/mathjax/config/AM_HTMLorMML.js create mode 100644 js/mathjax/config/AM_SVG-full.js create mode 100644 js/mathjax/config/AM_SVG.js create mode 100644 js/mathjax/config/Accessible-full.js create mode 100644 js/mathjax/config/Accessible.js create mode 100644 js/mathjax/config/MML_CHTML-full.js create mode 100644 js/mathjax/config/MML_CHTML.js create mode 100644 js/mathjax/config/MML_HTMLorMML-full.js create mode 100644 js/mathjax/config/MML_HTMLorMML.js create mode 100644 js/mathjax/config/MML_SVG-full.js create mode 100644 js/mathjax/config/MML_SVG.js create mode 100644 js/mathjax/config/MMLorHTML.js create mode 100644 js/mathjax/config/Safe.js create mode 100644 js/mathjax/config/TeX-AMS-MML_HTMLorMML-full.js create mode 100644 js/mathjax/config/TeX-AMS-MML_HTMLorMML.js create mode 100644 js/mathjax/config/TeX-AMS-MML_SVG-full.js create mode 100644 js/mathjax/config/TeX-AMS-MML_SVG.js create mode 100644 js/mathjax/config/TeX-AMS_CHTML-full.js create mode 100644 js/mathjax/config/TeX-AMS_CHTML.js create mode 100644 js/mathjax/config/TeX-AMS_HTML-full.js create mode 100644 js/mathjax/config/TeX-AMS_HTML.js create mode 100644 js/mathjax/config/TeX-AMS_SVG-full.js create mode 100644 js/mathjax/config/TeX-AMS_SVG.js create mode 100644 js/mathjax/config/TeX-MML-AM_CHTML-full.js create mode 100644 js/mathjax/config/TeX-MML-AM_CHTML.js create mode 100644 js/mathjax/config/TeX-MML-AM_HTMLorMML-full.js create mode 100644 js/mathjax/config/TeX-MML-AM_HTMLorMML.js create mode 100644 js/mathjax/config/TeX-MML-AM_SVG-full.js create mode 100644 js/mathjax/config/TeX-MML-AM_SVG.js create mode 100644 js/mathjax/config/default.js create mode 100644 js/mathjax/extensions/AssistiveMML.js create mode 100644 js/mathjax/extensions/CHTML-preview.js create mode 100644 js/mathjax/extensions/FontWarnings.js create mode 100644 js/mathjax/extensions/HTML-CSS/handle-floats.js create mode 100644 js/mathjax/extensions/HelpDialog.js create mode 100644 js/mathjax/extensions/MatchWebFonts.js create mode 100644 js/mathjax/extensions/MathEvents.js create mode 100644 js/mathjax/extensions/MathML/content-mathml.js create mode 100644 js/mathjax/extensions/MathML/mml3.js create mode 100644 js/mathjax/extensions/MathMenu.js create mode 100644 js/mathjax/extensions/MathZoom.js create mode 100644 js/mathjax/extensions/Safe.js create mode 100644 js/mathjax/extensions/TeX/AMScd.js create mode 100644 js/mathjax/extensions/TeX/AMSmath.js create mode 100644 js/mathjax/extensions/TeX/AMSsymbols.js create mode 100644 js/mathjax/extensions/TeX/HTML.js create mode 100644 js/mathjax/extensions/TeX/action.js create mode 100644 js/mathjax/extensions/TeX/autobold.js create mode 100644 js/mathjax/extensions/TeX/autoload-all.js create mode 100644 js/mathjax/extensions/TeX/bbox.js create mode 100644 js/mathjax/extensions/TeX/begingroup.js create mode 100644 js/mathjax/extensions/TeX/boldsymbol.js create mode 100644 js/mathjax/extensions/TeX/cancel.js create mode 100644 js/mathjax/extensions/TeX/color.js create mode 100644 js/mathjax/extensions/TeX/enclose.js create mode 100644 js/mathjax/extensions/TeX/extpfeil.js create mode 100644 js/mathjax/extensions/TeX/mathchoice.js create mode 100644 js/mathjax/extensions/TeX/mediawiki-texvc.js create mode 100644 js/mathjax/extensions/TeX/mhchem.js create mode 100644 js/mathjax/extensions/TeX/mhchem3/mhchem.js create mode 100644 js/mathjax/extensions/TeX/newcommand.js create mode 100644 js/mathjax/extensions/TeX/noErrors.js create mode 100644 js/mathjax/extensions/TeX/noUndefined.js create mode 100644 js/mathjax/extensions/TeX/text-macros.js create mode 100644 js/mathjax/extensions/TeX/unicode.js create mode 100644 js/mathjax/extensions/TeX/verb.js create mode 100644 js/mathjax/extensions/a11y/accessibility-menu.js create mode 100644 js/mathjax/extensions/a11y/auto-collapse.js create mode 100644 js/mathjax/extensions/a11y/collapsible.js create mode 100644 js/mathjax/extensions/a11y/explorer.js create mode 100644 js/mathjax/extensions/a11y/invalid_keypress.mp3 create mode 100644 js/mathjax/extensions/a11y/invalid_keypress.ogg create mode 100644 js/mathjax/extensions/a11y/mathjax-sre.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/de.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/en.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/es.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/fr.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/mathmaps_ie.js create mode 100644 js/mathjax/extensions/a11y/mathmaps/nemeth.js create mode 100644 js/mathjax/extensions/a11y/semantic-enrich.js create mode 100644 js/mathjax/extensions/a11y/wgxpath.install.js create mode 100644 js/mathjax/extensions/asciimath2jax.js create mode 100644 js/mathjax/extensions/fast-preview.js create mode 100644 js/mathjax/extensions/jsMath2jax.js create mode 100644 js/mathjax/extensions/mml2jax.js create mode 100644 js/mathjax/extensions/tex2jax.js create mode 100644 js/mathjax/extensions/toMathML.js create mode 100644 js/mathjax/jax/element/mml/jax.js create mode 100644 js/mathjax/jax/element/mml/optable/Arrows.js create mode 100644 js/mathjax/jax/element/mml/optable/BasicLatin.js create mode 100644 js/mathjax/jax/element/mml/optable/CombDiacritMarks.js create mode 100644 js/mathjax/jax/element/mml/optable/CombDiactForSymbols.js create mode 100644 js/mathjax/jax/element/mml/optable/Dingbats.js create mode 100644 js/mathjax/jax/element/mml/optable/GeneralPunctuation.js create mode 100644 js/mathjax/jax/element/mml/optable/GeometricShapes.js create mode 100644 js/mathjax/jax/element/mml/optable/GreekAndCoptic.js create mode 100644 js/mathjax/jax/element/mml/optable/Latin1Supplement.js create mode 100644 js/mathjax/jax/element/mml/optable/LetterlikeSymbols.js create mode 100644 js/mathjax/jax/element/mml/optable/MathOperators.js create mode 100644 js/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js create mode 100644 js/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js create mode 100644 js/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js create mode 100644 js/mathjax/jax/element/mml/optable/MiscTechnical.js create mode 100644 js/mathjax/jax/element/mml/optable/SpacingModLetters.js create mode 100644 js/mathjax/jax/element/mml/optable/SuppMathOperators.js create mode 100644 js/mathjax/jax/element/mml/optable/SupplementalArrowsA.js create mode 100644 js/mathjax/jax/element/mml/optable/SupplementalArrowsB.js create mode 100644 js/mathjax/jax/input/AsciiMath/config.js create mode 100644 js/mathjax/jax/input/AsciiMath/jax.js create mode 100644 js/mathjax/jax/input/MathML/config.js create mode 100644 js/mathjax/jax/input/MathML/entities/a.js create mode 100644 js/mathjax/jax/input/MathML/entities/b.js create mode 100644 js/mathjax/jax/input/MathML/entities/c.js create mode 100644 js/mathjax/jax/input/MathML/entities/d.js create mode 100644 js/mathjax/jax/input/MathML/entities/e.js create mode 100644 js/mathjax/jax/input/MathML/entities/f.js create mode 100644 js/mathjax/jax/input/MathML/entities/fr.js create mode 100644 js/mathjax/jax/input/MathML/entities/g.js create mode 100644 js/mathjax/jax/input/MathML/entities/h.js create mode 100644 js/mathjax/jax/input/MathML/entities/i.js create mode 100644 js/mathjax/jax/input/MathML/entities/j.js create mode 100644 js/mathjax/jax/input/MathML/entities/k.js create mode 100644 js/mathjax/jax/input/MathML/entities/l.js create mode 100644 js/mathjax/jax/input/MathML/entities/m.js create mode 100644 js/mathjax/jax/input/MathML/entities/n.js create mode 100644 js/mathjax/jax/input/MathML/entities/o.js create mode 100644 js/mathjax/jax/input/MathML/entities/opf.js create mode 100644 js/mathjax/jax/input/MathML/entities/p.js create mode 100644 js/mathjax/jax/input/MathML/entities/q.js create mode 100644 js/mathjax/jax/input/MathML/entities/r.js create mode 100644 js/mathjax/jax/input/MathML/entities/s.js create mode 100644 js/mathjax/jax/input/MathML/entities/scr.js create mode 100644 js/mathjax/jax/input/MathML/entities/t.js create mode 100644 js/mathjax/jax/input/MathML/entities/u.js create mode 100644 js/mathjax/jax/input/MathML/entities/v.js create mode 100644 js/mathjax/jax/input/MathML/entities/w.js create mode 100644 js/mathjax/jax/input/MathML/entities/x.js create mode 100644 js/mathjax/jax/input/MathML/entities/y.js create mode 100644 js/mathjax/jax/input/MathML/entities/z.js create mode 100644 js/mathjax/jax/input/MathML/jax.js create mode 100644 js/mathjax/jax/input/TeX/config.js create mode 100644 js/mathjax/jax/input/TeX/jax.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/maction.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/menclose.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/mglyph.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/ms.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/mtable.js create mode 100644 js/mathjax/jax/output/CommonHTML/autoload/multiline.js create mode 100644 js/mathjax/jax/output/CommonHTML/config.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js create mode 100644 js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js create mode 100644 js/mathjax/jax/output/CommonHTML/jax.js create mode 100644 js/mathjax/jax/output/NativeMML/config.js create mode 100644 js/mathjax/jax/output/NativeMML/jax.js create mode 100644 js/mathjax/jax/output/PlainSource/config.js create mode 100644 js/mathjax/jax/output/PlainSource/jax.js create mode 100644 js/mathjax/jax/output/PreviewHTML/config.js create mode 100644 js/mathjax/jax/output/PreviewHTML/jax.js create mode 100644 js/mathjax/local/local.js create mode 100755 mathjax-librejs.sh create mode 100644 pages/index.org create mode 100644 pages/links.org create mode 100644 pages/notations.org create mode 100644 rss.py diff --git a/Makefile b/Makefile index 981c785..4f025ab 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ all: publish publish: publish.el @echo "Publishing... with current Emacs configurations." emacs --batch --load publish.el --funcall org-publish-all + python rss.py publish_no_init: publish.el @echo "Publishing... with --no-init." diff --git a/css/page.css b/css/page.css new file mode 100644 index 0000000..ed5323a --- /dev/null +++ b/css/page.css @@ -0,0 +1,7 @@ +h1.title { + display: none; +} + +div#content { + margin-top: 2em; +} diff --git a/html-templates/postamble.html b/html-templates/postamble.html new file mode 100644 index 0000000..7942761 --- /dev/null +++ b/html-templates/postamble.html @@ -0,0 +1,8 @@ + diff --git a/html-templates/preamble.html b/html-templates/preamble.html new file mode 100644 index 0000000..9da0cf0 --- /dev/null +++ b/html-templates/preamble.html @@ -0,0 +1,14 @@ +
+ + +
+
+
Please join me to support the FSF for a free society.
+ +
diff --git a/js/MathJax.js b/js/MathJax.js new file mode 100644 index 0000000..80a65a6 --- /dev/null +++ b/js/MathJax.js @@ -0,0 +1,26 @@ +/* + * /MathJax.js + * + * @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright (c) 2009-2016 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @licend The above is the entire license notice + * for the JavaScript code in this page. + */ + +if(document.getElementById&&document.childNodes&&document.createElement){if(!(window.MathJax&&MathJax.Hub)){if(window.MathJax){window.MathJax={AuthorConfig:window.MathJax}}else{window.MathJax={}}MathJax.isPacked=true;MathJax.version="2.7.0";MathJax.fileversion="2.7.0";MathJax.cdnVersion="2.7.0";MathJax.cdnFileVersions={};(function(d){var b=window[d];if(!b){b=window[d]={}}var e=[];var c=function(f){var g=f.constructor;if(!g){g=function(){}}for(var h in f){if(h!=="constructor"&&f.hasOwnProperty(h)){g[h]=f[h]}}return g};var a=function(){return function(){return arguments.callee.Init.call(this,arguments)}};b.Object=c({constructor:a(),Subclass:function(f,h){var g=a();g.SUPER=this;g.Init=this.Init;g.Subclass=this.Subclass;g.Augment=this.Augment;g.protoFunction=this.protoFunction;g.can=this.can;g.has=this.has;g.isa=this.isa;g.prototype=new this(e);g.prototype.constructor=g;g.Augment(f,h);return g},Init:function(f){var g=this;if(f.length===1&&f[0]===e){return g}if(!(g instanceof f.callee)){g=new f.callee(e)}return g.Init.apply(g,f)||g},Augment:function(f,g){var h;if(f!=null){for(h in f){if(f.hasOwnProperty(h)){this.protoFunction(h,f[h])}}if(f.toString!==this.prototype.toString&&f.toString!=={}.toString){this.protoFunction("toString",f.toString)}}if(g!=null){for(h in g){if(g.hasOwnProperty(h)){this[h]=g[h]}}}return this},protoFunction:function(g,f){this.prototype[g]=f;if(typeof f==="function"){f.SUPER=this.SUPER.prototype}},prototype:{Init:function(){},SUPER:function(f){return f.callee.SUPER},can:function(f){return typeof(this[f])==="function"},has:function(f){return typeof(this[f])!=="undefined"},isa:function(f){return(f instanceof Object)&&(this instanceof f)}},can:function(f){return this.prototype.can.call(this,f)},has:function(f){return this.prototype.has.call(this,f)},isa:function(g){var f=this;while(f){if(f===g){return true}else{f=f.SUPER}}return false},SimpleSUPER:c({constructor:function(f){return this.SimpleSUPER.define(f)},define:function(f){var h={};if(f!=null){for(var g in f){if(f.hasOwnProperty(g)){h[g]=this.wrap(g,f[g])}}if(f.toString!==this.prototype.toString&&f.toString!=={}.toString){h.toString=this.wrap("toString",f.toString)}}return h},wrap:function(i,h){if(typeof(h)!=="function"||!h.toString().match(/\.\s*SUPER\s*\(/)){return h}var g=function(){this.SUPER=g.SUPER[i];try{var f=h.apply(this,arguments)}catch(j){delete this.SUPER;throw j}delete this.SUPER;return f};g.toString=function(){return h.toString.apply(h,arguments)};return g}})});b.Object.isArray=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"};b.Object.Array=Array})("MathJax");(function(BASENAME){var BASE=window[BASENAME];if(!BASE){BASE=window[BASENAME]={}}var isArray=BASE.Object.isArray;var CALLBACK=function(data){var cb=function(){return arguments.callee.execute.apply(arguments.callee,arguments)};for(var id in CALLBACK.prototype){if(CALLBACK.prototype.hasOwnProperty(id)){if(typeof(data[id])!=="undefined"){cb[id]=data[id]}else{cb[id]=CALLBACK.prototype[id]}}}cb.toString=CALLBACK.prototype.toString;return cb};CALLBACK.prototype={isCallback:true,hook:function(){},data:[],object:window,execute:function(){if(!this.called||this.autoReset){this.called=!this.autoReset;return this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0)))}},reset:function(){delete this.called},toString:function(){return this.hook.toString.apply(this.hook,arguments)}};var ISCALLBACK=function(f){return(typeof(f)==="function"&&f.isCallback)};var EVAL=function(code){return eval.call(window,code)};var TESTEVAL=function(){EVAL("var __TeSt_VaR__ = 1");if(window.__TeSt_VaR__){try{delete window.__TeSt_VaR__}catch(error){window.__TeSt_VaR__=null}}else{if(window.execScript){EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";window.execScript(code);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}else{EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";var head=(document.getElementsByTagName("head"))[0];if(!head){head=document.body}var script=document.createElement("script");script.appendChild(document.createTextNode(code));head.appendChild(script);head.removeChild(script);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}}TESTEVAL=null};var USING=function(args,i){if(arguments.length>1){if(arguments.length===2&&!(typeof arguments[0]==="function")&&arguments[0] instanceof Object&&typeof arguments[1]==="number"){args=[].slice.call(args,i)}else{args=[].slice.call(arguments,0)}}if(isArray(args)&&args.length===1){args=args[0]}if(typeof args==="function"){if(args.execute===CALLBACK.prototype.execute){return args}return CALLBACK({hook:args})}else{if(isArray(args)){if(typeof(args[0])==="string"&&args[1] instanceof Object&&typeof args[1][args[0]]==="function"){return CALLBACK({hook:args[1][args[0]],object:args[1],data:args.slice(2)})}else{if(typeof args[0]==="function"){return CALLBACK({hook:args[0],data:args.slice(1)})}else{if(typeof args[1]==="function"){return CALLBACK({hook:args[1],object:args[0],data:args.slice(2)})}}}}else{if(typeof(args)==="string"){if(TESTEVAL){TESTEVAL()}return CALLBACK({hook:EVAL,data:[args]})}else{if(args instanceof Object){return CALLBACK(args)}else{if(typeof(args)==="undefined"){return CALLBACK({})}}}}}throw Error("Can't make callback from given data")};var DELAY=function(time,callback){callback=USING(callback);callback.timeout=setTimeout(callback,time);return callback};var WAITFOR=function(callback,signal){callback=USING(callback);if(!callback.called){WAITSIGNAL(callback,signal);signal.pending++}};var WAITEXECUTE=function(){var signals=this.signal;delete this.signal;this.execute=this.oldExecute;delete this.oldExecute;var result=this.execute.apply(this,arguments);if(ISCALLBACK(result)&&!result.called){WAITSIGNAL(result,signals)}else{for(var i=0,m=signals.length;i0&&priority=0;i--){this.hooks.splice(i,1)}this.remove=[]}});var EXECUTEHOOKS=function(hooks,data,reset){if(!hooks){return null}if(!isArray(hooks)){hooks=[hooks]}if(!isArray(data)){data=(data==null?[]:[data])}var handler=HOOKS(reset);for(var i=0,m=hooks.length;ig){g=document.styleSheets.length}if(!i){i=document.head||((document.getElementsByTagName("head"))[0]);if(!i){i=document.body}}return i};var f=[];var c=function(){for(var k=0,j=f.length;k=this.timeout){i(this.STATUS.ERROR);return 1}return 0},file:function(j,i){if(i<0){a.Ajax.loadTimeout(j)}else{a.Ajax.loadComplete(j)}},execute:function(){this.hook.call(this.object,this,this.data[0],this.data[1])},checkSafari2:function(i,j,k){if(i.time(k)){return}if(document.styleSheets.length>j&&document.styleSheets[j].cssRules&&document.styleSheets[j].cssRules.length){k(i.STATUS.OK)}else{setTimeout(i,i.delay)}},checkLength:function(i,l,n){if(i.time(n)){return}var m=0;var j=(l.sheet||l.styleSheet);try{if((j.cssRules||j.rules||[]).length>0){m=1}}catch(k){if(k.message.match(/protected variable|restricted URI/)){m=1}else{if(k.message.match(/Security error/)){m=1}}}if(m){setTimeout(a.Callback([n,i.STATUS.OK]),0)}else{setTimeout(i,i.delay)}}},loadComplete:function(i){i=this.fileURL(i);var j=this.loading[i];if(j&&!j.preloaded){a.Message.Clear(j.message);clearTimeout(j.timeout);if(j.script){if(f.length===0){setTimeout(c,0)}f.push(j.script)}this.loaded[i]=j.status;delete this.loading[i];this.addHook(i,j.callback)}else{if(j){delete this.loading[i]}this.loaded[i]=this.STATUS.OK;j={status:this.STATUS.OK}}if(!this.loadHooks[i]){return null}return this.loadHooks[i].Execute(j.status)},loadTimeout:function(i){if(this.loading[i].timeout){clearTimeout(this.loading[i].timeout)}this.loading[i].status=this.STATUS.ERROR;this.loadError(i);this.loadComplete(i)},loadError:function(i){a.Message.Set(["LoadFailed","File failed to load: %1",i],null,2000);a.Hub.signal.Post(["file load error",i])},Styles:function(k,l){var i=this.StyleString(k);if(i===""){l=a.Callback(l);l()}else{var j=document.createElement("style");j.type="text/css";this.head=h(this.head);this.head.appendChild(j);if(j.styleSheet&&typeof(j.styleSheet.cssText)!=="undefined"){j.styleSheet.cssText=i}else{j.appendChild(document.createTextNode(i))}l=this.timer.create.call(this,l,j)}return l},StyleString:function(n){if(typeof(n)==="string"){return n}var k="",o,m;for(o in n){if(n.hasOwnProperty(o)){if(typeof n[o]==="string"){k+=o+" {"+n[o]+"}\n"}else{if(a.Object.isArray(n[o])){for(var l=0;l="0"&&q<="9"){f[j]=p[f[j]-1];if(typeof f[j]==="number"){f[j]=this.number(f[j])}}else{if(q==="{"){q=f[j].substr(1);if(q>="0"&&q<="9"){f[j]=p[f[j].substr(1,f[j].length-2)-1];if(typeof f[j]==="number"){f[j]=this.number(f[j])}}else{var k=f[j].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);if(k){if(k[1]==="plural"){var d=p[k[2]-1];if(typeof d==="undefined"){f[j]="???"}else{d=this.plural(d)-1;var h=k[3].replace(/(^|[^%])(%%)*%\|/g,"$1$2%\uEFEF").split(/\|/);if(d>=0&&d=3){c.push([f[0],f[1],this.processSnippet(g,f[2])])}else{c.push(e[d])}}}}else{c.push(e[d])}}return c},markdownPattern:/(%.)|(\*{1,3})((?:%.|.)+?)\2|(`+)((?:%.|.)+?)\4|\[((?:%.|.)+?)\]\(([^\s\)]+)\)/,processMarkdown:function(b,h,d){var j=[],e;var c=b.split(this.markdownPattern);var g=c[0];for(var f=1,a=c.length;f1?d[1]:""));f=null}if(e&&(!b.preJax||d)){c.nodeValue=c.nodeValue.replace(b.postJax,(e.length>1?e[1]:""))}if(f&&!f.nodeValue.match(/\S/)){f=f.previousSibling}}if(b.preRemoveClass&&f&&f.className===b.preRemoveClass){a.MathJax.preview=f}a.MathJax.checked=1},processInput:function(a){var b,i=MathJax.ElementJax.STATE;var h,e,d=a.scripts.length;try{while(a.ithis.processUpdateTime&&a.i1){d.jax[a.outputJax].push(b)}b.MathJax.state=c.OUTPUT},prepareOutput:function(c,f){while(c.jthis.processUpdateTime&&h.i=0;q--){if((b[q].src||"").match(f)){s.script=b[q].innerHTML;if(RegExp.$2){var t=RegExp.$2.substr(1).split(/\&/);for(var p=0,l=t.length;p=parseInt(y[z])}}return true},Select:function(j){var i=j[d.Browser];if(i){return i(d.Browser)}return null}};var e=k.replace(/^Mozilla\/(\d+\.)+\d+ /,"").replace(/[a-z][-a-z0-9._: ]+\/\d+[^ ]*-[^ ]*\.([a-z][a-z])?\d+ /i,"").replace(/Gentoo |Ubuntu\/(\d+\.)*\d+ (\([^)]*\) )?/,"");d.Browser=d.Insert(d.Insert(new String("Unknown"),{version:"0.0"}),a);for(var v in a){if(a.hasOwnProperty(v)){if(a[v]&&v.substr(0,2)==="is"){v=v.slice(2);if(v==="Mac"||v==="PC"){continue}d.Browser=d.Insert(new String(v),a);var r=new RegExp(".*(Version/| Trident/.*; rv:)((?:\\d+\\.)+\\d+)|.*("+v+")"+(v=="MSIE"?" ":"/")+"((?:\\d+\\.)*\\d+)|(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)");var u=r.exec(e)||["","","","unknown","0.0"];d.Browser.name=(u[1]!=""?v:(u[3]||u[5]));d.Browser.version=u[2]||u[4]||u[6];break}}}try{d.Browser.Select({Safari:function(j){var i=parseInt((String(j.version).split("."))[0]);if(i>85){j.webkit=j.version}if(i>=538){j.version="8.0"}else{if(i>=537){j.version="7.0"}else{if(i>=536){j.version="6.0"}else{if(i>=534){j.version="5.1"}else{if(i>=533){j.version="5.0"}else{if(i>=526){j.version="4.0"}else{if(i>=525){j.version="3.1"}else{if(i>500){j.version="3.0"}else{if(i>400){j.version="2.0"}else{if(i>85){j.version="1.0"}}}}}}}}}}j.webkit=(navigator.appVersion.match(/WebKit\/(\d+)\./))[1];j.isMobile=(navigator.appVersion.match(/Mobile/i)!=null);j.noContextMenu=j.isMobile},Firefox:function(j){if((j.version==="0.0"||k.match(/Firefox/)==null)&&navigator.product==="Gecko"){var m=k.match(/[\/ ]rv:(\d+\.\d.*?)[\) ]/);if(m){j.version=m[1]}else{var i=(navigator.buildID||navigator.productSub||"0").substr(0,8);if(i>="20111220"){j.version="9.0"}else{if(i>="20111120"){j.version="8.0"}else{if(i>="20110927"){j.version="7.0"}else{if(i>="20110816"){j.version="6.0"}else{if(i>="20110621"){j.version="5.0"}else{if(i>="20110320"){j.version="4.0"}else{if(i>="20100121"){j.version="3.6"}else{if(i>="20090630"){j.version="3.5"}else{if(i>="20080617"){j.version="3.0"}else{if(i>="20061024"){j.version="2.0"}}}}}}}}}}}}j.isMobile=(navigator.appVersion.match(/Android/i)!=null||k.match(/ Fennec\//)!=null||k.match(/Mobile/)!=null)},Chrome:function(i){i.noContextMenu=i.isMobile=!!navigator.userAgent.match(/ Mobile[ \/]/)},Opera:function(i){i.version=opera.version()},Edge:function(i){i.isMobile=!!navigator.userAgent.match(/ Phone/)},MSIE:function(j){j.isMobile=!!navigator.userAgent.match(/ Phone/);j.isIE9=!!(document.documentMode&&(window.performance||window.msPerformance));MathJax.HTML.setScriptBug=!j.isIE9||document.documentMode<9;MathJax.Hub.msieHTMLCollectionBug=(document.documentMode<9);if(document.documentMode<10&&!s.params.NoMathPlayer){try{new ActiveXObject("MathPlayer.Factory.1");j.hasMathPlayer=true}catch(m){}try{if(j.hasMathPlayer){var i=document.createElement("object");i.id="mathplayer";i.classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987";g.appendChild(i);document.namespaces.add("m","http://www.w3.org/1998/Math/MathML");j.mpNamespace=true;if(document.readyState&&(document.readyState==="loading"||document.readyState==="interactive")){document.write('');j.mpImported=true}}else{document.namespaces.add("mjx_IE_fix","http://www.w3.org/1999/xlink")}}catch(m){}}}})}catch(c){console.error(c.message)}d.Browser.Select(MathJax.Message.browsers);if(h.AuthorConfig&&typeof h.AuthorConfig.AuthorInit==="function"){h.AuthorConfig.AuthorInit()}d.queue=h.Callback.Queue();d.queue.Push(["Post",s.signal,"Begin"],["Config",s],["Cookie",s],["Styles",s],["Message",s],function(){var i=h.Callback.Queue(s.Jax(),s.Extensions());return i.Push({})},["Menu",s],s.onLoad(),function(){MathJax.isReady=true},["Typeset",s],["Hash",s],["MenuZoom",s],["Post",s.signal,"End"])})("MathJax")}}; +// @license-end diff --git a/js/analytics.js b/js/analytics.js new file mode 100644 index 0000000..58f1074 --- /dev/null +++ b/js/analytics.js @@ -0,0 +1,13 @@ + + var _paq = _paq || []; + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="//analytics.ypei.me/"; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', '1']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + })(); + diff --git a/js/mathjax/MathJax.js b/js/mathjax/MathJax.js new file mode 100644 index 0000000..ac58542 --- /dev/null +++ b/js/mathjax/MathJax.js @@ -0,0 +1,3328 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax.js + * + * The main support code for the MathJax Hub, including the + * Ajax, Callback, Messaging, and Object-Oriented Programming + * libraries, as well as the base Jax classes, and startup + * processing code. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// +// Check if browser can support MathJax (no one fails this nowadays) +// +if (document.getElementById && document.childNodes && document.createElement) { +// +// Skip if MathJax is already loaded +// +if (!(window.MathJax && MathJax.Hub)) { + +// +// Get author configuration from MathJax variable, if any +// +if (window.MathJax) {window.MathJax = {AuthorConfig: window.MathJax}} + else {window.MathJax = {}} + +// MathJax.isPacked = true; // This line is uncommented by the packer. + +MathJax.version = "2.7.9"; +MathJax.fileversion = "2.7.9"; +MathJax.cdnVersion = "2.7.9"; // specifies a revision to break caching +MathJax.cdnFileVersions = {}; // can be used to specify revisions for individual files + +/**********************************************************/ + +(function (BASENAME) { + var BASE = window[BASENAME]; + if (!BASE) {BASE = window[BASENAME] = {}} + + var PROTO = []; // a static object used to indicate when a prototype is being created + var OBJECT = function (def) { + var obj = def.constructor; if (!obj) {obj = function () {}} + for (var id in def) {if (id !== 'constructor' && def.hasOwnProperty(id)) {obj[id] = def[id]}} + return obj; + }; + var CONSTRUCTOR = function () { + return function () {return arguments.callee.Init.call(this,arguments)}; + }; + + BASE.Object = OBJECT({ + constructor: CONSTRUCTOR(), + + Subclass: function (def,classdef) { + var obj = CONSTRUCTOR(); + obj.SUPER = this; obj.Init = this.Init; + obj.Subclass = this.Subclass; obj.Augment = this.Augment; + obj.protoFunction = this.protoFunction; + obj.can = this.can; obj.has = this.has; obj.isa = this.isa; + obj.prototype = new this(PROTO); + obj.prototype.constructor = obj; // the real constructor + obj.Augment(def,classdef); + return obj; + }, + + Init: function (args) { + var obj = this; + if (args.length === 1 && args[0] === PROTO) {return obj} + if (!(obj instanceof args.callee)) {obj = new args.callee(PROTO)} + return obj.Init.apply(obj,args) || obj; + }, + + Augment: function (def,classdef) { + var id; + if (def != null) { + for (id in def) {if (def.hasOwnProperty(id)) {this.protoFunction(id,def[id])}} + // MSIE doesn't list toString even if it is not native so handle it separately + if (def.toString !== this.prototype.toString && def.toString !== {}.toString) + {this.protoFunction('toString',def.toString)} + } + if (classdef != null) { + for (id in classdef) {if (classdef.hasOwnProperty(id)) {this[id] = classdef[id]}} + } + return this; + }, + + protoFunction: function (id,def) { + this.prototype[id] = def; + if (typeof def === "function") {def.SUPER = this.SUPER.prototype} + }, + + prototype: { + Init: function () {}, + SUPER: function (fn) {return fn.callee.SUPER}, + can: function (method) {return typeof(this[method]) === "function"}, + has: function (property) {return typeof(this[property]) !== "undefined"}, + isa: function (obj) {return (obj instanceof Object) && (this instanceof obj)} + }, + + can: function (method) {return this.prototype.can.call(this,method)}, + has: function (property) {return this.prototype.has.call(this,property)}, + isa: function (obj) { + var constructor = this; + while (constructor) { + if (constructor === obj) {return true} else {constructor = constructor.SUPER} + } + return false; + }, + + + SimpleSUPER: OBJECT({ + constructor: function (def) {return this.SimpleSUPER.define(def)}, + + define: function (src) { + var dst = {}; + if (src != null) { + for (var id in src) {if (src.hasOwnProperty(id)) {dst[id] = this.wrap(id,src[id])}} + // MSIE doesn't list toString even if it is not native so handle it separately + if (src.toString !== this.prototype.toString && src.toString !== {}.toString) + {dst.toString = this.wrap('toString',src.toString)} + } + return dst; + }, + + wrap: function (id,f) { + if (typeof(f) !== 'function' || !f.toString().match(/\.\s*SUPER\s*\(/)) {return f} + var fn = function () { + this.SUPER = fn.SUPER[id]; + try {var result = f.apply(this,arguments)} catch (err) {delete this.SUPER; throw err} + delete this.SUPER; + return result; + } + fn.toString = function () {return f.toString.apply(f,arguments)} + return fn; + } + + }) + }); + + BASE.Object.isArray = Array.isArray || function (obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + + BASE.Object.Array = Array; + +})("MathJax"); + +/**********************************************************/ + +/* + * Create a callback function from various forms of data: + * + * MathJax.Callback(fn) -- callback to a function + * + * MathJax.Callback([fn]) -- callback to function + * MathJax.Callback([fn,data...]) + * -- callback to function with given data as arguments + * MathJax.Callback([object,fn]) + * -- call fn with object as "this" + * MathJax.Callback([object,fn,data...]) + * -- call fn with object as "this" and data as arguments + * MathJax.Callback(["method",object]) + * -- call method of object wth object as "this" + * MathJax.Callback(["method",object,data...]) + * -- as above, but with data as arguments to method + * + * MathJax.Callback({hook: fn, data: [...], object: this}) + * -- give function, data, and object to act as "this" explicitly + * + * MathJax.Callback("code") -- callback that compiles and executes a string + * + * MathJax.Callback([...],i) + * -- use slice of array starting at i and interpret + * result as above. (Used for passing "arguments" array + * and trimming initial arguments, if any.) + */ + +/* + * MathJax.Callback.After([...],cb1,cb2,...) + * -- make a callback that isn't called until all the other + * ones are called first. I.e., wait for a union of + * callbacks to occur before making the given callback. + */ + +/* + * MathJax.Callback.Queue([callback,...]) + * -- make a synchronized queue of commands that process + * sequentially, waiting for those that return uncalled + * callbacks. + */ + +/* + * MathJax.Callback.Signal(name) + * -- finds or creates a names signal, to which listeners + * can be attached and are signaled by messages posted + * to the signal. Responses can be asynchronous. + */ + +(function (BASENAME) { + var BASE = window[BASENAME]; + if (!BASE) {BASE = window[BASENAME] = {}} + var isArray = BASE.Object.isArray; + // + // Create a callback from an associative array + // + var CALLBACK = function (data) { + var cb = function () {return arguments.callee.execute.apply(arguments.callee,arguments)}; + for (var id in CALLBACK.prototype) { + if (CALLBACK.prototype.hasOwnProperty(id)) { + if (typeof(data[id]) !== 'undefined') {cb[id] = data[id]} + else {cb[id] = CALLBACK.prototype[id]} + } + } + cb.toString = CALLBACK.prototype.toString; + return cb; + }; + CALLBACK.prototype = { + isCallback: true, + hook: function () {}, + data: [], + object: window, + execute: function () { + if (!this.called || this.autoReset) { + this.called = !this.autoReset; + return this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0))); + } + }, + reset: function () {delete this.called}, + toString: function () {return this.hook.toString.apply(this.hook,arguments)} + }; + var ISCALLBACK = function (f) { + return (typeof(f) === "function" && f.isCallback); + } + + // + // Evaluate a string in global context + // + var EVAL = function (code) {return eval.call(window,code)} + var TESTEVAL = function () { + EVAL("var __TeSt_VaR__ = 1"); // check if it works in global context + if (window.__TeSt_VaR__) { + try { delete window.__TeSt_VaR__; } // NOTE IE9 throws when in IE7 mode + catch (error) { window.__TeSt_VaR__ = null; } + } else { + if (window.execScript) { + // IE + EVAL = function (code) { + BASE.__code = code; + code = "try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}"; + window.execScript(code); + var result = BASE.__result; delete BASE.__result; delete BASE.__code; + if (result instanceof Error) {throw result} + return result; + } + } else { + // Safari2 + EVAL = function (code) { + BASE.__code = code; + code = "try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}"; + var head = (document.getElementsByTagName("head"))[0]; if (!head) {head = document.body} + var script = document.createElement("script"); + script.appendChild(document.createTextNode(code)); + head.appendChild(script); head.removeChild(script); + var result = BASE.__result; delete BASE.__result; delete BASE.__code; + if (result instanceof Error) {throw result} + return result; + } + } + } + TESTEVAL = null; + }; + + // + // Create a callback from various types of data + // + var USING = function (args,i) { + if (arguments.length > 1) { + if (arguments.length === 2 && !(typeof arguments[0] === 'function') && + arguments[0] instanceof Object && typeof arguments[1] === 'number') + {args = [].slice.call(args,i)} + else {args = [].slice.call(arguments,0)} + } + if (isArray(args) && args.length === 1 && typeof(args[0]) === 'function') {args = args[0]} + if (typeof args === 'function') { + if (args.execute === CALLBACK.prototype.execute) {return args} + return CALLBACK({hook: args}); + } else if (isArray(args)) { + if (typeof(args[0]) === 'string' && args[1] instanceof Object && + typeof args[1][args[0]] === 'function') { + return CALLBACK({hook: args[1][args[0]], object: args[1], data: args.slice(2)}); + } else if (typeof args[0] === 'function') { + return CALLBACK({hook: args[0], data: args.slice(1)}); + } else if (typeof args[1] === 'function') { + return CALLBACK({hook: args[1], object: args[0], data: args.slice(2)}); + } + } else if (typeof(args) === 'string') { + if (TESTEVAL) TESTEVAL(); + return CALLBACK({hook: EVAL, data: [args]}); + } else if (args instanceof Object) { + return CALLBACK(args); + } else if (typeof(args) === 'undefined') { + return CALLBACK({}); + } + throw Error("Can't make callback from given data"); + }; + + // + // Wait for a given time to elapse and then perform the callback + // + var DELAY = function (time,callback) { + callback = USING(callback); + callback.timeout = setTimeout(callback,time); + return callback; + }; + + // + // Callback used by AFTER, QUEUE, and SIGNAL to check if calls have completed + // + var WAITFOR = function (callback,signal) { + callback = USING(callback); + if (!callback.called) {WAITSIGNAL(callback,signal); signal.pending++} + }; + var WAITEXECUTE = function () { + var signals = this.signal; delete this.signal; + this.execute = this.oldExecute; delete this.oldExecute; + var result = this.execute.apply(this,arguments); + if (ISCALLBACK(result) && !result.called) {WAITSIGNAL(result,signals)} else { + for (var i = 0, m = signals.length; i < m; i++) { + signals[i].pending--; + if (signals[i].pending <= 0) {signals[i].call()} + } + } + }; + var WAITSIGNAL = function (callback,signals) { + if (!isArray(signals)) {signals = [signals]} + if (!callback.signal) { + callback.oldExecute = callback.execute; + callback.execute = WAITEXECUTE; + callback.signal = signals; + } else if (signals.length === 1) {callback.signal.push(signals[0])} + else {callback.signal = callback.signal.concat(signals)} + }; + + // + // Create a callback that is called when a collection of other callbacks have + // all been executed. If the callback gets called immediately (i.e., the + // others are all already called), check if it returns another callback + // and return that instead. + // + var AFTER = function (callback) { + callback = USING(callback); + callback.pending = 0; + for (var i = 1, m = arguments.length; i < m; i++) + {if (arguments[i]) {WAITFOR(arguments[i],callback)}} + if (callback.pending === 0) { + var result = callback(); + if (ISCALLBACK(result)) {callback = result} + } + return callback; + }; + + // + // An array of prioritized hooks that are executed sequentially + // with a given set of data. + // + var HOOKS = MathJax.Object.Subclass({ + // + // Initialize the array and the auto-reset status + // + Init: function (reset) { + this.hooks = []; + this.remove = []; // used when hooks are removed during execution of list + this.reset = reset; + this.running = false; + }, + // + // Add a callback to the list, in priority order (default priority is 10) + // + Add: function (hook,priority) { + if (priority == null) {priority = 10} + if (!ISCALLBACK(hook)) {hook = USING(hook)} + hook.priority = priority; + var i = this.hooks.length; + while (i > 0 && priority < this.hooks[i-1].priority) {i--} + this.hooks.splice(i,0,hook); + return hook; + }, + Remove: function (hook) { + for (var i = 0, m = this.hooks.length; i < m; i++) { + if (this.hooks[i] === hook) { + if (this.running) {this.remove.push(i)} + else {this.hooks.splice(i,1)} + return; + } + } + }, + // + // Execute the list of callbacks, resetting them if requested. + // If any return callbacks, return a callback that will be + // executed when they all have completed. + // Remove any hooks that requested being removed during processing. + // + Execute: function () { + var callbacks = [{}]; + this.running = true; + for (var i = 0, m = this.hooks.length; i < m; i++) { + if (this.reset) {this.hooks[i].reset()} + var result = this.hooks[i].apply(window,arguments); + if (ISCALLBACK(result) && !result.called) {callbacks.push(result)} + } + this.running = false; + if (this.remove.length) {this.RemovePending()} + if (callbacks.length === 1) {return null} + if (callbacks.length === 2) {return callbacks[1]} + return AFTER.apply({},callbacks); + }, + // + // Remove hooks that asked to be removed during execution of list + // + RemovePending: function () { + this.remove = this.remove.sort(); + for (var i = this.remove.length-1; i >= 0; i--) {this.hooks.splice(i,1)} + this.remove = []; + } + + }); + + // + // Run an array of callbacks passing them the given data. + // (Legacy function, since this has been replaced by the HOOKS object). + // + var EXECUTEHOOKS = function (hooks,data,reset) { + if (!hooks) {return null} + if (!isArray(hooks)) {hooks = [hooks]} + if (!isArray(data)) {data = (data == null ? [] : [data])} + var handler = HOOKS(reset); + for (var i = 0, m = hooks.length; i < m; i++) {handler.Add(hooks[i])} + return handler.Execute.apply(handler,data); + }; + + // + // Command queue that performs commands in order, waiting when + // necessary for commands to complete asynchronousely + // + var QUEUE = BASE.Object.Subclass({ + // + // Create the queue and push any commands that are specified + // + Init: function () { + this.pending = this.running = 0; + this.queue = []; + this.Push.apply(this,arguments); + }, + // + // Add commands to the queue and run them. Adding a callback object + // (rather than a callback specification) queues a wait for that callback. + // Return the final callback for synchronization purposes. + // + Push: function () { + var callback; + for (var i = 0, m = arguments.length; i < m; i++) { + callback = USING(arguments[i]); + if (callback === arguments[i] && !callback.called) + {callback = USING(["wait",this,callback])} + this.queue.push(callback); + } + if (!this.running && !this.pending) {this.Process()} + return callback; + }, + // + // Process the command queue if we aren't waiting on another command + // + Process: function (queue) { + while (!this.running && !this.pending && this.queue.length) { + var callback = this.queue[0]; + queue = this.queue.slice(1); this.queue = []; + this.Suspend(); var result = callback(); this.Resume(); + if (queue.length) {this.queue = queue.concat(this.queue)} + if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)} + } + }, + // + // Suspend/Resume command processing on this queue + // + Suspend: function () {this.running++}, + Resume: function () {if (this.running) {this.running--}}, + // + // Used by WAITFOR to restart the queue when an action completes + // + call: function () {this.Process.apply(this,arguments)}, + wait: function (callback) {return callback} + }); + + // + // Create a named signal that listeners can attach to, to be signaled by + // postings made to the signal. Posts are queued if they occur while one + // is already in process. + // + var SIGNAL = QUEUE.Subclass({ + Init: function (name) { + QUEUE.prototype.Init.call(this); + this.name = name; + this.posted = []; // the messages posted so far + this.listeners = HOOKS(true); // those with interest in this signal + this.posting = false; + this.callback = null; + }, + // + // Post a message to the signal listeners, with callback for when complete + // + Post: function (message,callback,forget) { + callback = USING(callback); + if (this.posting || this.pending) { + this.Push(["Post",this,message,callback,forget]); + } else { + this.callback = callback; callback.reset(); + if (!forget) {this.posted.push(message)} + this.Suspend(); this.posting = true; + var result = this.listeners.Execute(message); + if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)} + this.Resume(); this.posting = false; + if (!this.pending) {this.call()} + } + return callback; + }, + // + // Clear the post history (so new listeners won't get old messages) + // + Clear: function (callback) { + callback = USING(callback); + if (this.posting || this.pending) { + callback = this.Push(["Clear",this,callback]); + } else { + this.posted = []; + callback(); + } + return callback; + }, + // + // Call the callback (all replies are in) and process the command queue + // + call: function () {this.callback(this); this.Process()}, + + // + // A listener calls this to register interest in the signal (so it will be called + // when posts occur). If ignorePast is true, it will not be sent the post history. + // + Interest: function (callback,ignorePast,priority) { + callback = USING(callback); + this.listeners.Add(callback,priority); + if (!ignorePast) { + for (var i = 0, m = this.posted.length; i < m; i++) { + callback.reset(); + var result = callback(this.posted[i]); + if (ISCALLBACK(result) && i === this.posted.length-1) {WAITFOR(result,this)} + } + } + return callback; + }, + // + // A listener calls this to remove itself from a signal + // + NoInterest: function (callback) { + this.listeners.Remove(callback); + }, + + // + // Hook a callback to a particular message on this signal + // + MessageHook: function (msg,callback,priority) { + callback = USING(callback); + if (!this.hooks) {this.hooks = {}; this.Interest(["ExecuteHooks",this])} + if (!this.hooks[msg]) {this.hooks[msg] = HOOKS(true)} + this.hooks[msg].Add(callback,priority); + for (var i = 0, m = this.posted.length; i < m; i++) + {if (this.posted[i] == msg) {callback.reset(); callback(this.posted[i])}} + callback.msg = msg; // keep track so we can remove it + return callback; + }, + // + // Execute the message hooks for the given message + // + ExecuteHooks: function (msg) { + var type = (isArray(msg) ? msg[0] : msg); + if (!this.hooks[type]) {return null} + return this.hooks[type].Execute(msg); + }, + // + // Remove a hook safely + // + RemoveHook: function (hook) { + this.hooks[hook.msg].Remove(hook); + } + + },{ + signals: {}, // the named signals + find: function (name) { + if (!SIGNAL.signals[name]) {SIGNAL.signals[name] = new SIGNAL(name)} + return SIGNAL.signals[name]; + } + }); + + // + // The main entry-points + // + BASE.Callback = BASE.CallBack = USING; + BASE.Callback.Delay = DELAY; + BASE.Callback.After = AFTER; + BASE.Callback.Queue = QUEUE; + BASE.Callback.Signal = SIGNAL.find; + BASE.Callback.Hooks = HOOKS; + BASE.Callback.ExecuteHooks = EXECUTEHOOKS; +})("MathJax"); + + +/**********************************************************/ + +(function (BASENAME) { + var BASE = window[BASENAME]; + if (!BASE) {BASE = window[BASENAME] = {}} + + var isSafari2 = (navigator.vendor === "Apple Computer, Inc." && + typeof navigator.vendorSub === "undefined"); + var sheets = 0; // used by Safari2 + + // + // Update sheets count and look up the head object + // + var HEAD = function (head) { + if (document.styleSheets && document.styleSheets.length > sheets) + {sheets = document.styleSheets.length} + if (!head) { + head = document.head || ((document.getElementsByTagName("head"))[0]); + if (!head) {head = document.body} + } + return head; + }; + + // + // Remove scripts that are completed so they don't clutter up the HEAD. + // This runs via setTimeout since IE7 can't remove the script while it is running. + // + var SCRIPTS = []; // stores scripts to be removed after a delay + var REMOVESCRIPTS = function () { + for (var i = 0, m = SCRIPTS.length; i < m; i++) {BASE.Ajax.head.removeChild(SCRIPTS[i])} + SCRIPTS = []; + }; + + var PATH = {}; + PATH[BASENAME] = ""; // empty path gets the root URL + PATH.a11y = '[MathJax]/extensions/a11y'; // a11y extensions + + BASE.Ajax = { + loaded: {}, // files already loaded + loading: {}, // files currently in process of loading + loadHooks: {}, // hooks to call when files are loaded + timeout: 15*1000, // timeout for loading of files (15 seconds) + styleDelay: 1, // delay to use before styles are available + config: { + root: "", // URL of root directory to load from + path: PATH // paths to named URL's (e.g., [MathJax]/...) + }, + params: {}, // filled in from MathJax.js?... + + STATUS: { + OK: 1, // file is loading or did load OK + ERROR: -1 // file timed out during load + }, + + // + // Return a complete URL to a file (replacing any root names) + // + fileURL: function (file) { + var match; + while ((match = file.match(/^\[([-._a-z0-9]+)\]/i)) && PATH.hasOwnProperty(match[1])) { + file = (PATH[match[1]]||this.config.root) + file.substr(match[1].length+2); + } + return file; + }, + // + // Replace root names if URL includes one + // + fileName: function (url) { + var root = this.config.root; + if (url.substr(0,root.length) === root) {url = "["+BASENAME+"]"+url.substr(root.length)} + do { + var recheck = false; + for (var id in PATH) {if (PATH.hasOwnProperty(id) && PATH[id]) { + if (url.substr(0,PATH[id].length) === PATH[id]) { + url = "["+id+"]"+url.substr(PATH[id].length); + recheck = true; + break; + } + }} + } while (recheck); + return url; + }, + // + // Cache-breaking revision number for file + // + fileRev: function (file) { + var V = BASE.cdnFileVersions[file] || BASE.cdnVersion || ''; + if (V) {V = "?V="+V} + return V; + }, + urlRev: function (file) {return this.fileURL(file)+this.fileRev(file)}, + + // + // Load a file if it hasn't been already. + // Make sure the file URL is "safe"? + // + Require: function (file,callback) { + callback = BASE.Callback(callback); var type; + if (file instanceof Object) { + for (var i in file) + {if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}} + } else {type = file.split(/\./).pop().toUpperCase()} + if (this.params.noContrib && file.substr(0,9) === "[Contrib]") { + callback(this.STATUS.ERROR); + } else { + file = this.fileURL(file); + // FIXME: check that URL is OK + if (this.loaded[file]) { + callback(this.loaded[file]); + } else { + var FILE = {}; FILE[type] = file; + this.Load(FILE,callback); + } + } + return callback; + }, + + // + // Load a file regardless of where it is and whether it has + // already been loaded. + // + Load: function (file,callback) { + callback = BASE.Callback(callback); var type; + if (file instanceof Object) { + for (var i in file) + {if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}} + } else {type = file.split(/\./).pop().toUpperCase()} + file = this.fileURL(file); + if (this.loading[file]) { + this.addHook(file,callback); + } else { + this.head = HEAD(this.head); + if (this.loader[type]) {this.loader[type].call(this,file,callback)} + else {throw Error("Can't load files of type "+type)} + } + return callback; + }, + + // + // Register a load hook for a particular file (it will be called when + // loadComplete() is called for that file) + // + LoadHook: function (file,callback,priority) { + callback = BASE.Callback(callback); + if (file instanceof Object) + {for (var i in file) {if (file.hasOwnProperty(i)) {file = file[i]}}} + file = this.fileURL(file); + if (this.loaded[file]) {callback(this.loaded[file])} + else {this.addHook(file,callback,priority)} + return callback; + }, + addHook: function (file,callback,priority) { + if (!this.loadHooks[file]) {this.loadHooks[file] = MathJax.Callback.Hooks()} + this.loadHooks[file].Add(callback,priority); + callback.file = file; + }, + removeHook: function (hook) { + if (this.loadHooks[hook.file]) { + this.loadHooks[hook.file].Remove(hook); + if (!this.loadHooks[hook.file].hooks.length) {delete this.loadHooks[hook.file]} + } + }, + + // + // Used when files are combined in a preloading configuration file + // + Preloading: function () { + for (var i = 0, m = arguments.length; i < m; i++) { + var file = this.fileURL(arguments[i]); + if (!this.loading[file]) {this.loading[file] = {preloaded: true}} + } + }, + + // + // Code used to load the various types of files + // (JS for JavaScript, CSS for style sheets) + // + loader: { + // + // Create a SCRIPT tag to load the file + // + JS: function (file,callback) { + var name = this.fileName(file); + var script = document.createElement("script"); + var timeout = BASE.Callback(["loadTimeout",this,file]); + this.loading[file] = { + callback: callback, + timeout: setTimeout(timeout,this.timeout), + status: this.STATUS.OK, + script: script + }; + // + // Add this to the structure above after it is created to prevent recursion + // when loading the initial localization file (before loading message is available) + // + this.loading[file].message = BASE.Message.File(name); + script.onerror = timeout; // doesn't work in IE and no apparent substitute + script.type = "text/javascript"; + script.src = file+this.fileRev(name); + this.head.appendChild(script); + }, + // + // Create a LINK tag to load the style sheet + // + CSS: function (file,callback) { + var name = this.fileName(file); + var link = document.createElement("link"); + link.rel = "stylesheet"; link.type = "text/css"; + link.href = file+this.fileRev(name); + this.loading[file] = { + callback: callback, + message: BASE.Message.File(name), + status: this.STATUS.OK + }; + this.head.appendChild(link); + this.timer.create.call(this,[this.timer.file,file],link); + } + }, + + // + // Timing code for checking when style sheets are available. + // + timer: { + // + // Create the timing callback and start the timing loop. + // We use a delay because some browsers need it to allow the styles + // to be processed. + // + create: function (callback,node) { + callback = BASE.Callback(callback); + if (node.nodeName === "STYLE" && node.styleSheet && + typeof(node.styleSheet.cssText) !== 'undefined') { + callback(this.STATUS.OK); // MSIE processes style immediately, but doesn't set its styleSheet! + } else if (window.chrome && node.nodeName === "LINK") { + callback(this.STATUS.OK); // Chrome doesn't give access to cssRules for stylesheet in + // a link node, so we can't detect when it is loaded. + } else if (isSafari2) { + this.timer.start(this,[this.timer.checkSafari2,sheets++,callback],this.styleDelay); + } else { + this.timer.start(this,[this.timer.checkLength,node,callback],this.styleDelay); + } + return callback; + }, + // + // Start the timer for the given callback checker + // + start: function (AJAX,check,delay,timeout) { + check = BASE.Callback(check); + check.execute = this.execute; check.time = this.time; + check.STATUS = AJAX.STATUS; check.timeout = timeout || AJAX.timeout; + check.delay = check.total = delay || 0; + if (delay) {setTimeout(check,delay)} else {check()} + }, + // + // Increment the time total, increase the delay + // and test if we are past the timeout time. + // + time: function (callback) { + this.total += this.delay; + this.delay = Math.floor(this.delay * 1.05 + 5); + if (this.total >= this.timeout) {callback(this.STATUS.ERROR); return 1} + return 0; + }, + // + // For JS file loads, call the proper routine according to status + // + file: function (file,status) { + if (status < 0) {BASE.Ajax.loadTimeout(file)} else {BASE.Ajax.loadComplete(file)} + }, + // + // Call the hook with the required data + // + execute: function () {this.hook.call(this.object,this,this.data[0],this.data[1])}, + // + // Safari2 doesn't set the link's stylesheet, so we need to look in the + // document.styleSheets array for the new sheet when it is created + // + checkSafari2: function (check,length,callback) { + if (check.time(callback)) return; + if (document.styleSheets.length > length && + document.styleSheets[length].cssRules && + document.styleSheets[length].cssRules.length) + {callback(check.STATUS.OK)} else {setTimeout(check,check.delay)} + }, + // + // Look for the stylesheets rules and check when they are defined + // and no longer of length zero. (This assumes there actually ARE + // some rules in the stylesheet.) + // + checkLength: function (check,node,callback) { + if (check.time(callback)) return; + var isStyle = 0; var sheet = (node.sheet || node.styleSheet); + try {if ((sheet.cssRules||sheet.rules||[]).length > 0) {isStyle = 1}} catch(err) { + if (err.message.match(/protected variable|restricted URI/)) {isStyle = 1} + else if (err.message.match(/Security error/)) { + // Firefox3 gives "Security error" for missing files, so + // can't distinguish that from OK files on remote servers. + // or OK files in different directory from local files. + isStyle = 1; // just say it is OK (can't really tell) + } + } + if (isStyle) { + // Opera 9.6 requires this setTimeout + setTimeout(BASE.Callback([callback,check.STATUS.OK]),0); + } else { + setTimeout(check,check.delay); + } + } + }, + + // + // JavaScript code must call this when they are completely initialized + // (this allows them to perform asynchronous actions before indicating + // that they are complete). + // + loadComplete: function (file) { + file = this.fileURL(file); + var loading = this.loading[file]; + if (loading && !loading.preloaded) { + BASE.Message.Clear(loading.message); + clearTimeout(loading.timeout); + if (loading.script) { + if (SCRIPTS.length === 0) {setTimeout(REMOVESCRIPTS,0)} + SCRIPTS.push(loading.script); + } + this.loaded[file] = loading.status; delete this.loading[file]; + this.addHook(file,loading.callback); + } else { + if (loading) {delete this.loading[file]} + this.loaded[file] = this.STATUS.OK; + loading = {status: this.STATUS.OK} + } + if (!this.loadHooks[file]) {return null} + return this.loadHooks[file].Execute(loading.status); + }, + + // + // If a file fails to load within the timeout period (or the onerror handler + // is called), this routine runs to signal the error condition. + // + loadTimeout: function (file) { + if (this.loading[file].timeout) {clearTimeout(this.loading[file].timeout)} + this.loading[file].status = this.STATUS.ERROR; + this.loadError(file); + this.loadComplete(file); + }, + + // + // The default error hook for file load failures + // + loadError: function (file) { + BASE.Message.Set(["LoadFailed","File failed to load: %1",file],null,2000); + BASE.Hub.signal.Post(["file load error",file]); + }, + + // + // Defines a style sheet from a hash of style declarations (key:value pairs + // where the key is the style selector and the value is a hash of CSS attributes + // and values). + // + Styles: function (styles,callback) { + var styleString = this.StyleString(styles); + if (styleString === "") { + callback = BASE.Callback(callback); + callback(); + } else { + var style = document.createElement("style"); style.type = "text/css"; + this.head = HEAD(this.head); + this.head.appendChild(style); + if (style.styleSheet && typeof(style.styleSheet.cssText) !== 'undefined') { + style.styleSheet.cssText = styleString; + } else { + style.appendChild(document.createTextNode(styleString)); + } + callback = this.timer.create.call(this,callback,style); + } + return callback; + }, + + // + // Create a stylesheet string from a style declaration object + // + StyleString: function (styles) { + if (typeof(styles) === 'string') {return styles} + var string = "", id, style; + for (id in styles) {if (styles.hasOwnProperty(id)) { + if (typeof styles[id] === 'string') { + string += id + " {"+styles[id]+"}\n"; + } else if (BASE.Object.isArray(styles[id])) { + for (var i = 0; i < styles[id].length; i++) { + style = {}; style[id] = styles[id][i]; + string += this.StyleString(style); + } + } else if (id.substr(0,6) === '@media') { + string += id + " {"+this.StyleString(styles[id])+"}\n"; + } else if (styles[id] != null) { + style = []; + for (var name in styles[id]) {if (styles[id].hasOwnProperty(name)) { + if (styles[id][name] != null) + {style[style.length] = name + ': ' + styles[id][name]} + }} + string += id +" {"+style.join('; ')+"}\n"; + } + }} + return string; + } + }; + +})("MathJax"); + +/**********************************************************/ + +MathJax.HTML = { + // + // Create an HTML element with given attributes and content. + // The def parameter is an (optional) object containing key:value pairs + // of the attributes and their values, and contents is an (optional) + // array of strings to be inserted as text, or arrays of the form + // [type,def,contents] that describes an HTML element to be inserted + // into the current element. Thus the contents can describe a complete + // HTML snippet of arbitrary complexity. E.g.: + // + // MathJax.HTML.Element("span",{id:"mySpan",style{"font-style":"italic"}},[ + // "(See the ",["a",{href:"http://www.mathjax.org"},["MathJax home page"]], + // " for more details.)"]); + // + Element: function (type,def,contents) { + var obj = document.createElement(type), id; + if (def) { + if (def.hasOwnProperty("style")) { + var style = def.style; def.style = {}; + for (id in style) {if (style.hasOwnProperty(id)) + {def.style[id.replace(/-([a-z])/g,this.ucMatch)] = style[id]}} + } + MathJax.Hub.Insert(obj,def); + for (id in def) { + if (id === "role" || id.substr(0,5) === "aria-") obj.setAttribute(id,def[id]); + } + } + if (contents) { + if (!MathJax.Object.isArray(contents)) {contents = [contents]} + for (var i = 0, m = contents.length; i < m; i++) { + if (MathJax.Object.isArray(contents[i])) { + obj.appendChild(this.Element(contents[i][0],contents[i][1],contents[i][2])); + } else if (type === "script") { // IE throws an error if script is added as a text node + this.setScript(obj, contents[i]); + } else { + obj.appendChild(document.createTextNode(contents[i])); + } + } + } + return obj; + }, + ucMatch: function (match,c) {return c.toUpperCase()}, + addElement: function (span,type,def,contents) {return span.appendChild(this.Element(type,def,contents))}, + TextNode: function (text) {return document.createTextNode(text)}, + addText: function (span,text) {return span.appendChild(this.TextNode(text))}, + + // + // Set and get the text of a script + // + setScript: function (script,text) { + if (this.setScriptBug) {script.text = text} else { + while (script.firstChild) {script.removeChild(script.firstChild)} + this.addText(script,text); + } + }, + getScript: function (script) { + var text = (script.text === "" ? script.innerHTML : script.text); + return text.replace(/^\s+/,"").replace(/\s+$/,""); + }, + + // + // Manage cookies + // + Cookie: { + prefix: "mjx", + expires: 365, + + // + // Save an object as a named cookie + // + Set: function (name,def) { + var keys = []; + if (def) { + for (var id in def) {if (def.hasOwnProperty(id)) { + keys.push(id+":"+def[id].toString().replace(/&/g,"&&")); + }} + } + var cookie = this.prefix+"."+name+"="+escape(keys.join('&;')); + if (this.expires) { + var time = new Date(); time.setDate(time.getDate() + this.expires); + cookie += '; expires='+time.toGMTString(); + } + try {document.cookie = cookie+"; path=/"} catch (err) {} // ignore errors saving cookies + }, + + // + // Get the contents of a named cookie and incorporate + // it into the given object (or return a fresh one) + // + Get: function (name,obj) { + if (!obj) {obj = {}} + var pattern = new RegExp("(?:^|;\\s*)"+this.prefix+"\\."+name+"=([^;]*)(?:;|$)"); + var match; + try {match = pattern.exec(document.cookie)} catch (err) {}; // ignore errors reading cookies + if (match && match[1] !== "") { + var keys = unescape(match[1]).split('&;'); + for (var i = 0, m = keys.length; i < m; i++) { + match = keys[i].match(/([^:]+):(.*)/); + var value = match[2].replace(/&&/g,'&'); + if (value === "true") {value = true} else if (value === "false") {value = false} + else if (value.match(/^-?(\d+(\.\d+)?|\.\d+)$/)) {value = parseFloat(value)} + obj[match[1]] = value; + } + } + return obj; + } + } + +}; + + +/**********************************************************/ + +MathJax.Localization = { + + locale: "en", + directory: "[MathJax]/localization", + strings: { + // Currently, this list is not modified by the MathJax-i18n script. You can + // run the following command in MathJax/unpacked/localization to update it: + // + // find . -name "*.js" | xargs grep menuTitle\: | grep -v qqq | sed 's/^\.\/\(.*\)\/.*\.js\: / "\1"\: \{/' | sed 's/,$/\},/' | sed 's/"English"/"English", isLoaded: true/' > tmp ; sort tmp > tmp2 ; sed '$ s/,$//' tmp2 ; rm tmp* + // + // This only takes languages with localization data so you must also add + // the languages that use a remap but are not translated at all. + // + "ar": {menuTitle: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"}, + "ast": {menuTitle: "asturianu"}, + "bg": {menuTitle: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"}, + "bcc": {menuTitle: "\u0628\u0644\u0648\u0686\u06CC"}, + "br": {menuTitle: "brezhoneg"}, + "ca": {menuTitle: "catal\u00E0"}, + "cdo": {menuTitle: "M\u00ECng-d\u0115\u0324ng-ng\u1E73\u0304"}, + "cs": {menuTitle: "\u010De\u0161tina"}, + "da": {menuTitle: "dansk"}, + "de": {menuTitle: "Deutsch"}, + "diq": {menuTitle: "Zazaki"}, + "en": {menuTitle: "English", isLoaded: true}, + "eo": {menuTitle: "Esperanto"}, + "es": {menuTitle: "espa\u00F1ol"}, + "fa": {menuTitle: "\u0641\u0627\u0631\u0633\u06CC"}, + "fi": {menuTitle: "suomi"}, + "fr": {menuTitle: "fran\u00E7ais"}, + "gl": {menuTitle: "galego"}, + "he": {menuTitle: "\u05E2\u05D1\u05E8\u05D9\u05EA"}, + "ia": {menuTitle: "interlingua"}, + "it": {menuTitle: "italiano"}, + "ja": {menuTitle: "\u65E5\u672C\u8A9E"}, + "kn": {menuTitle: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"}, + "ko": {menuTitle: "\uD55C\uAD6D\uC5B4"}, + "lb": {menuTitle: "L\u00EBtzebuergesch"}, + "lki": {menuTitle: "\u0644\u06D5\u06A9\u06CC"}, + "lt": {menuTitle: "lietuvi\u0173"}, + "mk": {menuTitle: "\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438"}, + "nl": {menuTitle: "Nederlands"}, + "oc": {menuTitle: "occitan"}, + "pl": {menuTitle: "polski"}, + "pt": {menuTitle: "portugu\u00EAs"}, + "pt-br": {menuTitle: "portugu\u00EAs do Brasil"}, + "ru": {menuTitle: "\u0440\u0443\u0441\u0441\u043A\u0438\u0439"}, + "sco": {menuTitle: "Scots"}, + "scn": {menuTitle: "sicilianu"}, + "sk": {menuTitle: "sloven\u010Dina"}, + "sl": {menuTitle: "sloven\u0161\u010Dina"}, + "sv": {menuTitle: "svenska"}, + "th": {menuTitle: "\u0E44\u0E17\u0E22"}, + "tr": {menuTitle: "T\u00FCrk\u00E7e"}, + "uk": {menuTitle: "\u0443\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"}, + "vi": {menuTitle: "Ti\u1EBFng Vi\u1EC7t"}, + "zh-hans": {menuTitle: "\u4E2D\u6587\uFF08\u7B80\u4F53\uFF09"}, + "zh-hant": {menuTitle: "\u6C49\u8BED"} + }, + + // + // The pattern for substitution escapes: + // %n or %{n} or %{plural:%n|option1|option1|...} or %c + // + pattern: /%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%\{\d+\}|%.|[^\}])*)+\}|.)/g, + + SPLIT: ("axb".split(/(x)/).length === 3 ? + function (string,regex) {return string.split(regex)} : + // + // IE8 and below don't do split() correctly when the pattern includes + // parentheses (the split should include the matched exrepssions). + // So implement it by hand here. + // + function (string,regex) { + var result = [], match, last = 0; + regex.lastIndex = 0; + while ((match = regex.exec(string))) { + result.push(string.substr(last,match.index-last)); + result.push.apply(result,match.slice(1)); + last = match.index + match[0].length; + } + result.push(string.substr(last)); + return result; + }), + + _: function (id,phrase) { + if (MathJax.Object.isArray(phrase)) {return this.processSnippet(id,phrase)} + return this.processString(this.lookupPhrase(id,phrase),[].slice.call(arguments,2)); + }, + + processString: function (string,args,domain) { + // + // Process arguments for substitution + // If the argument is a snippet (and we are processing snippets) do so, + // Otherwise, if it is a number, convert it for the lacale + // + var i, m, isArray = MathJax.Object.isArray; + for (i = 0, m = args.length; i < m; i++) { + if (domain && isArray(args[i])) {args[i] = this.processSnippet(domain,args[i])} + } + // + // Split string at escapes and process them individually + // + var parts = this.SPLIT(string,this.pattern); + for (i = 1, m = parts.length; i < m; i += 2) { + var c = parts[i].charAt(0); // first char will be { or \d or a char to be kept literally + if (c >= "0" && c <= "9") { // %n + parts[i] = args[parts[i]-1]; + if (typeof parts[i] === "number") parts[i] = this.number(parts[i]); + } else if (c === "{") { // %{n} or %{plural:%n|...} + c = parts[i].substr(1); + if (c >= "0" && c <= "9") { // %{n} + parts[i] = args[parts[i].substr(1,parts[i].length-2)-1]; + if (typeof parts[i] === "number") parts[i] = this.number(parts[i]); + } else { // %{plural:%n|...} + var match = parts[i].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/); + if (match) { + if (match[1] === "plural") { + var n = args[match[2]-1]; + if (typeof n === "undefined") { + parts[i] = "???"; // argument doesn't exist + } else { + n = this.plural(n) - 1; // index of the form to use + var plurals = match[3].replace(/(^|[^%])(%%)*%\|/g,"$1$2%\uEFEF").split(/\|/); // the parts (replacing %| with a special character) + if (n >= 0 && n < plurals.length) { + parts[i] = this.processString(plurals[n].replace(/\uEFEF/g,"|"),args,domain); + } else { + parts[i] = "???"; // no string for this index + } + } + } else {parts[i] = "%"+parts[i]} // not "plural", put back the % and leave unchanged + } + } + } + if (parts[i] == null) {parts[i] = "???"} + } + // + // If we are not forming a snippet, return the completed string + // + if (!domain) {return parts.join("")} + // + // We need to return an HTML snippet, so buld it from the + // broken up string with inserted parts (that could be snippets) + // + var snippet = [], part = ""; + for (i = 0; i < m; i++) { + part += parts[i]; i++; // add the string and move on to substitution result + if (i < m) { + if (isArray(parts[i])) { // substitution was a snippet + snippet.push(part); // add the accumulated string + snippet = snippet.concat(parts[i]); // concatenate the substution snippet + part = ""; // start accumulating a new string + } else { // substitution was a string + part += parts[i]; // add to accumulating string + } + } + } + if (part !== "") {snippet.push(part)} // add final string + return snippet; + }, + + processSnippet: function (domain,snippet) { + var result = []; // the new snippet + // + // Look through the original snippet for + // strings or snippets to translate + // + for (var i = 0, m = snippet.length; i < m; i++) { + if (MathJax.Object.isArray(snippet[i])) { + // + // This could be a sub-snippet: + // ["tag"] or ["tag",{properties}] or ["tag",{properties},snippet] + // Or it could be something to translate: + // [id,string,args] or [domain,snippet] + var data = snippet[i]; + if (typeof data[1] === "string") { // [id,string,args] + var id = data[0]; if (!MathJax.Object.isArray(id)) {id = [domain,id]} + var phrase = this.lookupPhrase(id,data[1]); + result = result.concat(this.processMarkdown(phrase,data.slice(2),domain)); + } else if (MathJax.Object.isArray(data[1])) { // [domain,snippet] + result = result.concat(this.processSnippet.apply(this,data)); + } else if (data.length >= 3) { // ["tag",{properties},snippet] + result.push([data[0],data[1],this.processSnippet(domain,data[2])]); + } else { // ["tag"] or ["tag",{properties}] + result.push(snippet[i]); + } + } else { // a string + result.push(snippet[i]); + } + } + return result; + }, + + markdownPattern: /(%.)|(\*{1,3})((?:%.|.)+?)\2|(`+)((?:%.|.)+?)\4|\[((?:%.|.)+?)\]\(([^\s\)]+)\)/, + // %c or *bold*, **italics**, ***bold-italics***, or `code`, or [link](url) + + processMarkdown: function (phrase,args,domain) { + var result = [], data; + // + // Split the string by the Markdown pattern + // (the text blocks are separated by + // c,stars,star-text,backtics,code-text,link-text,URL). + // Start with the first text string from the split. + // + var parts = phrase.split(this.markdownPattern); + var string = parts[0]; + // + // Loop through the matches and process them + // + for (var i = 1, m = parts.length; i < m; i += 8) { + if (parts[i+1]) { // stars (for bold/italic) + // + // Select the tag to use by number of stars (three stars requires two tags) + // + data = this.processString(parts[i+2],args,domain); + if (!MathJax.Object.isArray(data)) {data = [data]} + data = [["b","i","i"][parts[i+1].length-1],{},data]; // number of stars determines type + if (parts[i+1].length === 3) {data = ["b",{},data]} // bold-italic + } else if (parts[i+3]) { // backtics (for code) + // + // Remove one leading or trailing space, and process substitutions + // Make a tag + // + data = this.processString(parts[i+4].replace(/^\s/,"").replace(/\s$/,""),args,domain); + if (!MathJax.Object.isArray(data)) {data = [data]} + data = ["code",{},data]; + } else if (parts[i+5]) { // hyperlink + // + // Process the link text, and make an tag with the URL + // + data = this.processString(parts[i+5],args,domain); + if (!MathJax.Object.isArray(data)) {data = [data]} + data = ["a",{href:this.processString(parts[i+6],args),target:"_blank"},data]; + } else { + // + // Escaped character (%c) gets added into the string. + // + string += parts[i]; data = null; + } + // + // If there is a tag to insert, + // Add any pending string, then push the tag + // + if (data) { + result = this.concatString(result,string,args,domain); + result.push(data); string = ""; + } + // + // Process the string that follows matches pattern + // + if (parts[i+7] !== "") {string += parts[i+7]} + }; + // + // Add any pending string and return the resulting snippet + // + result = this.concatString(result,string,args,domain); + return result; + }, + concatString: function (result,string,args,domain) { + if (string != "") { + // + // Process the substutions. + // If the result is not a snippet, turn it into one. + // Then concatenate the snippet to the current one + // + string = this.processString(string,args,domain); + if (!MathJax.Object.isArray(string)) {string = [string]} + result = result.concat(string); + } + return result; + }, + + lookupPhrase: function (id,phrase,domain) { + // + // Get the domain and messageID + // + if (!domain) {domain = "_"} + if (MathJax.Object.isArray(id)) {domain = (id[0] || "_"); id = (id[1] || "")} + // + // Check if the data is available and if not, + // load it and throw a restart error so the calling + // code can wait for the load and try again. + // + var load = this.loadDomain(domain); + if (load) {MathJax.Hub.RestartAfter(load)} + // + // Look up the message in the localization data + // (if not found, the original English is used) + // + var localeData = this.strings[this.locale]; + if (localeData) { + if (localeData.domains && domain in localeData.domains) { + var domainData = localeData.domains[domain]; + if (domainData.strings && id in domainData.strings) + {phrase = domainData.strings[id]} + } + } + // + // return the translated phrase + // + return phrase; + }, + + // + // Load a langauge data file from the proper + // directory and file. + // + loadFile: function (file,data,callback) { + callback = MathJax.Callback(callback); + file = (data.file || file); // the data's file name or the default name + if (!file.match(/\.js$/)) {file += ".js"} // add .js if needed + // + // Add the directory if the file doesn't + // contain a full URL already. + // + if (!file.match(/^([a-z]+:|\[MathJax\])/)) { + var dir = (this.strings[this.locale].directory || + this.directory + "/" + this.locale || + "[MathJax]/localization/" + this.locale); + file = dir + "/" + file; + } + // + // Load the file and mark the data as loaded (even if it + // failed to load, so we don't continue to try to load it + // over and over). + // + var load = MathJax.Ajax.Require(file,function () {data.isLoaded = true; return callback()}); + // + // Return the callback if needed, otherwise null. + // + return (load.called ? null : load); + }, + + // + // Check to see if the localization data are loaded + // for the given domain; if not, load the data file, + // and return a callback for the loading operation. + // Otherwise return null (data are loaded). + // + loadDomain: function (domain,callback) { + var load, localeData = this.strings[this.locale]; + if (localeData) { + if (!localeData.isLoaded) { + load = this.loadFile(this.locale,localeData); + if (load) { + return MathJax.Callback.Queue( + load,["loadDomain",this,domain] // call again to load domain + ).Push(callback||{}); + } + } + if (localeData.domains && domain in localeData.domains) { + var domainData = localeData.domains[domain]; + if (!domainData.isLoaded) { + load = this.loadFile(domain,domainData); + if (load) {return MathJax.Callback.Queue(load).Push(callback)} + } + } + } + // localization data are loaded, so just do the callback + return MathJax.Callback(callback)(); + }, + + // + // Perform a function, properly handling + // restarts due to localization file loads. + // + // Note that this may return before the function + // has been called successfully, so you should + // consider fn as running asynchronously. (Callbacks + // can be used to synchronize it with other actions.) + // + Try: function (fn) { + fn = MathJax.Callback(fn); fn.autoReset = true; + try {fn()} catch (err) { + if (!err.restart) {throw err} + MathJax.Callback.After(["Try",this,fn],err.restart); + } + }, + + // + // Reset the current language + // + resetLocale: function(locale) { + // Selection algorithm: + // 1) Downcase locale name (e.g. "en-US" => "en-us") + // 2) Try a parent language (e.g. "en-us" => "en") + // 3) Try the fallback specified in the data (e.g. "pt" => "pt-br") + // 4) Otherwise don't change the locale. + if (!locale) return; + locale = locale.toLowerCase(); + while (!this.strings[locale]) { + var dashPos = locale.lastIndexOf("-"); + if (dashPos === -1) return; + locale = locale.substring(0, dashPos); + } + var remap = this.strings[locale].remap; + this.locale = remap ? remap : locale; + MathJax.Callback.Signal("Hub").Post(["Locale Reset", this.locale]); + }, + + // + // Set the current language + // + setLocale: function(locale) { + this.resetLocale(locale); + if (MathJax.Menu) {this.loadDomain("MathMenu")} + }, + + // + // Add or update a language or domain + // + addTranslation: function (locale,domain,definition) { + var data = this.strings[locale], isNew = false; + if (!data) {data = this.strings[locale] = {}; isNew = true} + if (!data.domains) {data.domains = {}} + if (domain) { + if (!data.domains[domain]) {data.domains[domain] = {}} + data = data.domains[domain]; + } + MathJax.Hub.Insert(data,definition); + if (isNew && MathJax.Menu.menu) {MathJax.Menu.CreateLocaleMenu()} + }, + + // + // Set CSS for an element based on font requirements + // + setCSS: function (div) { + var locale = this.strings[this.locale]; + if (locale) { + if (locale.fontFamily) {div.style.fontFamily = locale.fontFamily} + if (locale.fontDirection) { + div.style.direction = locale.fontDirection; + if (locale.fontDirection === "rtl") {div.style.textAlign = "right"} + } + } + return div; + }, + + // + // Get the language's font family or direction + // + fontFamily: function () { + var locale = this.strings[this.locale]; + return (locale ? locale.fontFamily : null); + }, + fontDirection: function () { + var locale = this.strings[this.locale]; + return (locale ? locale.fontDirection : null); + }, + + // + // Get the language's plural index for a number + // + plural: function (n) { + var locale = this.strings[this.locale]; + if (locale && locale.plural) {return locale.plural(n)} + // default + if (n == 1) {return 1} // one + return 2; // other + }, + + // + // Convert a number to language-specific form + // + number: function(n) { + var locale = this.strings[this.locale]; + if (locale && locale.number) {return locale.number(n)} + // default + return n; + } +}; + + +/**********************************************************/ + +MathJax.Message = { + ready: false, // used to tell when the styles are available + log: [{}], current: null, + textNodeBug: (navigator.vendor === "Apple Computer, Inc." && + typeof navigator.vendorSub === "undefined") || + (window.hasOwnProperty && window.hasOwnProperty("konqueror")), // Konqueror displays some gibberish with text.nodeValue = "..." + + styles: { + "#MathJax_Message": { + position: "fixed", left: "1px", bottom: "2px", + 'background-color': "#E6E6E6", border: "1px solid #959595", + margin: "0px", padding: "2px 8px", + 'z-index': "102", color: "black", 'font-size': "80%", + width: "auto", 'white-space': "nowrap" + }, + + "#MathJax_MSIE_Frame": { + position: "absolute", + top:0, left: 0, width: "0px", 'z-index': 101, + border: "0px", margin: "0px", padding: "0px" + } + }, + + browsers: { + MSIE: function (browser) { + MathJax.Message.msieFixedPositionBug = ((document.documentMode||0) < 7); + if (MathJax.Message.msieFixedPositionBug) + {MathJax.Hub.config.styles["#MathJax_Message"].position = "absolute"} + MathJax.Message.quirks = (document.compatMode === "BackCompat"); + }, + Chrome: function (browser) { + MathJax.Hub.config.styles["#MathJax_Message"].bottom = "1.5em"; + MathJax.Hub.config.styles["#MathJax_Message"].left = "1em"; + } + }, + + Init: function (styles) { + if (styles) {this.ready = true} + if (!document.body || !this.ready) {return false} + // + // ASCIIMathML replaces the entire page with a copy of itself (@#!#%@!!) + // so check that this.div is still part of the page, otherwise look up + // the copy and use that. + // + if (this.div && this.div.parentNode == null) { + this.div = document.getElementById("MathJax_Message"); + this.text = (this.div ? this.div.firstChild : null); + } + if (!this.div) { + var frame = document.body; + if (this.msieFixedPositionBug && window.attachEvent) { + frame = this.frame = this.addDiv(document.body); frame.removeAttribute("id"); + frame.style.position = "absolute"; + frame.style.border = frame.style.margin = frame.style.padding = "0px"; + frame.style.zIndex = "101"; frame.style.height = "0px"; + frame = this.addDiv(frame); + frame.id = "MathJax_MSIE_Frame"; + window.attachEvent("onscroll",this.MoveFrame); + window.attachEvent("onresize",this.MoveFrame); + this.MoveFrame(); + } + this.div = this.addDiv(frame); this.div.style.display = "none"; + } + if (!this.text) { + this.text = this.div.appendChild(document.createTextNode("")); + } + return true; + }, + + addDiv: function (parent) { + var div = document.createElement("div"); + div.id = "MathJax_Message"; + if (parent.firstChild) {parent.insertBefore(div,parent.firstChild)} + else {parent.appendChild(div)} + return div; + }, + + MoveFrame: function () { + var body = (MathJax.Message.quirks ? document.body : document.documentElement); + var frame = MathJax.Message.frame; + frame.style.left = body.scrollLeft + 'px'; + frame.style.top = body.scrollTop + 'px'; + frame.style.width = body.clientWidth + 'px'; + frame = frame.firstChild; + frame.style.height = body.clientHeight + 'px'; + }, + + localize: function (message) { + return MathJax.Localization._(message,message); + }, + + filterText: function (text,n,id) { + if (MathJax.Hub.config.messageStyle === "simple") { + if (id === "LoadFile") { + if (!this.loading) {this.loading = this.localize("Loading") + " "} + text = this.loading; this.loading += "."; + } else if (id === "ProcessMath") { + if (!this.processing) {this.processing = this.localize("Processing") + " "} + text = this.processing; this.processing += "."; + } else if (id === "TypesetMath") { + if (!this.typesetting) {this.typesetting = this.localize("Typesetting") + " "} + text = this.typesetting; this.typesetting += "."; + } + } + return text; + }, + + clearCounts: function () { + delete this.loading; + delete this.processing; + delete this.typesetting; + }, + + Set: function (text,n,clearDelay) { + if (n == null) {n = this.log.length; this.log[n] = {}} + // + // Translate message if it is [id,message,arguments] + // + var id = ""; + if (MathJax.Object.isArray(text)) { + id = text[0]; if (MathJax.Object.isArray(id)) {id = id[1]} + // + // Localization._() will throw a restart error if a localization file + // needs to be loaded, so trap that and redo the Set() call + // after it is loaded. + // + try { + text = MathJax.Localization._.apply(MathJax.Localization,text); + } catch (err) { + if (!err.restart) {throw err} + if (!err.restart.called) { + // + // Mark it so we can tell if the Clear() comes before the message is displayed + // + if (this.log[n].restarted == null) {this.log[n].restarted = 0} + this.log[n].restarted++; delete this.log[n].cleared; + MathJax.Callback.After(["Set",this,text,n,clearDelay],err.restart); + return n; + } + } + } + // + // Clear the timout timer. + // + if (this.timer) {clearTimeout(this.timer); delete this.timer} + // + // Save the message and filtered message. + // + this.log[n].text = text; this.log[n].filteredText = text = this.filterText(text,n,id); + // + // Hook the message into the message list so we can tell + // what message to put up when this one is removed. + // + if (typeof(this.log[n].next) === "undefined") { + this.log[n].next = this.current; + if (this.current != null) {this.log[this.current].prev = n} + this.current = n; + } + // + // Show the message if it is the currently active one. + // + if (this.current === n && MathJax.Hub.config.messageStyle !== "none") { + if (this.Init()) { + if (this.textNodeBug) {this.div.innerHTML = text} else {this.text.nodeValue = text} + this.div.style.display = ""; + if (this.status) {window.status = ""; delete this.status} + } else { + window.status = text; + this.status = true; + } + } + // + // Check if the message was resetarted to load a localization file + // and if it has been cleared in the meanwhile. + // + if (this.log[n].restarted) { + if (this.log[n].cleared) {clearDelay = 0} + if (--this.log[n].restarted === 0) {delete this.log[n].cleared} + } + // + // Check if we need to clear the message automatically. + // + if (clearDelay) {setTimeout(MathJax.Callback(["Clear",this,n]),clearDelay)} + else if (clearDelay == 0) {this.Clear(n,0)} + // + // Return the message number. + // + return n; + }, + + Clear: function (n,delay) { + // + // Detatch the message from the active list. + // + if (this.log[n].prev != null) {this.log[this.log[n].prev].next = this.log[n].next} + if (this.log[n].next != null) {this.log[this.log[n].next].prev = this.log[n].prev} + // + // If it is the current message, get the next one to show. + // + if (this.current === n) { + this.current = this.log[n].next; + if (this.text) { + if (this.div.parentNode == null) {this.Init()} // see ASCIIMathML comments above + if (this.current == null) { + // + // If there are no more messages, remove the message box. + // + if (this.timer) {clearTimeout(this.timer); delete this.timer} + if (delay == null) {delay = 600} + if (delay === 0) {this.Remove()} + else {this.timer = setTimeout(MathJax.Callback(["Remove",this]),delay)} + } else if (MathJax.Hub.config.messageStyle !== "none") { + // + // If there is an old message, put it in place + // + if (this.textNodeBug) {this.div.innerHTML = this.log[this.current].filteredText} + else {this.text.nodeValue = this.log[this.current].filteredText} + } + if (this.status) {window.status = ""; delete this.status} + } else if (this.status) { + window.status = (this.current == null ? "" : this.log[this.current].text); + } + } + // + // Clean up the log data no longer needed + // + delete this.log[n].next; delete this.log[n].prev; + delete this.log[n].filteredText; + // + // If this is a restarted localization message, mark that it has been cleared + // while waiting for the file to load. + // + if (this.log[n].restarted) {this.log[n].cleared = true} + }, + + Remove: function () { + // FIXME: do a fade out or something else interesting? + this.text.nodeValue = ""; + this.div.style.display = "none"; + }, + + File: function (file) { + return this.Set(["LoadFile","Loading %1",file],null,null); + }, + + Log: function () { + var strings = []; + for (var i = 1, m = this.log.length; i < m; i++) {strings[i] = this.log[i].text} + return strings.join("\n"); + } + +}; + +/**********************************************************/ + +MathJax.Hub = { + config: { + root: "", + config: [], // list of configuration files to load + styleSheets: [], // list of CSS files to load + styles: { // styles to generate in-line + ".MathJax_Preview": { + color: "#888", + display: "contents" // for RTL languages in Chrome (see issue #2190) + } + }, + jax: [], // list of input and output jax to load + extensions: [], // list of extensions to load + preJax: null, // pattern to remove from before math script tag + postJax: null, // pattern to remove from after math script tag + displayAlign: 'center', // how to align displayed equations (left, center, right) + displayIndent: '0', // indentation for displayed equations (when not centered) + preRemoveClass: 'MathJax_Preview', // class of objects to remove preceding math script + showProcessingMessages: true, // display "Processing math: nn%" messages or not + messageStyle: "normal", // set to "none" or "simple" (for "Loading..." and "Processing...") + delayStartupUntil: "none", // set to "onload" to delay setup until the onload handler runs + // set to "configured" to delay startup until MathJax.Hub.Configured() is called + // set to a Callback to wait for before continuing with the startup + skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup + elements: [], // array of elements to process when none is given explicitly + positionToHash: true, // after initial typeset pass, position to #hash location? + + showMathMenu: true, // attach math context menu to typeset math? + showMathMenuMSIE: true, // separtely determine if MSIE should have math menu + // (since the code for that is a bit delicate) + + menuSettings: { + zoom: "None", // when to do MathZoom + CTRL: false, // require CTRL for MathZoom? + ALT: false, // require Alt or Option? + CMD: false, // require CMD? + Shift: false, // require Shift? + discoverable: false, // make math menu discoverable on hover? + zscale: "200%", // the scaling factor for MathZoom + renderer: null, // set when Jax are loaded + font: "Auto", // what font HTML-CSS should use + context: "MathJax", // or "Browser" for pass-through to browser menu + locale: null, // the language to use for messages + mpContext: false, // true means pass menu events to MathPlayer in IE + mpMouse: false, // true means pass mouse events to MathPlayer in IE + texHints: true, // include class names for TeXAtom elements + FastPreview: null, // use PreviewHTML output as preview? + assistiveMML: null, // include hidden MathML for screen readers? + inTabOrder: true, // set to false if math elements should be included in the tabindex + semantics: false // add semantics tag with original form in MathML output + }, + + errorSettings: { + // localized HTML snippet structure for message to use + message: ["[",["MathProcessingError","Math Processing Error"],"]"], + style: {color: "#CC0000", "font-style":"italic"} // style for message + }, + + ignoreMMLattributes: {} // attributes not to copy to HTML-CSS or SVG output + // from MathML input (in addition to the ones in MML.nocopyAttributes). + // An id set to true will be ignored, one set to false will + // be allowed (even if other criteria normally would prevent + // it from being copied); use false carefully! + }, + + preProcessors: MathJax.Callback.Hooks(true), // list of callbacks for preprocessing (initialized by extensions) + inputJax: {}, // mime-type mapped to input jax (by registration) + outputJax: {order:{}}, // mime-type mapped to output jax list (by registration) + + processSectionDelay: 50, // pause between input and output phases of processing + processUpdateTime: 250, // time between screen updates when processing math (milliseconds) + processUpdateDelay: 10, // pause between screen updates to allow other processing (milliseconds) + + signal: MathJax.Callback.Signal("Hub"), // Signal used for Hub events + + Config: function (def) { + this.Insert(this.config,def); + if (this.config.Augment) {this.Augment(this.config.Augment)} + }, + CombineConfig: function (name,def) { + var config = this.config, id, parent; name = name.split(/\./); + for (var i = 0, m = name.length; i < m; i++) { + id = name[i]; if (!config[id]) {config[id] = {}} + parent = config; config = config[id]; + } + parent[id] = config = this.Insert(def,config); + return config; + }, + + Register: { + PreProcessor: function () {return MathJax.Hub.preProcessors.Add.apply(MathJax.Hub.preProcessors,arguments)}, + MessageHook: function () {return MathJax.Hub.signal.MessageHook.apply(MathJax.Hub.signal,arguments)}, + StartupHook: function () {return MathJax.Hub.Startup.signal.MessageHook.apply(MathJax.Hub.Startup.signal,arguments)}, + LoadHook: function () {return MathJax.Ajax.LoadHook.apply(MathJax.Ajax,arguments)} + }, + UnRegister: { + PreProcessor: function (hook) {MathJax.Hub.preProcessors.Remove(hook)}, + MessageHook: function (hook) {MathJax.Hub.signal.RemoveHook(hook)}, + StartupHook: function (hook) {MathJax.Hub.Startup.signal.RemoveHook(hook)}, + LoadHook: function (hook) {MathJax.Ajax.removeHook(hook)} + }, + + getAllJax: function (element) { + var jax = [], scripts = this.elementScripts(element); + for (var i = 0, m = scripts.length; i < m; i++) { + if (scripts[i].MathJax && scripts[i].MathJax.elementJax) + {jax.push(scripts[i].MathJax.elementJax)} + } + return jax; + }, + + getJaxByType: function (type,element) { + var jax = [], scripts = this.elementScripts(element); + for (var i = 0, m = scripts.length; i < m; i++) { + if (scripts[i].MathJax && scripts[i].MathJax.elementJax && + scripts[i].MathJax.elementJax.mimeType === type) + {jax.push(scripts[i].MathJax.elementJax)} + } + return jax; + }, + + getJaxByInputType: function (type,element) { + var jax = [], scripts = this.elementScripts(element); + for (var i = 0, m = scripts.length; i < m; i++) { + if (scripts[i].MathJax && scripts[i].MathJax.elementJax && + scripts[i].type && scripts[i].type.replace(/ *;(.|\s)*/,"") === type) + {jax.push(scripts[i].MathJax.elementJax)} + } + return jax; + }, + + getJaxFor: function (element) { + if (typeof(element) === 'string') {element = document.getElementById(element)} + if (element && element.MathJax) {return element.MathJax.elementJax} + if (this.isMathJaxNode(element)) { + if (!element.isMathJax) {element = element.firstChild} // for NativeMML output + while (element && !element.jaxID) {element = element.parentNode} + if (element) {return MathJax.OutputJax[element.jaxID].getJaxFromMath(element)} + } + return null; + }, + + isJax: function (element) { + if (typeof(element) === 'string') {element = document.getElementById(element)} + if (this.isMathJaxNode(element)) {return 1} + if (element && (element.tagName||"").toLowerCase() === 'script') { + if (element.MathJax) + {return (element.MathJax.state === MathJax.ElementJax.STATE.PROCESSED ? 1 : -1)} + if (element.type && this.inputJax[element.type.replace(/ *;(.|\s)*/,"")]) {return -1} + } + return 0; + }, + isMathJaxNode: function (element) { + return !!element && (element.isMathJax || (element.className||"") === "MathJax_MathML"); + }, + + setRenderer: function (renderer,type) { + if (!renderer) return; + var JAX = MathJax.OutputJax[renderer]; + if (!JAX) { + MathJax.OutputJax[renderer] = MathJax.OutputJax({id: "unknown", version:"1.0.0", isUnknown: true}); + this.config.menuSettings.renderer = ""; + var file = "[MathJax]/jax/output/"+renderer+"/config.js"; + return MathJax.Ajax.Require(file,["setRenderer",this,renderer,type]); + } else { + this.config.menuSettings.renderer = renderer; + if (type == null) {type = "jax/mml"} + if (JAX.isUnknown) JAX.Register(type); + var jax = this.outputJax; + if (jax[type] && jax[type].length) { + if (renderer !== jax[type][0].id) { + jax[type].unshift(JAX); + return this.signal.Post(["Renderer Selected",renderer]); + } + } + return null; + } + }, + + Queue: function () { + return this.queue.Push.apply(this.queue,arguments); + }, + + Typeset: function (element,callback) { + if (!MathJax.isReady) return null; + var ec = this.elementCallback(element,callback); + if (ec.count) { + var queue = MathJax.Callback.Queue( + ["PreProcess",this,ec.elements], + ["Process",this,ec.elements] + ); + } + return queue.Push(ec.callback); + }, + + PreProcess: function (element,callback) { + var ec = this.elementCallback(element,callback); + var queue = MathJax.Callback.Queue(); + if (ec.count) { + var elements = (ec.count === 1 ? [ec.elements] : ec.elements); + queue.Push(["Post",this.signal,["Begin PreProcess",ec.elements]]); + for (var i = 0, m = elements.length; i < m; i++) { + if (elements[i]) {queue.Push(["Execute",this.preProcessors,elements[i]])} + } + queue.Push(["Post",this.signal,["End PreProcess",ec.elements]]); + } + return queue.Push(ec.callback); + }, + + Process: function (element,callback) {return this.takeAction("Process",element,callback)}, + Update: function (element,callback) {return this.takeAction("Update",element,callback)}, + Reprocess: function (element,callback) {return this.takeAction("Reprocess",element,callback)}, + Rerender: function (element,callback) {return this.takeAction("Rerender",element,callback)}, + + takeAction: function (action,element,callback) { + var ec = this.elementCallback(element,callback); + var elements = ec.elements; + var queue = MathJax.Callback.Queue(["Clear",this.signal]); + var state = { + scripts: [], // filled in by prepareScripts + start: new Date().getTime(), // timer for processing messages + i: 0, j: 0, // current script, current jax + jax: {}, // scripts grouped by output jax + jaxIDs: [] // id's of jax used + }; + if (ec.count) { + var delay = ["Delay",MathJax.Callback,this.processSectionDelay]; + if (!delay[2]) {delay = {}} + queue.Push( + ["clearCounts",MathJax.Message], + ["Post",this.signal,["Begin "+action,elements]], + ["Post",this.signal,["Begin Math",elements,action]], + ["prepareScripts",this,action,elements,state], + ["Post",this.signal,["Begin Math Input",elements,action]], + ["processInput",this,state], + ["Post",this.signal,["End Math Input",elements,action]], + delay, + ["prepareOutput",this,state,"preProcess"], + delay, + ["Post",this.signal,["Begin Math Output",elements,action]], + ["processOutput",this,state], + ["Post",this.signal,["End Math Output",elements,action]], + delay, + ["prepareOutput",this,state,"postProcess"], + delay, + ["Post",this.signal,["End Math",elements,action]], + ["Post",this.signal,["End "+action,elements]], + ["clearCounts",MathJax.Message] + ); + } + return queue.Push(ec.callback); + }, + + scriptAction: { + Process: function (script) {}, + Update: function (script) { + var jax = script.MathJax.elementJax; + if (jax && jax.needsUpdate()) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE} + else {script.MathJax.state = jax.STATE.PROCESSED} + }, + Reprocess: function (script) { + var jax = script.MathJax.elementJax; + if (jax) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE} + }, + Rerender: function (script) { + var jax = script.MathJax.elementJax; + if (jax) {jax.Remove(true); script.MathJax.state = jax.STATE.OUTPUT} + } + }, + + prepareScripts: function (action,element,state) { + if (arguments.callee.disabled) return; + var scripts = this.elementScripts(element); + var STATE = MathJax.ElementJax.STATE; + for (var i = 0, m = scripts.length; i < m; i++) { + var script = scripts[i]; + if (script.type && this.inputJax[script.type.replace(/ *;(.|\n)*/,"")]) { + if (script.MathJax) { + if (script.MathJax.elementJax && script.MathJax.elementJax.hover) { + MathJax.Extension.MathEvents.Hover.ClearHover(script.MathJax.elementJax); + } + if (script.MathJax.state !== STATE.PENDING) {this.scriptAction[action](script)} + } + if (!script.MathJax) {script.MathJax = {state: STATE.PENDING}} + if (script.MathJax.error) delete script.MathJax.error; + if (script.MathJax.state !== STATE.PROCESSED) {state.scripts.push(script)} + } + } + }, + + checkScriptSiblings: function (script) { + if (script.MathJax.checked) return; + var config = this.config, pre = script.previousSibling; + if (pre && pre.nodeName === "#text") { + var preJax,postJax, post = script.nextSibling; + if (post && post.nodeName !== "#text") {post = null} + if (config.preJax) { + if (typeof(config.preJax) === "string") {config.preJax = new RegExp(config.preJax+"$")} + preJax = pre.nodeValue.match(config.preJax); + } + if (config.postJax && post) { + if (typeof(config.postJax) === "string") {config.postJax = new RegExp("^"+config.postJax)} + postJax = post.nodeValue.match(config.postJax); + } + if (preJax && (!config.postJax || postJax)) { + pre.nodeValue = pre.nodeValue.replace + (config.preJax,(preJax.length > 1? preJax[1] : "")); + pre = null; + } + if (postJax && (!config.preJax || preJax)) { + post.nodeValue = post.nodeValue.replace + (config.postJax,(postJax.length > 1? postJax[1] : "")); + } + if (pre && !pre.nodeValue.match(/\S/)) {pre = pre.previousSibling} + } + if (config.preRemoveClass && pre && pre.className === config.preRemoveClass) + {script.MathJax.preview = pre} + script.MathJax.checked = 1; + }, + + processInput: function (state) { + var jax, STATE = MathJax.ElementJax.STATE; + var script, prev, m = state.scripts.length; + try { + // + // Loop through the scripts + // + while (state.i < m) { + script = state.scripts[state.i]; if (!script) {state.i++; continue} + // + // Remove previous error marker, if any + // + prev = script.previousSibling; + if (prev && prev.className === "MathJax_Error") {prev.parentNode.removeChild(prev)} + // + // Check if already processed or needs processing + // + if (!script.parentNode || !script.MathJax || script.MathJax.state === STATE.PROCESSED) {state.i++; continue}; + if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) { + this.checkScriptSiblings(script); // remove preJax/postJax etc. + var type = script.type.replace(/ *;(.|\s)*/,""); // the input jax type + var input = this.inputJax[type]; // the input jax itself + jax = input.Process(script,state); // run the input jax + if (typeof jax === 'function') { // if a callback was returned + if (jax.called) continue; // go back and call Process() again + this.RestartAfter(jax); // wait for the callback + } + jax = jax.Attach(script,input.id); // register the jax on the script + this.saveScript(jax,state,script,STATE); // add script to state + this.postInputHooks.Execute(jax,input.id,script); // run global jax filters + } else if (script.MathJax.state === STATE.OUTPUT) { + this.saveScript(script.MathJax.elementJax,state,script,STATE); // add script to state + } + // + // Go on to the next script, and check if we need to update the processing message + // + state.i++; var now = new Date().getTime(); + if (now - state.start > this.processUpdateTime && state.i < state.scripts.length) + {state.start = now; this.RestartAfter(MathJax.Callback.Delay(1))} + } + } catch (err) {return this.processError(err,state,"Input")} + // + // Put up final message, reset the state and return + // + if (state.scripts.length && this.config.showProcessingMessages) + {MathJax.Message.Set(["ProcessMath","Processing math: %1%%",100],0)} + state.start = new Date().getTime(); state.i = state.j = 0; + return null; + }, + postInputHooks: MathJax.Callback.Hooks(true), // hooks to run after element jax is created + saveScript: function (jax,state,script,STATE) { + // + // Check that output jax exists + // + if (!this.outputJax[jax.mimeType]) { + script.MathJax.state = STATE.UPDATE; + throw Error("No output jax registered for "+jax.mimeType); + } + // + // Record the output jax + // and put this script in the queue for that jax + // + jax.outputJax = this.outputJax[jax.mimeType][0].id; + if (!state.jax[jax.outputJax]) { + if (state.jaxIDs.length === 0) { + // use original array until we know there are more (rather than two copies) + state.jax[jax.outputJax] = state.scripts; + } else { + if (state.jaxIDs.length === 1) // get the script so far for the existing jax + {state.jax[state.jaxIDs[0]] = state.scripts.slice(0,state.i)} + state.jax[jax.outputJax] = []; // start a new array for the new jax + } + state.jaxIDs.push(jax.outputJax); // save the ID of the jax + } + if (state.jaxIDs.length > 1) {state.jax[jax.outputJax].push(script)} + // + // Mark script as needing output + // + script.MathJax.state = STATE.OUTPUT; + }, + + // + // Pre- and post-process scripts by jax + // (to get scaling factors, hide/show output, and so on) + // Since this can cause the jax to load, we need to trap restarts + // + prepareOutput: function (state,method) { + while (state.j < state.jaxIDs.length) { + var id = state.jaxIDs[state.j], JAX = MathJax.OutputJax[id]; + if (JAX[method]) { + try { + var result = JAX[method](state); + if (typeof result === 'function') { + if (result.called) continue; // go back and try again + this.RestartAfter(result); + } + } catch (err) { + if (!err.restart) { + MathJax.Message.Set(["PrepError","Error preparing %1 output (%2)",id,method],null,600); + MathJax.Hub.lastPrepError = err; + state.j++; + } + return MathJax.Callback.After(["prepareOutput",this,state,method],err.restart); + } + } + state.j++; + } + return null; + }, + + processOutput: function (state) { + var result, STATE = MathJax.ElementJax.STATE, script, m = state.scripts.length; + try { + // + // Loop through the scripts + // + while (state.i < m) { + // + // Check that there is an element jax + // + script = state.scripts[state.i]; + if (!script || !script.parentNode || !script.MathJax || script.MathJax.error) {state.i++; continue} + var jax = script.MathJax.elementJax; if (!jax) {state.i++; continue} + // + // Call the output Jax's Process method (which will be its Translate() + // method once loaded). Mark it as complete and remove the preview unless + // the Process() call returns an explicit false value (in which case, it will + // handle this later during the postProcess phase, as HTML-CSS does). + // + result = MathJax.OutputJax[jax.outputJax].Process(script,state); + if (result !== false) { + script.MathJax.state = STATE.PROCESSED; + if (script.MathJax.preview) { + script.MathJax.preview.innerHTML = ""; + script.MathJax.preview.style.display = "none"; + } + // + // Signal that new math is available + // + this.signal.Post(["New Math",jax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback) + } + // + // Go on to next math expression + // + state.i++; + // + // Update the processing message, if needed + // + var now = new Date().getTime(); + if (now - state.start > this.processUpdateTime && state.i < state.scripts.length) + {state.start = now; this.RestartAfter(MathJax.Callback.Delay(this.processUpdateDelay))} + } + } catch (err) {return this.processError(err,state,"Output")} + // + // Put up the typesetting-complete message + // + if (state.scripts.length && this.config.showProcessingMessages) { + MathJax.Message.Set(["TypesetMath","Typesetting math: %1%%",100],0); + MathJax.Message.Clear(0); + } + state.i = state.j = 0; + return null; + }, + + processMessage: function (state,type) { + var m = Math.floor(state.i/(state.scripts.length)*100); + var message = (type === "Output" ? ["TypesetMath","Typesetting math: %1%%"] : + ["ProcessMath","Processing math: %1%%"]); + if (this.config.showProcessingMessages) {MathJax.Message.Set(message.concat(m),0)} + }, + + processError: function (err,state,type) { + if (!err.restart) { + if (!this.config.errorSettings.message) {throw err} + this.formatError(state.scripts[state.i],err); state.i++; + } + this.processMessage(state,type); + return MathJax.Callback.After(["process"+type,this,state],err.restart); + }, + + formatError: function (script,err) { + var LOCALIZE = function (id,text,arg1,arg2) {return MathJax.Localization._(id,text,arg1,arg2)}; + // + // Get the error message, URL, and line, and save it for + // reporting in the Show Math As Error menu + // + var message = LOCALIZE("ErrorMessage","Error: %1",err.message)+"\n"; + if (err.sourceURL||err.fileName) message += "\n"+LOCALIZE("ErrorFile","file: %1",err.sourceURL||err.fileName); + if (err.line||err.lineNumber) message += "\n"+LOCALIZE("ErrorLine","line: %1",err.line||err.lineNumber); + message += "\n\n"+LOCALIZE("ErrorTips","Debugging tips: use %1, inspect %2 in the browser console","'unpacked/MathJax.js'","'MathJax.Hub.lastError'"); + script.MathJax.error = MathJax.OutputJax.Error.Jax(message,script); + if (script.MathJax.elementJax) + script.MathJax.error.inputID = script.MathJax.elementJax.inputID; + // + // Create the [Math Processing Error] span + // + var errorSettings = this.config.errorSettings; + var errorText = LOCALIZE(errorSettings.messageId,errorSettings.message); + var error = MathJax.HTML.Element("span", { + className:"MathJax_Error", jaxID:"Error", isMathJax:true, + id: script.MathJax.error.inputID+"-Frame" + },[["span",null,errorText]]); + // + // Attach the menu events + // + MathJax.Ajax.Require("[MathJax]/extensions/MathEvents.js",function () { + var EVENT = MathJax.Extension.MathEvents.Event, + HUB = MathJax.Hub; + error.oncontextmenu = EVENT.Menu; + error.onmousedown = EVENT.Mousedown; + error.onkeydown = EVENT.Keydown; + error.tabIndex = HUB.getTabOrder(HUB.getJaxFor(script)); + }); + // + // Insert the error into the page and remove any preview + // + var node = document.getElementById(error.id); + if (node) node.parentNode.removeChild(node); + if (script.parentNode) script.parentNode.insertBefore(error,script); + if (script.MathJax.preview) { + script.MathJax.preview.innerHTML = ""; + script.MathJax.preview.style.display = "none"; + } + // + // Save the error for debugging purposes + // Report the error as a signal + // + this.lastError = err; + this.signal.Post(["Math Processing Error",script,err]); + }, + + RestartAfter: function (callback) { + throw this.Insert(Error("restart"),{restart: MathJax.Callback(callback)}); + }, + + elementCallback: function (element,callback) { + if (callback == null && (MathJax.Object.isArray(element) || typeof element === 'function')) + {try {MathJax.Callback(element); callback = element; element = null} catch(e) {}} + if (element == null) {element = this.config.elements || []} + if (this.isHTMLCollection(element)) {element = this.HTMLCollection2Array(element)} + if (!MathJax.Object.isArray(element)) {element = [element]} + element = [].concat(element); // make a copy so the original isn't changed + for (var i = 0, m = element.length; i < m; i++) + {if (typeof(element[i]) === 'string') {element[i] = document.getElementById(element[i])}} + if (!document.body) {document.body = document.getElementsByTagName("body")[0]} + if (element.length == 0) {element.push(document.body)} + if (!callback) {callback = {}} + return { + count: element.length, + elements: (element.length === 1 ? element[0] : element), + callback: callback + }; + }, + + elementScripts: function (element) { + var scripts = []; + if (MathJax.Object.isArray(element) || this.isHTMLCollection(element)) { + for (var i = 0, m = element.length; i < m; i++) { + var alreadyDone = 0; + for (var j = 0; j < i && !alreadyDone; j++) + {alreadyDone = element[j].contains(element[i])} + if (!alreadyDone) scripts.push.apply(scripts,this.elementScripts(element[i])); + } + return scripts; + } + if (typeof(element) === 'string') {element = document.getElementById(element)} + if (!document.body) {document.body = document.getElementsByTagName("body")[0]} + if (element == null) {element = document.body} + if (element.tagName != null && element.tagName.toLowerCase() === "script") {return [element]} + scripts = element.getElementsByTagName("script"); + if (this.msieHTMLCollectionBug) {scripts = this.HTMLCollection2Array(scripts)} + return scripts; + }, + + // + // IE8 fails to check "obj instanceof HTMLCollection" for some values of obj. + // + isHTMLCollection: function (obj) { + return ("HTMLCollection" in window && typeof(obj) === "object" && obj instanceof HTMLCollection); + }, + // + // IE8 doesn't deal with HTMLCollection as an array, so convert to array + // + HTMLCollection2Array: function (nodes) { + if (!this.msieHTMLCollectionBug) {return [].slice.call(nodes)} + var NODES = []; + for (var i = 0, m = nodes.length; i < m; i++) {NODES[i] = nodes[i]} + return NODES; + }, + + Insert: function (dst,src) { + for (var id in src) {if (src.hasOwnProperty(id)) { + // allow for concatenation of arrays? + if (typeof src[id] === 'object' && !(MathJax.Object.isArray(src[id])) && + (typeof dst[id] === 'object' || typeof dst[id] === 'function')) { + this.Insert(dst[id],src[id]); + } else { + dst[id] = src[id]; + } + }} + return dst; + }, + + getTabOrder: function(script) { + return this.config.menuSettings.inTabOrder ? 0 : -1; + }, + + // Old browsers (e.g. Internet Explorer <= 8) do not support trim(). + SplitList: ("trim" in String.prototype ? + function (list) {return list.trim().split(/\s+/)} : + function (list) {return list.replace(/^\s+/,''). + replace(/\s+$/,'').split(/\s+/)}) +}; +MathJax.Hub.Insert(MathJax.Hub.config.styles,MathJax.Message.styles); +MathJax.Hub.Insert(MathJax.Hub.config.styles,{".MathJax_Error":MathJax.Hub.config.errorSettings.style}); + +// +// Storage area for extensions and preprocessors +// +MathJax.Extension = {}; + +// +// Hub Startup code +// +MathJax.Hub.Configured = MathJax.Callback({}); // called when configuration is complete +MathJax.Hub.Startup = { + script: "", // the startup script from the SCRIPT call that loads MathJax.js + queue: MathJax.Callback.Queue(), // Queue used for startup actions + signal: MathJax.Callback.Signal("Startup"), // Signal used for startup events + params: {}, + + // + // Load the configuration files + // + Config: function () { + this.queue.Push(["Post",this.signal,"Begin Config"]); + // + // Make sure root is set before loading any files + // + if (MathJax.AuthorConfig && MathJax.AuthorConfig.root) + MathJax.Ajax.config.root = MathJax.AuthorConfig.root; + // + // If a locale is given as a parameter, + // set the locale and the default menu value for the locale + // + if (this.params.locale) { + MathJax.Localization.resetLocale(this.params.locale); + MathJax.Hub.config.menuSettings.locale = this.params.locale; + } + // + // Run the config files, if any are given in the parameter list + // + if (this.params.config) { + var files = this.params.config.split(/,/); + for (var i = 0, m = files.length; i < m; i++) { + if (!files[i].match(/\.js$/)) {files[i] += ".js"} + this.queue.Push(["Require",MathJax.Ajax,this.URL("config",files[i])]); + } + } + // + // Perform author configuration from in-line MathJax = {...} + // + this.queue.Push(["Config",MathJax.Hub,MathJax.AuthorConfig]); + // + // Run the deprecated configuration script, if any (ignoring return value) + // Wait for the startup delay signal + // Run the mathjax-config blocks + // Load the files in the configuration's config array + // + if (this.script.match(/\S/)) {this.queue.Push(this.script+";\n1;")} + this.queue.Push( + ["ConfigDelay",this], + ["ConfigBlocks",this], + [function (THIS) {return THIS.loadArray(MathJax.Hub.config.config,"config",null,true)},this], + ["Post",this.signal,"End Config"] + ); + }, + // + // Return the delay callback + // + ConfigDelay: function () { + var delay = this.params.delayStartupUntil || MathJax.Hub.config.delayStartupUntil; + if (delay === "onload") {return this.onload} + if (delay === "configured") {return MathJax.Hub.Configured} + return delay; + }, + // + // Run the scripts of type=text/x-mathjax-config + // + ConfigBlocks: function () { + var scripts = document.getElementsByTagName("script"); + var queue = MathJax.Callback.Queue(); + for (var i = 0, m = scripts.length; i < m; i++) { + var type = String(scripts[i].type).replace(/ /g,""); + if (type.match(/^text\/x-mathjax-config(;.*)?$/) && !type.match(/;executed=true/)) { + scripts[i].type += ";executed=true"; + queue.Push(scripts[i].innerHTML+";\n1;"); + } + } + return queue.Push(function () {MathJax.Ajax.config.root = MathJax.Hub.config.root}); + }, + + // + // Read cookie and set up menu defaults + // (set the locale according to the cookie) + // (adjust the jax to accommodate renderer preferences) + // + Cookie: function () { + return this.queue.Push( + ["Post",this.signal,"Begin Cookie"], + ["Get",MathJax.HTML.Cookie,"menu",MathJax.Hub.config.menuSettings], + [function (config) { + var SETTINGS = config.menuSettings; + if (SETTINGS.locale) MathJax.Localization.resetLocale(SETTINGS.locale); + var renderer = config.menuSettings.renderer, jax = config.jax; + if (renderer) { + var name = "output/"+renderer; jax.sort(); + for (var i = 0, m = jax.length; i < m; i++) { + if (jax[i].substr(0,7) === "output/") break; + } + if (i == m-1) {jax.pop()} else { + while (i < m) {if (jax[i] === name) {jax.splice(i,1); break}; i++} + } + jax.unshift(name); + } + if (SETTINGS.CHTMLpreview != null) { + if (SETTINGS.FastPreview == null) SETTINGS.FastPreview = SETTINGS.CHTMLpreview; + delete SETTINGS.CHTMLpreview; + } + if (SETTINGS.FastPreview && !MathJax.Extension["fast-preview"]) + MathJax.Hub.config.extensions.push("fast-preview.js"); + if (config.menuSettings.assistiveMML && !MathJax.Extension.AssistiveMML) + MathJax.Hub.config.extensions.push("AssistiveMML.js"); + },MathJax.Hub.config], + ["Post",this.signal,"End Cookie"] + ); + }, + // + // Setup stylesheets and extra styles + // + Styles: function () { + return this.queue.Push( + ["Post",this.signal,"Begin Styles"], + ["loadArray",this,MathJax.Hub.config.styleSheets,"config"], + ["Styles",MathJax.Ajax,MathJax.Hub.config.styles], + ["Post",this.signal,"End Styles"] + ); + }, + // + // Load the input and output jax + // + Jax: function () { + var config = MathJax.Hub.config, jax = MathJax.Hub.outputJax; + // Save the order of the output jax since they are loading asynchronously + for (var i = 0, m = config.jax.length, k = 0; i < m; i++) { + var name = config.jax[i].substr(7); + if (config.jax[i].substr(0,7) === "output/" && jax.order[name] == null) + {jax.order[name] = k; k++} + } + var queue = MathJax.Callback.Queue(); + return queue.Push( + ["Post",this.signal,"Begin Jax"], + ["loadArray",this,config.jax,"jax","config.js"], + ["Post",this.signal,"End Jax"] + ); + }, + // + // Load the extensions + // + Extensions: function () { + var queue = MathJax.Callback.Queue(); + return queue.Push( + ["Post",this.signal,"Begin Extensions"], + ["loadArray",this,MathJax.Hub.config.extensions,"extensions"], + ["Post",this.signal,"End Extensions"] + ); + }, + + // + // Initialize the Message system + // + Message: function () { + MathJax.Message.Init(true); + }, + + // + // Set the math menu renderer, if it isn't already + // (this must come after the jax are loaded) + // + Menu: function () { + var menu = MathJax.Hub.config.menuSettings, jax = MathJax.Hub.outputJax, registered; + for (var id in jax) {if (jax.hasOwnProperty(id)) { + if (jax[id].length) {registered = jax[id]; break} + }} + if (registered && registered.length) { + if (menu.renderer && menu.renderer !== registered[0].id) + {registered.unshift(MathJax.OutputJax[menu.renderer])} + menu.renderer = registered[0].id; + } + }, + + // + // Set the location to the designated hash position + // + Hash: function () { + if (MathJax.Hub.config.positionToHash && document.location.hash && + document.body && document.body.scrollIntoView) { + var name = decodeURIComponent(document.location.hash.substr(1)); + var target = document.getElementById(name); + if (!target) { + var a = document.getElementsByTagName("a"); + for (var i = 0, m = a.length; i < m; i++) + {if (a[i].name === name) {target = a[i]; break}} + } + if (target) { + while (!target.scrollIntoView) {target = target.parentNode} + target = this.HashCheck(target); + if (target && target.scrollIntoView) + {setTimeout(function () {target.scrollIntoView(true)},1)} + } + } + }, + HashCheck: function (target) { + var jax = MathJax.Hub.getJaxFor(target); + if (jax && MathJax.OutputJax[jax.outputJax].hashCheck) + {target = MathJax.OutputJax[jax.outputJax].hashCheck(target)} + return target; + }, + + // + // Load the Menu and Zoom code, if it hasn't already been loaded. + // This is called after the initial typeset, so should no longer be + // competing with other page loads, but will make these available + // if needed later on. + // + MenuZoom: function () { + if (MathJax.Hub.config.showMathMenu) { + if (!MathJax.Extension.MathMenu) { + setTimeout( + function () { + MathJax.Callback.Queue( + ["Require",MathJax.Ajax,"[MathJax]/extensions/MathMenu.js",{}], + ["loadDomain",MathJax.Localization,"MathMenu"] + ) + },1000 + ); + } else { + setTimeout( + MathJax.Callback(["loadDomain",MathJax.Localization,"MathMenu"]), + 1000 + ); + } + if (!MathJax.Extension.MathZoom) { + setTimeout( + MathJax.Callback(["Require",MathJax.Ajax,"[MathJax]/extensions/MathZoom.js",{}]), + 2000 + ); + } + } + }, + + // + // Setup the onload callback + // + onLoad: function () { + var onload = this.onload = + MathJax.Callback(function () {MathJax.Hub.Startup.signal.Post("onLoad")}); + if (document.body && document.readyState) + if (MathJax.Hub.Browser.isMSIE) { + // IE can change from loading to interactive before + // full page is ready, so go with complete (even though + // that means we may have to wait longer). + if (document.readyState === "complete") {return [onload]} + } else if (document.readyState !== "loading") {return [onload]} + if (window.addEventListener) { + window.addEventListener("load",onload,false); + if (!this.params.noDOMContentEvent) + {window.addEventListener("DOMContentLoaded",onload,false)} + } + else if (window.attachEvent) {window.attachEvent("onload",onload)} + else {window.onload = onload} + return onload; + }, + + // + // Perform the initial typesetting (or skip if configuration says to) + // + Typeset: function (element,callback) { + if (MathJax.Hub.config.skipStartupTypeset) {return function () {}} + return this.queue.Push( + ["Post",this.signal,"Begin Typeset"], + ["Typeset",MathJax.Hub,element,callback], + ["Post",this.signal,"End Typeset"] + ); + }, + + // + // Create a URL in the MathJax hierarchy + // + URL: function (dir,name) { + if (!name.match(/^([a-z]+:\/\/|\[|\/)/)) {name = "[MathJax]/"+dir+"/"+name} + return name; + }, + + // + // Load an array of files, waiting for all of them + // to be loaded before going on + // + loadArray: function (files,dir,name,synchronous) { + if (files) { + if (!MathJax.Object.isArray(files)) {files = [files]} + if (files.length) { + var queue = MathJax.Callback.Queue(), callback = {}, file; + for (var i = 0, m = files.length; i < m; i++) { + file = this.URL(dir,files[i]); + if (name) {file += "/" + name} + if (synchronous) {queue.Push(["Require",MathJax.Ajax,file,callback])} + else {queue.Push(MathJax.Ajax.Require(file,callback))} + } + return queue.Push({}); // wait for everything to finish + } + } + return null; + } + +}; + + +/**********************************************************/ + +(function (BASENAME) { + var BASE = window[BASENAME], ROOT = "["+BASENAME+"]"; + var HUB = BASE.Hub, AJAX = BASE.Ajax, CALLBACK = BASE.Callback; + + var JAX = MathJax.Object.Subclass({ + JAXFILE: "jax.js", + require: null, // array of files to load before jax.js is complete + config: {}, + // + // Make a subclass and return an instance of it. + // (FIXME: should we replace config with a copy of the constructor's + // config? Otherwise all subclasses share the same config structure.) + // + Init: function (def,cdef) { + if (arguments.length === 0) {return this} + return (this.constructor.Subclass(def,cdef))(); + }, + // + // Augment by merging with class definition (not replacing) + // + Augment: function (def,cdef) { + var cObject = this.constructor, ndef = {}; + if (def != null) { + for (var id in def) {if (def.hasOwnProperty(id)) { + if (typeof def[id] === "function") + {cObject.protoFunction(id,def[id])} else {ndef[id] = def[id]} + }} + // MSIE doesn't list toString even if it is not native so handle it separately + if (def.toString !== cObject.prototype.toString && def.toString !== {}.toString) + {cObject.protoFunction('toString',def.toString)} + } + HUB.Insert(cObject.prototype,ndef); + cObject.Augment(null,cdef); + return this; + }, + Translate: function (script,state) { + throw Error(this.directory+"/"+this.JAXFILE+" failed to define the Translate() method"); + }, + Register: function (mimetype) {}, + Config: function () { + this.config = HUB.CombineConfig(this.id,this.config); + if (this.config.Augment) {this.Augment(this.config.Augment)} + }, + Startup: function () {}, + loadComplete: function (file) { + if (file === "config.js") { + return AJAX.loadComplete(this.directory+"/"+file); + } else { + var queue = CALLBACK.Queue(); + queue.Push( + HUB.Register.StartupHook("End Config",{}), // wait until config complete + ["Post",HUB.Startup.signal,this.id+" Jax Config"], + ["Config",this], + ["Post",HUB.Startup.signal,this.id+" Jax Require"], + // Config may set the required and extensions array, + // so use functions to delay making the reference until needed + [function (THIS) {return MathJax.Hub.Startup.loadArray(THIS.require,this.directory)},this], + [function (config,id) {return MathJax.Hub.Startup.loadArray(config.extensions,"extensions/"+id)},this.config||{},this.id], + ["Post",HUB.Startup.signal,this.id+" Jax Startup"], + ["Startup",this], + ["Post",HUB.Startup.signal,this.id+" Jax Ready"] + ); + if (this.copyTranslate) { + queue.Push( + [function (THIS) { + THIS.preProcess = THIS.preTranslate; + THIS.Process = THIS.Translate; + THIS.postProcess = THIS.postTranslate; + },this.constructor.prototype] + ); + } + return queue.Push(["loadComplete",AJAX,this.directory+"/"+file]); + } + } + },{ + id: "Jax", + version: "2.7.9", + directory: ROOT+"/jax", + extensionDir: ROOT+"/extensions" + }); + + /***********************************/ + + BASE.InputJax = JAX.Subclass({ + elementJax: "mml", // the element jax to load for this input jax + sourceMenuTitle: /*_(MathMenu)*/ ["Original","Original Form"], + copyTranslate: true, + Process: function (script,state) { + var queue = CALLBACK.Queue(), file; + // Load any needed element jax + var jax = this.elementJax; if (!BASE.Object.isArray(jax)) {jax = [jax]} + for (var i = 0, m = jax.length; i < m; i++) { + file = BASE.ElementJax.directory+"/"+jax[i]+"/"+this.JAXFILE; + if (!this.require) {this.require = []} + else if (!BASE.Object.isArray(this.require)) {this.require = [this.require]}; + this.require.push(file); // so Startup will wait for it to be loaded + queue.Push(AJAX.Require(file)); + } + // Load the input jax + file = this.directory+"/"+this.JAXFILE; + var load = queue.Push(AJAX.Require(file)); + if (!load.called) { + this.constructor.prototype.Process = function () { + if (!load.called) {return load} + throw Error(file+" failed to load properly"); + } + } + // Load the associated output jax + jax = HUB.outputJax["jax/"+jax[0]]; + if (jax) {queue.Push(AJAX.Require(jax[0].directory+"/"+this.JAXFILE))} + return queue.Push({}); + }, + needsUpdate: function (jax) { + var script = jax.SourceElement(); + return (jax.originalText !== BASE.HTML.getScript(script)); + }, + Register: function (mimetype) { + if (!HUB.inputJax) {HUB.inputJax = {}} + HUB.inputJax[mimetype] = this; + } + },{ + id: "InputJax", + version: "2.7.9", + directory: JAX.directory+"/input", + extensionDir: JAX.extensionDir + }); + + /***********************************/ + + BASE.OutputJax = JAX.Subclass({ + copyTranslate: true, + preProcess: function (state) { + var load, file = this.directory+"/"+this.JAXFILE; + this.constructor.prototype.preProcess = function (state) { + if (!load.called) {return load} + throw Error(file+" failed to load properly"); + } + load = AJAX.Require(file); + return load; + }, + Process: function (state) {throw Error(this.id + " output jax failed to load properly")}, + Register: function (mimetype) { + var jax = HUB.outputJax; + if (!jax[mimetype]) {jax[mimetype] = []} + // If the output jax is earlier in the original configuration list, put it first here + if (jax[mimetype].length && (this.id === HUB.config.menuSettings.renderer || + (jax.order[this.id]||0) < (jax.order[jax[mimetype][0].id]||0))) + {jax[mimetype].unshift(this)} else {jax[mimetype].push(this)} + // Make sure the element jax is loaded before Startup is called + if (!this.require) {this.require = []} + else if (!BASE.Object.isArray(this.require)) {this.require = [this.require]}; + this.require.push(BASE.ElementJax.directory+"/"+(mimetype.split(/\//)[1])+"/"+this.JAXFILE); + }, + Remove: function (jax) {} + },{ + id: "OutputJax", + version: "2.7.9", + directory: JAX.directory+"/output", + extensionDir: JAX.extensionDir, + fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts", + imageDir: ROOT+(BASE.isPacked?"":"/..")+"/images" + }); + + /***********************************/ + + BASE.ElementJax = JAX.Subclass({ + // make a subclass, not an instance + Init: function (def,cdef) {return this.constructor.Subclass(def,cdef)}, + + inputJax: null, + outputJax: null, + inputID: null, + originalText: "", + mimeType: "", + sourceMenuTitle: /*_(MathMenu)*/ ["MathMLcode","MathML Code"], + + Text: function (text,callback) { + var script = this.SourceElement(); + BASE.HTML.setScript(script,text); + script.MathJax.state = this.STATE.UPDATE; + return HUB.Update(script,callback); + }, + Reprocess: function (callback) { + var script = this.SourceElement(); + script.MathJax.state = this.STATE.UPDATE; + return HUB.Reprocess(script,callback); + }, + Update: function (callback) {return this.Rerender(callback)}, + Rerender: function (callback) { + var script = this.SourceElement(); + script.MathJax.state = this.STATE.OUTPUT; + return HUB.Process(script,callback); + }, + Remove: function (keep) { + if (this.hover) {this.hover.clear(this)} + BASE.OutputJax[this.outputJax].Remove(this); + if (!keep) { + HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish? + this.Detach(); + } + }, + needsUpdate: function () { + return BASE.InputJax[this.inputJax].needsUpdate(this); + }, + + SourceElement: function () {return document.getElementById(this.inputID)}, + + Attach: function (script,inputJax) { + var jax = script.MathJax.elementJax; + if (script.MathJax.state === this.STATE.UPDATE) { + jax.Clone(this); + } else { + jax = script.MathJax.elementJax = this; + if (script.id) {this.inputID = script.id} + else {script.id = this.inputID = BASE.ElementJax.GetID(); this.newID = 1} + } + jax.originalText = BASE.HTML.getScript(script); + jax.inputJax = inputJax; + if (jax.root) {jax.root.inputID = jax.inputID} + return jax; + }, + Detach: function () { + var script = this.SourceElement(); if (!script) return; + try {delete script.MathJax} catch(err) {script.MathJax = null} + if (this.newID) {script.id = ""} + }, + Clone: function (jax) { + var id; + for (id in this) { + if (!this.hasOwnProperty(id)) continue; + if (typeof(jax[id]) === 'undefined' && id !== 'newID') {delete this[id]} + } + for (id in jax) { + if (!jax.hasOwnProperty(id)) continue; + if (typeof(this[id]) === 'undefined' || (this[id] !== jax[id] && id !== 'inputID')) + {this[id] = jax[id]} + } + } + },{ + id: "ElementJax", + version: "2.7.9", + directory: JAX.directory+"/element", + extensionDir: JAX.extensionDir, + ID: 0, // jax counter (for IDs) + STATE: { + PENDING: 1, // script is identified as math but not yet processed + PROCESSED: 2, // script has been processed + UPDATE: 3, // elementJax should be updated + OUTPUT: 4 // output should be updated (input is OK) + }, + + GetID: function () {this.ID++; return "MathJax-Element-"+this.ID}, + Subclass: function () { + var obj = JAX.Subclass.apply(this,arguments); + obj.loadComplete = this.prototype.loadComplete; + return obj; + } + }); + BASE.ElementJax.prototype.STATE = BASE.ElementJax.STATE; + + // + // Some "Fake" jax used to allow menu access for "Math Processing Error" messages + // + BASE.OutputJax.Error = { + id: "Error", version: "2.7.9", config: {}, errors: 0, + ContextMenu: function () {return BASE.Extension.MathEvents.Event.ContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)}, + Mousedown: function () {return BASE.Extension.MathEvents.Event.AltContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)}, + getJaxFromMath: function (math) {return (math.nextSibling.MathJax||{}).error}, + Jax: function (text,script) { + var jax = MathJax.Hub.inputJax[script.type.replace(/ *;(.|\s)*/,"")]; + this.errors++; + return { + inputJax: (jax||{id:"Error"}).id, // Use Error InputJax as fallback + outputJax: "Error", + inputID: "MathJax-Error-"+this.errors, + sourceMenuTitle: /*_(MathMenu)*/ ["ErrorMessage","Error Message"], + sourceMenuFormat: "Error", + originalText: MathJax.HTML.getScript(script), + errorText: text + } + } + }; + BASE.InputJax.Error = { + id: "Error", version: "2.7.9", config: {}, + sourceMenuTitle: /*_(MathMenu)*/ ["Original","Original Form"] + }; + +})("MathJax"); + +/**********************************************************/ + +(function (BASENAME) { + var BASE = window[BASENAME]; + if (!BASE) {BASE = window[BASENAME] = {}} + + var HUB = BASE.Hub; var STARTUP = HUB.Startup; var CONFIG = HUB.config; + var HEAD = document.head || (document.getElementsByTagName("head")[0]); + if (!HEAD) {HEAD = document.childNodes[0]}; + var scripts = (document.documentElement || document).getElementsByTagName("script"); + if (scripts.length === 0 && HEAD.namespaceURI) + scripts = document.getElementsByTagNameNS(HEAD.namespaceURI,"script"); + var namePattern = new RegExp("(^|/)"+BASENAME+"\\.js(\\?.*)?$"); + for (var i = scripts.length-1; i >= 0; i--) { + if ((scripts[i].src||"").match(namePattern)) { + STARTUP.script = scripts[i].innerHTML; + if (RegExp.$2) { + var params = RegExp.$2.substr(1).split(/\&/); + for (var j = 0, m = params.length; j < m; j++) { + var KV = params[j].match(/(.*)=(.*)/); + if (KV) {STARTUP.params[unescape(KV[1])] = unescape(KV[2])} + else {STARTUP.params[params[j]] = true} + } + } + CONFIG.root = scripts[i].src.replace(/(^|\/)[^\/]*(\?.*)?$/,''); + BASE.Ajax.config.root = CONFIG.root; + BASE.Ajax.params = STARTUP.params; + break; + } + } + + var AGENT = navigator.userAgent; + var BROWSERS = { + isMac: (navigator.platform.substr(0,3) === "Mac"), + isPC: (navigator.platform.substr(0,3) === "Win"), + isMSIE: ("ActiveXObject" in window && "clipboardData" in window), + isEdge: ("MSGestureEvent" in window && "chrome" in window && + window.chrome.loadTimes == null), + isFirefox: (!!AGENT.match(/Gecko\//) && !AGENT.match(/like Gecko/)), + isSafari: (!!AGENT.match(/ (Apple)?WebKit\//) && !AGENT.match(/ like iPhone /) && + (!window.chrome || window.chrome.app == null)), + isChrome: ("chrome" in window && window.chrome.loadTimes != null), + isOpera: ("opera" in window && window.opera.version != null), + isKonqueror: ("konqueror" in window && navigator.vendor == "KDE"), + versionAtLeast: function (v) { + var bv = (this.version).split('.'); v = (new String(v)).split('.'); + for (var i = 0, m = v.length; i < m; i++) + {if (bv[i] != v[i]) {return parseInt(bv[i]||"0") >= parseInt(v[i])}} + return true; + }, + Select: function (choices) { + var browser = choices[HUB.Browser]; + if (browser) {return browser(HUB.Browser)} + return null; + } + }; + + var xAGENT = AGENT + .replace(/^Mozilla\/(\d+\.)+\d+ /,"") // remove initial Mozilla, which is never right + .replace(/[a-z][-a-z0-9._: ]+\/\d+[^ ]*-[^ ]*\.([a-z][a-z])?\d+ /i,"") // remove linux version + .replace(/Gentoo |Ubuntu\/(\d+\.)*\d+ (\([^)]*\) )?/,""); // special case for these + + HUB.Browser = HUB.Insert(HUB.Insert(new String("Unknown"),{version: "0.0"}),BROWSERS); + for (var browser in BROWSERS) {if (BROWSERS.hasOwnProperty(browser)) { + if (BROWSERS[browser] && browser.substr(0,2) === "is") { + browser = browser.slice(2); + if (browser === "Mac" || browser === "PC") continue; + HUB.Browser = HUB.Insert(new String(browser),BROWSERS); + var VERSION = new RegExp( + ".*(Version/| Trident/.*; rv:)((?:\\d+\\.)+\\d+)|" + // for Safari, Opera10, and IE11+ + ".*("+browser+")"+(browser == "MSIE" ? " " : "/")+"((?:\\d+\\.)*\\d+)|"+ // for one of the main browsers + "(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)"); // for unrecognized browser + var MATCH = VERSION.exec(xAGENT) || ["","","","unknown","0.0"]; + HUB.Browser.name = (MATCH[1] != "" ? browser : (MATCH[3] || MATCH[5])); + HUB.Browser.version = MATCH[2] || MATCH[4] || MATCH[6]; + break; + } + }}; + + // + // Initial browser-specific info (e.g., touch up version or name, check for MathPlayer, etc.) + // Wrap in try/catch just in case of error (see issue #1155). + // + try {HUB.Browser.Select({ + Safari: function (browser) { + var v = parseInt((String(browser.version).split("."))[0]); + if (v > 85) {browser.webkit = browser.version} + if (v >= 538) {browser.version = "8.0"} + else if (v >= 537) {browser.version = "7.0"} + else if (v >= 536) {browser.version = "6.0"} + else if (v >= 534) {browser.version = "5.1"} + else if (v >= 533) {browser.version = "5.0"} + else if (v >= 526) {browser.version = "4.0"} + else if (v >= 525) {browser.version = "3.1"} + else if (v > 500) {browser.version = "3.0"} + else if (v > 400) {browser.version = "2.0"} + else if (v > 85) {browser.version = "1.0"} + browser.webkit = (navigator.appVersion.match(/WebKit\/(\d+)\./))[1]; + browser.isMobile = (navigator.appVersion.match(/Mobile/i) != null); + browser.noContextMenu = browser.isMobile; + }, + Firefox: function (browser) { + if ((browser.version === "0.0" || AGENT.match(/Firefox/) == null) && + navigator.product === "Gecko") { + var rv = AGENT.match(/[\/ ]rv:(\d+\.\d.*?)[\) ]/); + if (rv) {browser.version = rv[1]} + else { + var date = (navigator.buildID||navigator.productSub||"0").substr(0,8); + if (date >= "20111220") {browser.version = "9.0"} + else if (date >= "20111120") {browser.version = "8.0"} + else if (date >= "20110927") {browser.version = "7.0"} + else if (date >= "20110816") {browser.version = "6.0"} + else if (date >= "20110621") {browser.version = "5.0"} + else if (date >= "20110320") {browser.version = "4.0"} + else if (date >= "20100121") {browser.version = "3.6"} + else if (date >= "20090630") {browser.version = "3.5"} + else if (date >= "20080617") {browser.version = "3.0"} + else if (date >= "20061024") {browser.version = "2.0"} + } + } + browser.isMobile = (navigator.appVersion.match(/Android/i) != null || + AGENT.match(/ Fennec\//) != null || + AGENT.match(/Mobile/) != null); + }, + Chrome: function (browser) { + browser.noContextMenu = browser.isMobile = !!navigator.userAgent.match(/ Mobile[ \/]/); + }, + Opera: function (browser) {browser.version = opera.version()}, + Edge: function (browser) { + browser.isMobile = !!navigator.userAgent.match(/ Phone/); + }, + MSIE: function (browser) { + browser.isMobile = !!navigator.userAgent.match(/ Phone/); + browser.isIE9 = !!(document.documentMode && (window.performance || window.msPerformance)); + MathJax.HTML.setScriptBug = !browser.isIE9 || document.documentMode < 9; + MathJax.Hub.msieHTMLCollectionBug = (document.documentMode < 9); + // + // MathPlayer doesn't function properly in IE10, and not at all in IE11, + // so don't even try to load it. + // + if (document.documentMode < 10 && !STARTUP.params.NoMathPlayer) { + try { + new ActiveXObject("MathPlayer.Factory.1"); + browser.hasMathPlayer = true; + } catch (err) {} + try { + if (browser.hasMathPlayer) { + var mathplayer = document.createElement("object"); + mathplayer.id = "mathplayer"; mathplayer.classid = "clsid:32F66A20-7614-11D4-BD11-00104BD3F987"; + HEAD.appendChild(mathplayer); + document.namespaces.add("m","http://www.w3.org/1998/Math/MathML"); + browser.mpNamespace = true; + if (document.readyState && (document.readyState === "loading" || + document.readyState === "interactive")) { + document.write(''); + browser.mpImported = true; + } + } else { + // Adding any namespace avoids a crash in IE9 in IE9-standards mode + // (any reference to document.namespaces before document.readyState is + // "complete" causes an "unspecified error" to be thrown) + document.namespaces.add("mjx_IE_fix","http://www.w3.org/1999/xlink"); + } + } catch (err) {} + } + } + });} catch (err) { + console.error(err.message); + } + HUB.Browser.Select(MathJax.Message.browsers); + + if (BASE.AuthorConfig && typeof BASE.AuthorConfig.AuthorInit === "function") {BASE.AuthorConfig.AuthorInit()} + HUB.queue = BASE.Callback.Queue(); + HUB.queue.Push( + ["Post",STARTUP.signal,"Begin"], + ["Config",STARTUP], + ["Cookie",STARTUP], + ["Styles",STARTUP], + ["Message",STARTUP], + function () { + // Do Jax and Extensions in parallel, but wait for them all to complete + var queue = BASE.Callback.Queue( + STARTUP.Jax(), + STARTUP.Extensions() + ); + return queue.Push({}); + }, + ["Menu",STARTUP], + STARTUP.onLoad(), + function () {MathJax.isReady = true}, // indicates that MathJax is ready to process math + ["Typeset",STARTUP], + ["Hash",STARTUP], + ["MenuZoom",STARTUP], + ["Post",STARTUP.signal,"End"] + ); + +})("MathJax"); + +}} +// @license-end diff --git a/js/mathjax/config/AM_CHTML-full.js b/js/mathjax/config/AM_CHTML-full.js new file mode 100644 index 0000000..ea12eca --- /dev/null +++ b/js/mathjax/config/AM_CHTML-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_CHTML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_CHTML-full.js"); +// @license-end diff --git a/js/mathjax/config/AM_CHTML.js b/js/mathjax/config/AM_CHTML.js new file mode 100644 index 0000000..4c26daa --- /dev/null +++ b/js/mathjax/config/AM_CHTML.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_CHTML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_CHTML.js"); +// @license-end diff --git a/js/mathjax/config/AM_HTMLorMML-full.js b/js/mathjax/config/AM_HTMLorMML-full.js new file mode 100644 index 0000000..bf556a8 --- /dev/null +++ b/js/mathjax/config/AM_HTMLorMML-full.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_HTMLorMML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_HTMLorMML-full.js"); +// @license-end diff --git a/js/mathjax/config/AM_HTMLorMML.js b/js/mathjax/config/AM_HTMLorMML.js new file mode 100644 index 0000000..20fdfe7 --- /dev/null +++ b/js/mathjax/config/AM_HTMLorMML.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_HTMLorMML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_HTMLorMML.js"); +// @license-end diff --git a/js/mathjax/config/AM_SVG-full.js b/js/mathjax/config/AM_SVG-full.js new file mode 100644 index 0000000..59fdf75 --- /dev/null +++ b/js/mathjax/config/AM_SVG-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_SVG-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_SVG-full.js"); +// @license-end diff --git a/js/mathjax/config/AM_SVG.js b/js/mathjax/config/AM_SVG.js new file mode 100644 index 0000000..4518437 --- /dev/null +++ b/js/mathjax/config/AM_SVG.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/AM_SVG.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/AsciiMath","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/AM_SVG.js"); +// @license-end diff --git a/js/mathjax/config/Accessible-full.js b/js/mathjax/config/Accessible-full.js new file mode 100644 index 0000000..c290bbd --- /dev/null +++ b/js/mathjax/config/Accessible-full.js @@ -0,0 +1,32 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/Accessible-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"], + menuSettings: { + zoom: "Double-Click", + mpContext: true, + mpMouse: true + }, + errorSettings: { + message: ["[",["MathError","Math Error"],"]"] + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/Accessible-full.js"); +// @license-end diff --git a/js/mathjax/config/Accessible.js b/js/mathjax/config/Accessible.js new file mode 100644 index 0000000..107e253 --- /dev/null +++ b/js/mathjax/config/Accessible.js @@ -0,0 +1,32 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/Accessible.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"], + menuSettings: { + zoom: "Double-Click", + mpContext: true, + mpMouse: true + }, + errorSettings: { + message: ["[",["MathError","Math Error"],"]"] + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/Accessible.js"); +// @license-end diff --git a/js/mathjax/config/MML_CHTML-full.js b/js/mathjax/config/MML_CHTML-full.js new file mode 100644 index 0000000..aad2211 --- /dev/null +++ b/js/mathjax/config/MML_CHTML-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_CHTML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_CHTML-full.js"); +// @license-end diff --git a/js/mathjax/config/MML_CHTML.js b/js/mathjax/config/MML_CHTML.js new file mode 100644 index 0000000..696a891 --- /dev/null +++ b/js/mathjax/config/MML_CHTML.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_CHTML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_CHTML.js"); +// @license-end diff --git a/js/mathjax/config/MML_HTMLorMML-full.js b/js/mathjax/config/MML_HTMLorMML-full.js new file mode 100644 index 0000000..3a7debf --- /dev/null +++ b/js/mathjax/config/MML_HTMLorMML-full.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_HTMLorMML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_HTMLorMML-full.js"); +// @license-end diff --git a/js/mathjax/config/MML_HTMLorMML.js b/js/mathjax/config/MML_HTMLorMML.js new file mode 100644 index 0000000..c688e4c --- /dev/null +++ b/js/mathjax/config/MML_HTMLorMML.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_HTMLorMML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_HTMLorMML.js"); +// @license-end diff --git a/js/mathjax/config/MML_SVG-full.js b/js/mathjax/config/MML_SVG-full.js new file mode 100644 index 0000000..ab6719e --- /dev/null +++ b/js/mathjax/config/MML_SVG-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_SVG-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_SVG-full.js"); +// @license-end diff --git a/js/mathjax/config/MML_SVG.js b/js/mathjax/config/MML_SVG.js new file mode 100644 index 0000000..013e183 --- /dev/null +++ b/js/mathjax/config/MML_SVG.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/MML_SVG.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/MathML","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/MML_SVG.js"); +// @license-end diff --git a/js/mathjax/config/MMLorHTML.js b/js/mathjax/config/MMLorHTML.js new file mode 100644 index 0000000..03f4d3b --- /dev/null +++ b/js/mathjax/config/MMLorHTML.js @@ -0,0 +1,113 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/config/MMLorHTML.js + * + * Chooses between the NativeMML and HTML-CSS output jax depending + * on the capabilities of the browser and configuration settings + * of the page. + * + * This file should be added to the config array when configuring + * MathJax. Note that if you include this, you should NOT include + * an output jax in the jax array (it will be added for you by + * this file). + * + * You can specify the preferred output jax on a global or + * browser-by-browser basis. To specify it globally, use + * + * MathJax.Hub.Config({ + * MMLorHTML: {prefer: "MML"} // or "HTML" + * }); + * + * To specify on a browser-by-borwser basis, use + * + * MathJax.Hub.Config({ + * MMLorHTML: {prefer: { + * MSIE: "MML", + * Firefox: "MML", + * Opera: "HTML", + * other: "HTML" + * }} + * }); + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,BROWSER) { + var VERSION = "2.7.0"; + + var CONFIG = MathJax.Hub.CombineConfig("MMLorHTML",{ + prefer: { + MSIE:"MML", + Firefox:"HTML", + Opera:"HTML", + Chrome:"HTML", + Safari:"HTML", + other:"HTML" + } + }); + + var MINBROWSERVERSION = { + Firefox: 3.0, + Opera: 9.52, + MSIE: 6.0, + Chrome: 0.3, + Safari: 2.0, + Konqueror: 4.0 + }; + + var canUseHTML = (BROWSER.version === "0.0" || + BROWSER.versionAtLeast(MINBROWSERVERSION[BROWSER]||0.0)); + + var canUseMML = (BROWSER.isFirefox && BROWSER.versionAtLeast("1.5")) || + (BROWSER.isMSIE && BROWSER.hasMathPlayer) || + (BROWSER.isSafari && BROWSER.versionAtLeast("5.0")) || + (BROWSER.isOpera && BROWSER.versionAtLeast("9.52")); + + HUB.Register.StartupHook("End Config",function () { + var prefer = (CONFIG.prefer && typeof(CONFIG.prefer) === "object" ? + CONFIG.prefer[MathJax.Hub.Browser]||CONFIG.prefer.other||"HTML" : + CONFIG.prefer); + + if (canUseHTML || canUseMML) { + if (canUseMML && (prefer === "MML" || !canUseHTML)) { + if (MathJax.OutputJax.NativeMML) {MathJax.OutputJax.NativeMML.Register("jax/mml")} + else {HUB.config.jax.unshift("output/NativeMML")} + HUB.Startup.signal.Post("NativeMML output selected"); + } else { + if (MathJax.OutputJax["HTML-CSS"]) {MathJax.OutputJax["HTML-CSS"].Register("jax/mml")} + else {HUB.config.jax.unshift("output/HTML-CSS")} + HUB.Startup.signal.Post("HTML-CSS output selected"); + } + } else { + HUB.PreProcess.disabled = true; + HUB.prepareScripts.disabled = true; + MathJax.Message.Set( + ["MathJaxNotSupported","Your browser does not support MathJax"], + null,4000 + ); + HUB.Startup.signal.Post("MathJax not supported"); + } + }); + +})(MathJax.Hub,MathJax.Hub.Browser); + +MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js"); +// @license-end diff --git a/js/mathjax/config/Safe.js b/js/mathjax/config/Safe.js new file mode 100644 index 0000000..5d28b20 --- /dev/null +++ b/js/mathjax/config/Safe.js @@ -0,0 +1,39 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/config/Safe.js + * + * Allows you to load the Safe extension as part of the config list + * when you load MathJax.js, e.g. + * + * + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("End Config", function () { + if (!MathJax.Hub.config.extensions) {MathJax.Hub.config.extensions = []} + MathJax.Hub.config.extensions.push("Safe.js"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/Safe.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS-MML_HTMLorMML-full.js b/js/mathjax/config/TeX-AMS-MML_HTMLorMML-full.js new file mode 100644 index 0000000..22e1c87 --- /dev/null +++ b/js/mathjax/config/TeX-AMS-MML_HTMLorMML-full.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS-MML_HTMLorMML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-MML_HTMLorMML-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS-MML_HTMLorMML.js b/js/mathjax/config/TeX-AMS-MML_HTMLorMML.js new file mode 100644 index 0000000..2b8e53d --- /dev/null +++ b/js/mathjax/config/TeX-AMS-MML_HTMLorMML.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS-MML_HTMLorMML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-MML_HTMLorMML.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS-MML_SVG-full.js b/js/mathjax/config/TeX-AMS-MML_SVG-full.js new file mode 100644 index 0000000..990c540 --- /dev/null +++ b/js/mathjax/config/TeX-AMS-MML_SVG-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS-MML_SVG-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-MML_SVG-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS-MML_SVG.js b/js/mathjax/config/TeX-AMS-MML_SVG.js new file mode 100644 index 0000000..c14d2ca --- /dev/null +++ b/js/mathjax/config/TeX-AMS-MML_SVG.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS-MML_SVG.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-MML_SVG.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_CHTML-full.js b/js/mathjax/config/TeX-AMS_CHTML-full.js new file mode 100644 index 0000000..001b142 --- /dev/null +++ b/js/mathjax/config/TeX-AMS_CHTML-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_CHTML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_CHTML-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_CHTML.js b/js/mathjax/config/TeX-AMS_CHTML.js new file mode 100644 index 0000000..8598c4c --- /dev/null +++ b/js/mathjax/config/TeX-AMS_CHTML.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_CHTML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_CHTML.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_HTML-full.js b/js/mathjax/config/TeX-AMS_HTML-full.js new file mode 100644 index 0000000..74c6c04 --- /dev/null +++ b/js/mathjax/config/TeX-AMS_HTML-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_HTML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/HTML-CSS","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_HTML-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_HTML.js b/js/mathjax/config/TeX-AMS_HTML.js new file mode 100644 index 0000000..81c77a5 --- /dev/null +++ b/js/mathjax/config/TeX-AMS_HTML.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_HTML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/HTML-CSS","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_HTML.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_SVG-full.js b/js/mathjax/config/TeX-AMS_SVG-full.js new file mode 100644 index 0000000..1354106 --- /dev/null +++ b/js/mathjax/config/TeX-AMS_SVG-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_SVG-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_SVG-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-AMS_SVG.js b/js/mathjax/config/TeX-AMS_SVG.js new file mode 100644 index 0000000..ff45062 --- /dev/null +++ b/js/mathjax/config/TeX-AMS_SVG.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-AMS_SVG.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_SVG.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_CHTML-full.js b/js/mathjax/config/TeX-MML-AM_CHTML-full.js new file mode 100644 index 0000000..553f4dc --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_CHTML-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_CHTML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_CHTML-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_CHTML.js b/js/mathjax/config/TeX-MML-AM_CHTML.js new file mode 100644 index 0000000..7ea2ca4 --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_CHTML.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_CHTML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/CommonHTML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_CHTML.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_HTMLorMML-full.js b/js/mathjax/config/TeX-MML-AM_HTMLorMML-full.js new file mode 100644 index 0000000..51fcb3b --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_HTMLorMML-full.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_HTMLorMML-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_HTMLorMML-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_HTMLorMML.js b/js/mathjax/config/TeX-MML-AM_HTMLorMML.js new file mode 100644 index 0000000..3bdf4d2 --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_HTMLorMML.js @@ -0,0 +1,24 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_HTMLorMML.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + config: ["MMLorHTML.js"], + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/HTML-CSS","output/NativeMML","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_HTMLorMML.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_SVG-full.js b/js/mathjax/config/TeX-MML-AM_SVG-full.js new file mode 100644 index 0000000..1896f2e --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_SVG-full.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_SVG-full.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_SVG-full.js"); +// @license-end diff --git a/js/mathjax/config/TeX-MML-AM_SVG.js b/js/mathjax/config/TeX-MML-AM_SVG.js new file mode 100644 index 0000000..4db79bd --- /dev/null +++ b/js/mathjax/config/TeX-MML-AM_SVG.js @@ -0,0 +1,23 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * /MathJax/unpacked/config/TeX-MML-AM_SVG.js + * + * Copyright (c) 2010-2018 The MathJax Consortium + * + * Part of the MathJax library. + * See http://www.mathjax.org for details. + * + * Licensed under the Apache License, Version 2.0; + * you may not use this file except in compliance with the License. + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +MathJax.Hub.Config({ + extensions: ["tex2jax.js","mml2jax.js","asciimath2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js","TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js","fast-preview.js","AssistiveMML.js","[a11y]/accessibility-menu.js"], + jax: ["input/TeX","input/MathML","input/AsciiMath","output/SVG","output/PreviewHTML"] +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/TeX-MML-AM_SVG.js"); +// @license-end diff --git a/js/mathjax/config/default.js b/js/mathjax/config/default.js new file mode 100644 index 0000000..ba74db2 --- /dev/null +++ b/js/mathjax/config/default.js @@ -0,0 +1,1106 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/config/default.js + * + * This configuration file is loaded when you load MathJax + * via + * + * Use it to customize the MathJax settings. See comments below. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/* + * This file lists most, but not all, of the options that can be set for + * MathJax and its various components. Some additional options are + * available, however, and are listed in the various links at: + * + * http://www.mathjax.org/resources/docs/?configuration.html#configuration-options-by-component + * + * You can add these to the configuration object below if you + * want to change them from their default values. + */ + +MathJax.Hub.Config({ + + // + // A comma-separated list of configuration files to load + // when MathJax starts up. E.g., to define local macros, etc. + // The default directory is the MathJax/config directory. + // + // Example: config: ["local/local.js"], + // Example: config: ["local/local.js","MMLtoHTML.js"], + // + config: [], + + // + // A comma-separated list of CSS stylesheet files to be loaded + // when MathJax starts up. The default directory is the + // MathJax/config directory. + // + // Example: styleSheets: ["MathJax.css"], + // + styleSheets: [], + + // + // Styles to be defined dynamically at startup time. + // + // Example: + // styles: { + // ".MathJax_Preview": { + // color: "#888" + // } + // }, + // + styles: {}, + + // + // A comma-separated list of input and output jax to initialize at startup. + // Their main code is loaded only when they are actually used, so it is not + // inefficient to include jax that may not actually be used on the page. These + // are found in the MathJax/jax directory. The choices include + // + // input/TeX + // input/MathML + // input/AsciiMath + // + // output/HTML-CSS + // output/NativeMML + // output/SVG + // + // If you change the input jax, you may need to include the appropriate + // preprocessor in the extensions array below. + // + jax: ["input/TeX", "output/HTML-CSS"], + + // + // A comma-separated list of extensions to load at startup. The default + // directory is MathJax/extensions. + // + // Example: extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"], + // + // You may wish to include "mml2jax.js" if you are using "input/MathML" in the + // jax array above, and "asciimath2jax.js" if you using "input/AsciiMath". + // Include "jsmath2jax.js" if you are converting from using jsMath to MathJax. + // + extensions: ["tex2jax.js"], + + // + // Patterns to remove from before and after math script tags. If you are not + // using one of the preprocessors (e.g., tex2jax), you need to insert something + // extra into your HTML file in order to avoid a bug in Internet Explorer. IE + // removes spaces from the DOM that it thinks are redundent, and since a SCRIPT + // tag usually doesn't add content to the page, if there is a space before and after + // a MathJax SCRIPT tag, IE will remove the first space. When MathJax inserts + // the typeset mathematics, this means there will be no space before it and the + // preceding text. In order to avoid this, you should include some "guard characters" + // before or after the math SCRIPT tag; define the patterns you want to use below. + // Note that these are used as regular expressions, so you will need to quote + // special characters. Furthermore, since they are javascript strings, you must + // quote javascript special characters as well. So to obtain a backslash, you must + // use \\ (doubled for javascript). For example, "\\[" is the pattern \[ in the + // regular expression. That means that if you want an actual backslash in your + // guard characters, you need to use "\\\\" in order to get \\ in the regular + // expression, and \ in the actual text. If both preJax and postJax are defined, + // both must be present in order to be removed. + // + // See also the preRemoveClass comments below. + // + // Example: + // preJax: "\\\\\\\\", // makes a double backslash the preJax text + // or + // preJax: "\\[\\[", // jax scripts must be enclosed in double brackets + // postJax: "\\]\\]", + // + preJax: null, + postJax: null, + + // + // The CSS class for a math preview to be removed preceding a MathJax + // SCRIPT tag. If the tag just before the MathJax SCRIPT tag is of this + // class, its contents are removed when MathJax processes the SCRIPT + // tag. This allows you to include a math preview in a form that will + // be displayed prior to MathJax performing its typesetting. It also + // avoids the Internet Explorer space-removal bug, and can be used in + // place of preJax and postJax if that is more convenient. + // + // For example + // + // [math] + // + // would display "[math]" in place of the math until MathJax is able to typeset it. + // + preRemoveClass: "MathJax_Preview", + + // + // This value controls whether the "Processing Math: nn%" message are displayed + // in the lower left-hand corner. Set to "false" to prevent those messages (though + // file loading and other messages will still be shown). + // + showProcessingMessages: true, + + // + // This value controls the verbosity of the messages in the lower left-hand corner. + // Set it to "none" to eliminate all messages, or set it to "simple" to show + // "Loading..." and "Processing..." rather than showing the full file name and the + // percentage of the mathematics processed. + // + messageStyle: "normal", + + // + // These two parameters control the alignment and shifting of displayed equations. + // The first can be "left", "center", or "right", and determines the alignment of + // displayed equations. When the alignment is not "center", the second determines + // an indentation from the left or right side for the displayed equations. When + // the alignment is "center", the indent allows you to shift the center to the right + // or left (negative is left). + // + displayAlign: "center", + displayIndent: "0", + + // + // Normally MathJax will perform its starup commands (loading of + // configuration, styles, jax, and so on) as soon as it can. If you + // expect to be doing additional configuration on the page, however, you + // may want to have it wait until the page's onload hander is called. If so, + // set this to "onload". + // + delayStartupUntil: "none", + + // + // Normally MathJax will typeset the mathematics on the page as soon as + // the page is loaded. If you want to delay that process, in which case + // you will need to call MathJax.Hub.Typeset() yourself by hand, set + // this value to true. + // + skipStartupTypeset: false, + + // + // A list of element ID's that are the ones to process for mathematics + // when any of the Hub typesetting calls (Typeset, Process, Update, etc) + // are called with no element specified. This lets you restrict the + // processing to particular containers rather than scanning the entire + // document for mathematics. If none are supplied, the entire document + // is processed. + // + elements: [], + + // + // Since typesetting usually changes the vertical dimensions of the + // page, if the URL contains an anchor position you may no longer be + // positioned at the correct position on the page, so MathJax can + // reposition to that location after it completes its initial + // typesetting of the page. This value controls whether MathJax will + // reposition the browser to the #hash location from the page URL after + // typesetting for the page. + // + positionToHash: true, + + // + // These control whether to attach the MathJax contextual menu to the + // expressions typeset by MathJax. Since the code for handling + // MathPlayer in Internet Explorer is somewhat delicate, it is + // controlled separately via (showMathMenuMSIE). The latter is now + // deprecated in favor of the MathJax contextual menu settings for + // MathPlayer. + // + // These values used to be listed in the separate output jax, but + // have been moved to this more central location since they are shared + // by all output jax. + // + showMathMenu: true, + showMathMenuMSIE: true, + + + // + // The default settings for the MathJax contextual menu (overridden by + // the MathJax cookie when users change the menu settings). + // + menuSettings: { + zoom: "None", // when to do MathZoom + CTRL: false, // require CTRL for MathZoom? + ALT: false, // require Alt or Option? + CMD: false, // require CMD? + Shift: false, // require Shift? + discoverable: false, // make math menu discoverable on hover? + zscale: "200%", // the scaling factor for MathZoom + renderer: null, // set when Jax are loaded + font: "Auto", // what font HTML-CSS should use + context: "MathJax", // or "Browser" for pass-through to browser menu + locale: null, // the language to use for messages + mpContext: false, // true means pass menu events to MathPlayer in IE + mpMouse: false, // true means pass mouse events to MathPlayer in IE + texHints: true, // include class names for TeXAtom elements + FastPreview: null, // use PreviewHTML output as preview? + assistiveMML: null, // include hidden MathML for screen readers? + inTabOrder: true, // set to true if math elements should be included in the tabindex + semantics: false // add semantics tag with original form in MathML output + }, + + // + // The message and style for when there is a processing error handling + // the mathematics (something has gone wrong with the input or output + // jax that prevents it from operating properly). + // + errorSettings: { + message: ["[",["MathProcessingError","Math Processing Error"],"]"], + style: {color: "#CC0000", "font-style":"italic"} // style for message + }, + + + //============================================================================ + // + // These parameters control the tex2jax preprocessor (when you have included + // "tex2jax.js" in the extensions list above). + // + tex2jax: { + + // + // The delimiters that surround in-line math expressions. The first in each + // pair is the initial delimiter and the second is the terminal delimiter. + // Comment out any that you don't want, but be sure there is no extra + // comma at the end of the last item in the list -- some browsers won't + // be able to handle that. + // + inlineMath: [ +// ['$','$'], // uncomment this for standard TeX math delimiters + ['\\(','\\)'] + ], + + // + // The delimiters that surround displayed math expressions. The first in each + // pair is the initial delimiter and the second is the terminal delimiter. + // Comment out any that you don't want, but be sure there is no extra + // comma at the end of the last item in the list -- some browsers won't + // be able to handle that. + // + displayMath: [ + ['$$','$$'], + ['\\[','\\]'] + ], + + // + // This array lists the names of the tags whose contents should not be + // processed by tex2jax (other than to look for ignore/process classes + // as listed below). You can add to (or remove from) this list to prevent + // MathJax from processing mathematics in specific contexts. + // + skipTags: ["script","noscript","style","textarea","pre","code","annotation","annotation-xml"], + + // + // This is the class name used to mark elements whose contents should + // not be processed by tex2jax (other than to look for the + // processClass pattern below). Note that this is a regular + // expression, and so you need to be sure to quote any regexp special + // characters. The pattern is automatically preceded by '(^| )(' and + // followed by ')( |$)', so your pattern will have to match full words + // in the class name. Assigning an element this class name will + // prevent `tex2jax` from processing its contents. + // + ignoreClass: "tex2jax_ignore", + + // + // This is the class name used to mark elements whose contents SHOULD + // be processed by tex2jax. This is used to turn on processing within + // tags that have been marked as ignored or skipped above. Note that + // this is a regular expression, and so you need to be sure to quote + // any regexp special characters. The pattern is automatically + // preceded by '(^| )(' and followed by ')( |$)', so your pattern + // will have to match full words in the class name. Use this to + // restart processing within an element that has been marked as + // ignored above. + // + processClass: "tex2jax_process", + + // + // Set to "true" to allow \$ to produce a dollar without starting in-line + // math mode. If you uncomment the ['$','$'] line above, you should change + // this to true so that you can insert plain dollar signs into your documents + // + processEscapes: false, + + // + // Controls whether tex2jax processes LaTeX environments outside of math + // mode. Set to "false" to prevent processing of environments except within + // math mode. + // + processEnvironments: true, + + // + // Controls whether tex2jax processes \ref{...} commands outside + // of math mode. Set to "false" to prevent processing of \ref + // except within math mode. + // + processRefs: true, + + // + // Controls whether tex2jax inserts MathJax_Preview spans to make a + // preview available, and what preview to use, when it locates in-line + // and display mathetics on the page. The default is "TeX", which + // means use the TeX code as the preview (until it is processed by + // MathJax). Set to "none" to prevent the previews from being + // inserted (the math will simply disappear until it is typeset). Set + // to an array containing the description of an HTML snippet in order + // to use the same preview for all equations on the page (e.g., you + // could have it say "[math]" or load an image). + // + // E.g., preview: ["[math]"], + // or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]] + // + preview: "TeX" + + }, + + //============================================================================ + // + // These parameters control the asciimath2jax preprocessor (when you have included + // "asciimath2jax.js" in the extensions list above). + // + asciimath2jax: { + + // + // The delimiters that surround asciimath expressions. The first in each + // pair is the initial delimiter and the second is the terminal delimiter. + // + delimiters: [ + ['`','`'] + ], + + // + // This array lists the names of the tags whose contents should not be + // processed by asciimath2jax (other than to look for ignore/process classes + // as listed below). You can add to (or remove from) this list to prevent + // MathJax from processing mathematics in specific contexts. + // + skipTags: ["script","noscript","style","textarea","pre","code","annotation","annotation-xml"], + + // + // This is the class name used to mark elements whose contents should + // not be processed by asciimath2jax (other than to look for the + // processClass pattern below). Note that this is a regular + // expression, and so you need to be sure to quote any regexp special + // characters. The pattern is automatically preceded by '(^| )(' and + // followed by ')( |$)', so your pattern will have to match full words + // in the class name. Assigning an element this class name will + // prevent `asciimath2jax` from processing its contents. + // + ignoreClass: "asciimath2jax_ignore", + + // + // This is the class name used to mark elements whose contents SHOULD + // be processed by asciimath2jax. This is used to turn on processing + // within tags that have been marked as ignored or skipped above. + // Note that this is a regular expression, and so you need to be sure + // to quote any regexp special characters. The pattern is + // automatically preceded by '(^| )(' and followed by ')( |$)', so + // your pattern will have to match full words in the class name. Use + // this to restart processing within an element that has been marked + // as ignored above. + // + processClass: "asciimath2jax_process", + + // Controls whether asciimath2jax inserts MathJax_Preview spans to make a + // preview available, and what preview to use, when it locates in-line + // and display mathetics on the page. The default is "AsciiMath", which + // means use the AsciiMath code as the preview (until it is processed by + // MathJax). Set to "none" to prevent the previews from being + // inserted (the math will simply disappear until it is typeset). Set + // to an array containing the description of an HTML snippet in order + // to use the same preview for all equations on the page (e.g., you + // could have it say "[math]" or load an image). + // + // E.g., preview: ["[math]"], + // or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]] + // + preview: "AsciiMath" + + }, + + //============================================================================ + // + // These parameters control the mml2jax preprocessor (when you have included + // "mml2jax.js" in the extensions list above). + // + mml2jax: { + + // + // Controls whether mml2jax inserts MathJax_Preview spans to make a + // preview available, and what preview to use, when it locates + // mathematics on the page. The default is "mathml" which means use + // the tag as the preview (until it is processed by MathJax). + // Set to "alttext", to use the tag's alttext attribute as the + // preview, if the tag has one. Set to "none" to + // prevent the previews from being inserted (the math will simply + // disappear until it is typeset). Set to "altimg" to use an image + // described by the altimg* attributes of the element. + // Set to an array containing the + // description of an HTML snippet in order to use the same preview for + // all equations on the page (e.g., you could have it say "[math]" or + // load an image). + // + // E.g., preview: ["[math]"], + // or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]] + // + preview: "mathml" + + }, + + //============================================================================ + // + // These parameters control the jsMath2jax preprocessor (when you have included + // "jsMath2jax.js" in the extensions list above). + // + jsMath2jax: { + + // + // Controls whether jsMath2jax inserts MathJax_Preview spans to make a + // preview available, and what preview to use, when it locates + // mathematics on the page. The default is "TeX", which means use the + // TeX code as the preview (until it is processed by MathJax). Set to + // "none" to prevent the previews from being inserted (the math will + // simply disappear until it is typeset). Set to an array containing + // the description of an HTML snippet in order to use the same preview + // for all equations on the page (e.g., you could have it say "[math]" + // or load an image). + // + // E.g., preview: ["[math]"], + // or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]] + // + preview: "TeX" + + }, + + //============================================================================ + // + // These parameters control the TeX input jax. + // + TeX: { + + // + // This specifies the side on which \tag{} macros will place the tags. + // Set to "left" to place on the left-hand side. + // + TagSide: "right", + + // + // This is the amound of indentation (from right or left) for the tags. + // + TagIndent: "0.8em", + + // + // This is the width to use for the multline environment + // + MultLineWidth: "85%", + + // + // List of macros to define. These are of the form + // name: value + // where 'value' is the replacement text for the macro \name. + // The 'value' can also be [value,n] where 'value' is the replacement + // text and 'n' is the number of parameters for the macro. + // Note that backslashes must be doubled in the replacement string. + // + // E.g., + // + // Macros: { + // RR: '{\\bf R}', + // bold: ['{\\bf #1}', 1] + // } + // + Macros: {}, + + // + // Equation numbering parameters. + // + equationNumbers: { + autoNumber: "none", // "AMS" for standard AMS environment numbering, + // or "all" to number all displayed equations +// formatNumber: function (n) {return n}, // format for equation number n +// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref +// formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/\s/g,"_")}, +// // element ID to use for reference +// formatURL: function (id,base) {return base+'#'+encodeURIComponent(id)}, +// // URL to use for references + useLabelIds: true // make element ID's use \label name rather than equation number + }, + + // + // Controls the TeX/noErrors extension + // + noErrors: { + disabled: false, // set to true to return to original error messages + multiLine: true, // false to not include original line breaks + inlineDelimiters: ["",""], // or use ["$","$"] or ["\\(","\\)"] to put back delimiters + style: { + "font-size": "90%", + "text-align": "left", + "color": "black", + "padding": "1px 3px", + "border": "1px solid" + } + }, + + // + // Controls the TeX/noUndefined extension + // + noUndefined: { + disabled: false, // set to true to return to original error messages + attributes: { // attributes to set for the undefined control sequence + mathcolor: "red" + } + }, + + // + // Controls the TeX/unicode extension + unicode: { + fonts: "STIXGeneral,'Arial Unicode MS'" // the default font list for unknown characters + } + + }, + + //============================================================================ + // + // These parameters control the AsciiMath input jax. + // + AsciiMath: { + // + // Determines whether the unicode positions for phi and varphi are + // to be swapped or not. (Unicode originally had these reversed, and + // many fonts have them reversed as well.) When set to true, phi + // and varphi will correspond to the LaTeX macros of the same name. + // + fixphi: true, + + // + // Determines whether the MathML should be marked so that the HTML-CSS + // and SVG output jax will use MathML spacing rules rather than TeX + // spacing rules. Since AsciiMath was designed for MathML output, the + // MathML rules are used by default. + // + useMathMLspacing: true, + + // + // Determines whether limits are placed above and below operators, + // or next to them. (AsciiMath doesn't have separate in-line and + // display modes like TeX and MathML do, so this is the only control + // you have over its output) + // + displaystyle: true, + + // + // The character to use for decimal places when scanning for a number. + // If you change it to ",", beware of things like "(1,2)" which would need + // to be changed to "(1, 2)" to be parsed correctly. + // + decimal: "." + }, + + //============================================================================ + // + // These parameters control the MathML input jax. + // + MathML: { + // + // This specifies whether to use TeX spacing or MathML spacing when the + // HTML-CSS output jax is used. + // + useMathMLspacing: false + }, + + //============================================================================ + // + // These parameters control the HTML-CSS output jax. + // + "HTML-CSS": { + + // + // This controls the global scaling of mathematics as compared to the + // surrounding text. Values between 100 and 133 are usually good choices. + // + scale: 100, + + // + // Don't allow the matching of math text to surrounding text to use a scaling + // factor smaller than this. + // + minScaleAdjust: 50, + + // + // This is a list of the fonts to look for on a user's computer in + // preference to using MathJax's web-based fonts. These must + // correspond to directories available in the jax/output/HTML-CSS/fonts + // directory, where MathJax stores data about the characters available + // in the fonts. Set this to ["TeX"], for example, to prevent the + // use of the STIX fonts, or set it to an empty list, [], if + // you want to force MathJax to use web-based or image fonts. + // + availableFonts: ["STIX","TeX"], + + // + // This is the preferred font to use when more than one of those + // listed above is available. + // + preferredFont: "TeX", + + // + // This is the web-based font to use when none of the fonts listed + // above are available on the user's computer. Note that currently + // only the TeX font is available in a web-based form. Set this to + // + // webFont: null, + // + // if you want to prevent the use of web-based fonts. + // + webFont: "TeX", + + // + // This is the font to use for image fallback mode (when none of the + // fonts listed above are available and the browser doesn't support + // web-fonts via the @font-face CSS directive). Note that currently + // only the TeX font is available as an image font. Set this to + // + // imageFont: null, + // + // if you want to prevent the use of image fonts (e.g., you have not + // installed the image fonts on your server). In this case, only + // browsers that support web-based fonts will be able to view your pages + // without having the fonts installed on the client computer. The browsers + // that support web-based fonts include: IE6 and later, Chrome, Safari3.1 + // and above, Firefox3.5 and later, and Opera10 and later. Note that + // Firefox3.0 is NOT on this list, so without image fonts, FF3.0 users + // will be required to to download and install either the STIX fonts or the + // MathJax TeX fonts. + // + imageFont: "TeX", + + // + // This is the font-family CSS value used for characters that are not + // in the selected font (e.g., for web-based fonts, this is where to + // look for characters not included in the MathJax_* fonts). IE will + // stop looking after the first font that exists on the system (even + // if it doesn't contain the needed character), so order these carefully. + // + undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif", + + // + // This setting controls whether elements will be typeset + // using the math fonts or the font of the surrounding text. When + // false, the mathvariant="normal" font will be used; when true, + // the font will be inherited from the surrounding paragraph. + // + mtextFontInherit: false, + + // + // These values control how "chunky" the display of mathematical + // expressions will be. + // + // EqnChunk is the number of equations that will be typeset before + // they appear on screen. Larger values make for less visual flicker + // as the equations are drawn, but also mean longer delays before the + // reader sees anything. + // + // EqChunkFactor is the factor by which the EqnChunk will grow after each + // chunk is displayed. + // + // EqChunkDelay is the time (in milliseconds) to delay between chunks + // (to allow the browser to respond to other user interaction). + // + // Set EqnChunk to 1, EqnChunkFactor to 1, and EqnChunkDelay to 10 to get + // the behavior from MathJax v1.1 and below. + // + EqnChunk: 50, + EqnChunkFactor: 1.5, + EqnChunkDelay: 100, + + // + // This option indicates whether MathJax should try to correct the + // x-height of equations to match the size of the surrounding text. + // + matchFontHeight: true, + + // + // When true, MathJax will not measure the widths or heights of the + // subexpressions as it creates its output, but instead will rely on + // its internal calculations based on the bounding boxes of the + // characters it uses, and will only take measurements when it + // absolutely has to. Since measurements cause display reflows, they + // slows down MathJax considerably, so without them MathJax runs + // faster, but can produce slightly less accurate character placements, + // especially in width fractions or roots. + // + noReflows: true, + + + // + // These settings control automatic line breaking. It is off by + // default, so only explicit line breaks are performed (via + // linebreak="newline" attributes on and elements). To + // perform automatic line breaking on line expressions, set + // 'automatic' to 'true' below. The line breaks will be applied via a + // penalty-based heuristic, which does well, but isn't perfect. You + // might need to use linebreak="goodbreak" or linebreak="badbreak" by + // hand in order to get better effects. It is also possible to modify + // the penalty values; contact the MathJax user's forum for details. + // + linebreaks: { + + // + // This controls the automatic breaking of expressions: + // when false, only process linebreak="newline", + // when true, line breaks are inserted automatically in long expressions. + // + automatic: false, + + // + // This controls how wide the lines of mathematics can be + // + // Use an explicit width like "30em" for a fixed width. + // Use "container" to compute the size from the containing element. + // Use "nn% container" for a portion of the container. + // Use "nn%" for a portion of the window size. + // + // The container-based widths may be slower, and may not produce the + // expected results if the layout width changes due to the removal + // of previews or inclusion of mathematics during typesetting. + // + width: "container" + }, + + // + // This allows you to define or modify the styles used to display + // various math elements created by MathJax. + // + // Example: + // styles: { + // ".MathJax .merror": { + // color: "#CC0000", + // border: "1px solid #CC0000" + // } + // } + // + styles: {}, + + // + // Configuration for tooltips + // (see also the #MathJax_Tooltip CSS in MathJax/jax/output/HTML-CSS/config.js, + // which can be overridden using the styles values above). + // + tooltip: { + delayPost: 600, // milliseconds delay before tooltip is posted after mouseover + delayClear: 600, // milliseconds delay before tooltip is cleared after mouseout + offsetX: 10, offsetY: 5 // pixels to offset tooltip from mouse position + } + }, + + //============================================================================ + // + // These parameters control the NativeMML output jax. + // + NativeMML: { + + // + // This controls the global scaling of mathematics as compared to the + // surrounding text. Values between 100 and 133 are usually good choices. + // + scale: 100, + + // + // Don't allow the matching of math text to surrounding text to use a scaling + // factor smaller than this. + // + minScaleAdjust: 50, + + // This option indicates whether MathJax should try to correct the + // x-height of equations to match the size of the surrounding text. + matchFontHeight: true, + + // + // This allows you to define or modify the styles used to display + // various math elements created by MathJax. + // + // Example: + // styles: { + // ".MathJax_MathML": { + // color: "red" // MathML is in red + // } + // } + // + styles: {} + }, + + //============================================================================ + // + // These parameters control the SVG output jax. + // + "SVG": { + + // + // This controls the global scaling of mathematics as compared to the + // surrounding text. Values between 100 and 133 are usually good choices. + // + scale: 100, + + // + // Don't allow the matching of math text to surrounding text to use a scaling + // factor smaller than this. + // + minScaleAdjust: 50, + + // + // This specifies the font to use for SVG output (currently the only + // one available) + // + font: "TeX", + + // + // This is the stroke width to use for all character paths (1em = 1000 + // units). This is a cheap way of getting slightly lighter or darker + // characters + // + blacker: 10, + + // + // This is the font-family CSS value used for characters that are not + // in the selected font. IE will stop looking after the first font + // that exists on the system (even if it doesn't contain the needed + // character), so order these carefully. + // + undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif", + + // + // This setting controls whether elements will be typeset + // using the math fonts or the font of the surrounding text. When + // false, the mathvariant="normal" font will be used; when true, + // the font will be inherited from the surrounding paragraph. + // + mtextFontInherit: false, + + // + // This controls whether the MathML structure is retained and CSS + // classes are added to mark the original MathML elements (as in the + // HTML-CSS output). By default, the SVG output jax removes unneeded + // nesting in order to produce a more efficient markup, but if you + // want to use CSS to style the elements as if they were MathML, you + // might need to set this to true. + // + addMMLclasses: false, + + // + // These values control how "chunky" the display of mathematical + // expressions will be. + // + // EqnChunk is the number of equations that will be typeset before + // they appear on screen. Larger values make for less visual flicker + // as the equations are drawn, but also mean longer delays before the + // reader sees anything. + // + // EqChunkFactor is the factor by which the EqnChunk will grow after each + // chunk is displayed. + // + // EqChunkDelay is the time (in milliseconds) to delay between chunks + // (to allow the browser to respond to other user interaction). + // + // Set EqnChunk to 1, EqnChunkFactor to 1, and EwnChunkDelay to 10 to get + // the behavior from MathJax v1.1 and below. + // + EqnChunk: 50, + EqnChunkFactor: 1.5, + EqnChunkDelay: 100, + + // This option indicates whether MathJax should try to correct the + // x-height of equations to match the size of the surrounding text. + matchFontHeight: true, + + // + // These settings control automatic line breaking. It is off by + // default, so only explicit line breaks are performed (via + // linebreak="newline" attributes on and elements). To + // perform automatic line breaking on line expressions, set + // 'automatic' to 'true' below. The line breaks will be applied via a + // penalty-based heuristic, which does well, but isn't perfect. You + // might need to use linebreak="goodbreak" or linebreak="badbreak" by + // hand in order to get better effects. It is also possible to modify + // the penalty values; contact the MathJax user's forum for details. + // + linebreaks: { + + // + // This controls the automatic breaking of expressions: + // when false, only process linebreak="newline", + // when true, line breaks are inserted automatically in long expressions. + // + automatic: false, + + // + // This controls how wide the lines of mathematics can be + // + // Use an explicit width like "30em" for a fixed width. + // Use "container" to compute the size from the containing element. + // Use "nn% container" for a portion of the container. + // Use "nn%" for a portion of the window size. + // + // The container-based widths may be slower, and may not produce the + // expected results if the layout width changes due to the removal + // of previews or inclusion of mathematics during typesetting. + // + width: "container" + }, + + // + // These are the styles used for merror elements in SVG output. Note + // that only a limited number of style attributes are supported by + // SVG, but you can at least change the colors and borders. + // + // + merrorStyle: { + fontSize:"90%", color:"#C00", background:"#FF8", + border: "1px solid #C00", padding:"3px" + }, + + // + // This allows you to define or modify the styles used to display + // various math elements created by MathJax. + // + // Example: + // styles: { + // ".MathJax .merror": { + // color: "#CC0000", + // border: "1px solid #CC0000" + // } + // } + // + styles: {}, + + // + // Configuration for tooltips + // (see also the #MathJax_Tooltip CSS in MathJax/jax/output/SVG/config.js, + // which can be overridden using the styles values above). + // + tooltip: { + delayPost: 600, // milliseconds delay before tooltip is posted after mouseover + delayClear: 600, // milliseconds delay before tooltip is cleared after mouseout + offsetX: 10, offsetY: 5 // pixels to offset tooltip from mouse position + } + }, + + //============================================================================ + // + // These parameters control the contextual menus that are available on the + // mathematics within the page (provided the showMathMenu value is true above). + // + MathMenu: { + // + // This is the hover delay for the display of submenus in the + // contextual menu. When the mouse is still over a submenu label for + // this long, the menu will appear. (The menu also will appear if you + // click on the label.) It is in milliseconds. + // + delay: 150, + + // + // This is the URL for the MathJax Help menu item. + // + helpURL: "http://www.mathjax.org/help-v2/user/", + + // + // These control whether the "Math Renderer", "MathPlayer", "Font + // Preferences", "Contextual Menu", and "Discoverable" menu items will + // be displayed or not. + // + showRenderer: true, + showMathPlayer: true, + showFontMenu: false, + showContext: false, + showDiscoverable: false, + + // + // These are the settings for the Annotation menu. If the root has + // a child that contains one of the following annotation + // formats, the source will be available via the "Show Math As" menu. + // Each format has a list of possible encodings. + // + semanticsAnnotations: { + "TeX": ["TeX", "LaTeX", "application/x-tex"], + "StarMath": ["StarMath 5.0"], + "Maple": ["Maple"], + "ContentMathML": ["MathML-Content", "application/mathml-content+xml"], + "OpenMath": ["OpenMath"] + }, + + // + // These are the settings for the Show Source window. The initial + // width and height will be reset after the source is shown in an + // attempt to make the window fit the output better. + // + windowSettings: { + status: "no", toolbar: "no", locationbar: "no", menubar: "no", + directories: "no", personalbar: "no", resizable: "yes", scrollbars: "yes", + width: 100, height: 50 + }, + + // + // This allows you to change the CSS that controls the menu + // appearance. See the extensions/MathMenu.js file for details + // of the default settings. + // + styles: {} + + }, + + //============================================================================ + // + // These parameters control the contextual menus that are available on the + // mathematics within the page (provided the showMathMenu value is true above). + // + MathEvents: { + // + // This is the time required for the mouse to be held still over a + // typeset equation in order for it to count as a hover (used when the + // zoom trigger is "Hover"). It is in milliseconds. + // + hover: 500 + }, + + //============================================================================ + // + // These parameters control the MMLorHTML configuration file. + // NOTE: if you add MMLorHTML.js to the config array above, + // you must REMOVE the output jax from the jax array. + // + MMLorHTML: { + // + // The output jax that is to be preferred when both are possible + // (set to "MML" for native MathML, "HTML" for MathJax's HTML-CSS output jax). + // + prefer: { + MSIE: "MML", + Firefox: "HTML", + Opera: "HTML", + Safari: "HTML", + Chrome: "HTML", + other: "HTML" + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/default.js"); +// @license-end diff --git a/js/mathjax/extensions/AssistiveMML.js b/js/mathjax/extensions/AssistiveMML.js new file mode 100644 index 0000000..a41b24b --- /dev/null +++ b/js/mathjax/extensions/AssistiveMML.js @@ -0,0 +1,167 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/AssistiveMML.js + * + * Implements an extension that inserts hidden MathML into the + * page for screen readers or other asistive technology. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (AJAX,CALLBACK,HUB,HTML) { + var SETTINGS = HUB.config.menuSettings; + + var AssistiveMML = MathJax.Extension["AssistiveMML"] = { + version: "2.7.9", + + config: HUB.CombineConfig("AssistiveMML",{ + disabled: false, + styles: { + ".MJX_Assistive_MathML": { + position:"absolute!important", + top: 0, left: 0, + clip: (HUB.Browser.isMSIE && (document.documentMode||0) < 8 ? + "rect(1px 1px 1px 1px)" : "rect(1px, 1px, 1px, 1px)"), + padding: "1px 0 0 0!important", + border: "0!important", + height: "1px!important", + width: "1px!important", + overflow: "hidden!important", + display:"block!important", + // + // Don't allow the assistive MathML become part of the selection + // + "-webkit-touch-callout": "none", + "-webkit-user-select": "none", + "-khtml-user-select": "none", + "-moz-user-select": "none", + "-ms-user-select": "none", + "user-select": "none" + }, + ".MJX_Assistive_MathML.MJX_Assistive_MathML_Block": { + width: "100%!important" + } + } + }), + + Config: function () { + if (!this.config.disabled && SETTINGS.assistiveMML == null) + HUB.Config({menuSettings:{assistiveMML:true}}); + AJAX.Styles(this.config.styles); + HUB.Register.MessageHook("End Math",function (msg) { + if (SETTINGS.assistiveMML) return AssistiveMML.AddAssistiveMathML(msg[1]) + }); + }, + + // + // This sets up a state object that lists the jax and index into the jax, + // and a dummy callback that is used to synchronizing with MathJax. + // It will be called when the jax are all processed, and that will + // let the MathJax queue continue (it will block until then). + // + AddAssistiveMathML: function (node) { + var state = { + jax: HUB.getAllJax(node), i: 0, + callback: MathJax.Callback({}) + }; + this.HandleMML(state); + return state.callback; + }, + + // + // This removes the data-mathml attribute and the assistive MathML from + // all the jax. + // + RemoveAssistiveMathML: function (node) { + var jax = HUB.getAllJax(node), frame; + for (var i = 0, m = jax.length; i < m; i++) { + frame = document.getElementById(jax[i].inputID+"-Frame"); + if (frame && frame.getAttribute("data-mathml")) { + frame.removeAttribute("data-mathml"); + if (frame.lastChild && frame.lastChild.className.match(/MJX_Assistive_MathML/)) + frame.removeChild(frame.lastChild); + } + } + }, + + // + // For each jax in the state, look up the frame. + // If the jax doesn't use NativeMML and hasn't already been handled: + // Get the MathML for the jax, taking resets into account. + // Add a data-mathml attribute to the frame, and + // Create a span that is not visible on screen and put the MathML in it, + // and add it to the frame. + // When all the jax are processed, call the callback. + // + HandleMML: function (state) { + var m = state.jax.length, jax, mml, frame, span; + var MML = MathJax.ElementJax.mml; + MML.copyAttributes.id = 1; + while (state.i < m) { + jax = state.jax[state.i]; + frame = document.getElementById(jax.inputID+"-Frame"); + if (jax.outputJax !== "NativeMML" && jax.outputJax !== "PlainSource" && + frame && !frame.getAttribute("data-mathml")) { + try { + mml = jax.root.toMathML("").replace(/\n */g,"").replace(//g,""); + } catch (err) { + MML.copyAttributes.id = true; + if (!err.restart) throw err; // an actual error + return MathJax.Callback.After(["HandleMML",this,state],err.restart); + } + frame.setAttribute("data-mathml",mml); + span = HTML.addElement(frame,"span",{ + isMathJax: true, unselectable: "on", + className: "MJX_Assistive_MathML" + + (jax.root.Get("display") === "block" ? " MJX_Assistive_MathML_Block" : "") + }); + try {span.innerHTML = mml} catch (err) {} + frame.style.position = "relative"; + frame.setAttribute("role","presentation"); + frame.firstChild.setAttribute("aria-hidden","true"); + span.setAttribute("role","presentation"); + } + state.i++; + } + MML.copyAttributes.id = true; + state.callback(); + } + + }; + + HUB.Startup.signal.Post("AssistiveMML Ready"); + +})(MathJax.Ajax,MathJax.Callback,MathJax.Hub,MathJax.HTML); + +// +// Make sure the toMathML extension is loaded before we signal +// the load complete for this extension. Then wait for the end +// of the user configuration before configuring this extension. +// +MathJax.Callback.Queue( + ["Require",MathJax.Ajax,"[MathJax]/extensions/toMathML.js"], + ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/AssistiveMML.js"], + function () { + MathJax.Hub.Register.StartupHook("End Config",["Config",MathJax.Extension.AssistiveMML]); + } +); + +// @license-end diff --git a/js/mathjax/extensions/CHTML-preview.js b/js/mathjax/extensions/CHTML-preview.js new file mode 100644 index 0000000..1c7597a --- /dev/null +++ b/js/mathjax/extensions/CHTML-preview.js @@ -0,0 +1,32 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/CHTML-preview.js + * + * Backward compatibility with old CHTML-preview extension. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2014-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Callback.Queue( + ["Require",MathJax.Ajax,"[MathJax]/extensions/fast-preview.js"], + ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/CHTML-preview.js"] +); +// @license-end diff --git a/js/mathjax/extensions/FontWarnings.js b/js/mathjax/extensions/FontWarnings.js new file mode 100644 index 0000000..04c1490 --- /dev/null +++ b/js/mathjax/extensions/FontWarnings.js @@ -0,0 +1,315 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/FontWarnings.js + * + * Implements a font warning message window that appears when + * the image fonts, no fonts, or web fonts are used, informing + * the user where to download the fonts, or to update to a more + * modern browser. The window will fade out automatically after + * a time, and the user can dismiss it by a close box. + * + * To include font warning messages, add "FontWarnings.js" to the + * extensions array in your MathJax configuration. + * + * You can customize the warning messages in a number of ways. Use the + * FontWarnings section of the configuration to specify any of the items + * shown in the CONFIG variable below. These include + * + * messageStyle the style to apply to the warning box that is + * displayed when MathJax uses one of its fallback + * methods. + * + * removeAfter the amount of time to show the warning message (in ms) + * fadeoutTime how long the message should take to fade out + * fadeoutSteps how many separate steps to use during the fade out + * (set to 0 to use no fadeout and simply remove the window) + * + * Messages stores the descriptions of the messages to use for the + * various warnings (webFonts, imageFonts, and noFonts). + * These are arrays of strings to be inserted into the window, + * or identifiers within brackets, which refer to the HTML + * snippets in the HTML section described below. To disable a + * specific message, set its value to null (see example below). + * + * HTML stores snippets of HTML descriptions for various + * common parts of the error messages. These include + * the closeBox, the message about web fonts being available + * in modern browser, and messages about downloadable fonts. + * The STIX and TeX font messages are used when only one + * of these is in the availableFonts list. The data for these + * are arrays of either strings to include or a description of + * an HTML item enclosed in square brackets. That description + * has (up to) three parts: the name of the tag to be included, + * a list (enclosed in braces) of attributes and their values + * to be set on the tag (optional), and an array of the contents + * of the tag (optional). See the definitions below for examples. + * + * For example, + * + * MathJax.Hub.Config({ + * ... + * extensions: ["FontWarnings.js"], + * FontWarnings: { + * removeAfter: 20*1000, // 20 seconds + * messageStyle: { + * border: "2px solid black", + * padding: "2em" + * }, + * Message: { + * webFont: null // no webfont messages (only image and no fonts) + * } + * } + * }); + * + * would extend the time the message is displayed from 12 seconds to 20, + * and changes the border to a solid black one, with 2em of padding + * rather than the default of 1em. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML) { + var VERSION = "2.7.9"; + + var STIXURL = "http://www.stixfonts.org/"; + var MATHJAXURL = "https://github.com/mathjax/MathJax/tree/master/fonts/HTML-CSS/TeX/otf"; + + var CONFIG = HUB.CombineConfig("FontWarnings",{ + // + // The CSS for the message window + // + messageStyle: { + position:"fixed", bottom:"4em", left:"3em", width:"40em", + border: "3px solid #880000", "background-color": "#E0E0E0", color: "black", + padding: "1em", "font-size":"small", "white-space":"normal", + + "border-radius": ".75em", // Opera 10.5 and IE9 + "-webkit-border-radius": ".75em", // Safari and Chrome + "-moz-border-radius": ".75em", // Firefox + "-khtml-border-radius": ".75em", // Konqueror + + "box-shadow": "4px 4px 10px #AAAAAA", // Opera 10.5 and IE9 + "-webkit-box-shadow": "4px 4px 10px #AAAAAA", // Safari 3 and Chrome + "-moz-box-shadow": "4px 4px 10px #AAAAAA", // Forefox 3.5 + "-khtml-box-shadow": "4px 4px 10px #AAAAAA", // Konqueror + filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3, Color='gray', Positive='true')" // IE + }, + + // + // The messages for the various situations + // + Message: { + + webFont: [ + ["closeBox"], + ["webFont", + "MathJax is using web-based fonts to display the mathematics "+ + "on this page. These take time to download, so the page would "+ + "render faster if you installed math fonts directly in your "+ + "system's font folder."], + ["fonts"] + ], + + imageFonts: [ + ["closeBox"], + ["imageFonts", + "MathJax is using its image fonts rather than local or web-based fonts. "+ + "This will render slower than usual, and the mathematics may not print "+ + "at the full resolution of your printer."], + ["fonts"], + ["webFonts"] + ], + + noFonts: [ + ["closeBox"], + ["noFonts", + "MathJax is unable to locate a font to use to display "+ + "its mathematics, and image fonts are not available, so it "+ + "is falling back on generic unicode characters in hopes that "+ + "your browser will be able to display them. Some characters "+ + "may not show up properly, or possibly not at all."], + ["fonts"], + ["webFonts"] + ] + }, + + // + // HTML objects that can be referred to in the message definitions + // + HTML: { + // + // The definition of the close box + // + closeBox: [[ + "div",{ + style: { + position:"absolute", overflow:"hidden", top:".1em", right:".1em", + border: "1px outset", width:"1em", height:"1em", + "text-align": "center", cursor: "pointer", + "background-color": "#EEEEEE", color:"#606060", + + "border-radius": ".5em", // Opera 10.5 + "-webkit-border-radius": ".5em", // Safari and Chrome + "-moz-border-radius": ".5em", // Firefox + "-khtml-border-radius": ".5em" // Konqueror + }, + onclick: function () { + if (DATA.div && DATA.fade === 0) + {if (DATA.timer) {clearTimeout(DATA.timer)}; DATA.div.style.display = "none"} + } + }, + [["span",{style:{position:"relative", bottom:".2em"}},["x"]]] + ]], + + webFonts: [ + ["p"], + ["webFonts", + "Most modern browsers allow for fonts to be downloaded over the web. "+ + "Updating to a more recent version of your browser (or changing "+ + "browsers) could improve the quality of the mathematics on this page." + ] + ], + + fonts: [ + ["p"], + ["fonts", + "MathJax can use either the [STIX fonts](%1) or the [MathJax TeX fonts](%2). " + + "Download and install one of those fonts to improve your MathJax experience.", + STIXURL,MATHJAXURL + ] + ], + + STIXfonts: [ + ["p"], + ["STIXPage", + "This page is designed to use the [STIX fonts](%1). " + + "Download and install those fonts to improve your MathJax experience.", + STIXURL + ] + ], + + TeXfonts: [ + ["p"], + ["TeXPage", + "This page is designed to use the [MathJax TeX fonts](%1). " + + "Download and install those fonts to improve your MathJax experience.", + MATHJAXURL + ] + ] + + }, + + removeAfter: 12*1000, // time to show message (in ms) + fadeoutSteps: 10, // fade-out steps + fadeoutTime: 1.5*1000 // fadeout over this amount of time (in ms) + + }); + if (MathJax.Hub.Browser.isIE9 && document.documentMode >= 9) + {delete CONFIG.messageStyle.filter} + + // + // Data for the window + // + var DATA = { + div: null, // the message window, when displayed + fade: 0 // number of fade-out steps so far + }; + + // + // Create the message window and start the fade-out timer + // + var CREATEMESSAGE = function (data) { + if (DATA.div) return; + var HTMLCSS = MathJax.OutputJax["HTML-CSS"], frame = document.body; + if (HUB.Browser.isMSIE) { + if (CONFIG.messageStyle.position === "fixed") { + MathJax.Message.Init(); // make sure MathJax_MSIE_frame exists + frame = document.getElementById("MathJax_MSIE_Frame") || frame; + if (frame !== document.body) {CONFIG.messageStyle.position = "absolute"} + } + } else {delete CONFIG.messageStyle.filter} + CONFIG.messageStyle.maxWidth = (document.body.clientWidth-75) + "px"; + var i = 0; while (i < data.length) { + if (MathJax.Object.isArray(data[i])) { + if (data[i].length === 1 && CONFIG.HTML[data[i][0]]) { + data.splice.apply(data,[i,1].concat(CONFIG.HTML[data[i][0]])); + } else if (typeof data[i][1] === "string") { + var message = MathJax.Localization.lookupPhrase(["FontWarnings",data[i][0]],data[i][1]); + message = MathJax.Localization.processMarkdown(message,data[i].slice(2),"FontWarnings"); + data.splice.apply(data,[i,1].concat(message)); + i += message.length; + } else {i++} + } else {i++} + } + DATA.div = HTMLCSS.addElement(frame,"div", + {id:"MathJax_FontWarning",style:CONFIG.messageStyle},data); + MathJax.Localization.setCSS(DATA.div); + if (CONFIG.removeAfter) { + HUB.Register.StartupHook("End",function () + {DATA.timer = setTimeout(FADEOUT,CONFIG.removeAfter)}); + } + HTML.Cookie.Set("fontWarn",{warned:true}); + }; + + // + // Set the opacity based on the number of steps taken so far + // and remove the window when it gets to 0 + // + var FADEOUT = function () { + DATA.fade++; if (DATA.timer) {delete DATA.timer} + if (DATA.fade < CONFIG.fadeoutSteps) { + var opacity = 1 - DATA.fade/CONFIG.fadeoutSteps; + DATA.div.style.opacity = opacity; + DATA.div.style.filter = "alpha(opacity="+Math.floor(100*opacity)+")"; + setTimeout(FADEOUT,CONFIG.fadeoutTime/CONFIG.fadeoutSteps); + } else { + DATA.div.style.display = "none"; + } + }; + + // + // Check that we haven't already issued a warning + // + if (!HTML.Cookie.Get("fontWarn").warned) { + // + // Hook into the Startup signal and look for font warning messages. + // When one comes, issue the correct message. + // + HUB.Startup.signal.Interest(function (message) { + if (message.match(/HTML-CSS Jax - /) && !DATA.div) { + var HTMLCSS = MathJax.OutputJax["HTML-CSS"], FONTS = HTMLCSS.config.availableFonts, MSG; + var localFonts = (FONTS && FONTS.length); + if (!localFonts) {CONFIG.HTML.fonts = [""]} + else if (FONTS.length === 1) {CONFIG.HTML.fonts = CONFIG.HTML[FONTS[0]+"fonts"]} + if (HTMLCSS.allowWebFonts) {CONFIG.HTML.webfonts = [""]} + if (message.match(/- Web-Font/)) {if (localFonts) {MSG = "webFont"}} + else if (message.match(/- using image fonts/)) {MSG = "imageFonts"} + else if (message.match(/- no valid font/)) {MSG = "noFonts"} + if (MSG && CONFIG.Message[MSG]) + {MathJax.Localization.loadDomain("FontWarnings",[CREATEMESSAGE,CONFIG.Message[MSG]])} + } + }); + } + +})(MathJax.Hub,MathJax.HTML); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/FontWarnings.js"); +// @license-end diff --git a/js/mathjax/extensions/HTML-CSS/handle-floats.js b/js/mathjax/extensions/HTML-CSS/handle-floats.js new file mode 100644 index 0000000..7afeba9 --- /dev/null +++ b/js/mathjax/extensions/HTML-CSS/handle-floats.js @@ -0,0 +1,51 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/HTML-CSS/handle-floats.js + * + * This extension allows HTML-CSS output to deal with floating elements + * better. In particular, when there are tags or equation numbers, these + * would overlap floating elements, but with this extension, the width of + * the line should properly correspond to the amount of space remaining. + * + * To load it, include + * + * "HTML-CSS": { + * extensions: ["handle-floats.js"] + * } + * + * in your configuration. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +MathJax.Extension["HTML-CSS/handle-floats"] = { + version: "2.7.9" +}; + +// +// This file is now obsolete, since the HTML-CSS output already handles +// floating elements properly. +// + +MathJax.Hub.Startup.signal.Post("HTML-CSS handle-floats Ready"); +MathJax.Ajax.loadComplete("[MathJax]/extensions/HTML-CSS/handle-floats.js"); +// @license-end diff --git a/js/mathjax/extensions/HelpDialog.js b/js/mathjax/extensions/HelpDialog.js new file mode 100644 index 0000000..c7663c0 --- /dev/null +++ b/js/mathjax/extensions/HelpDialog.js @@ -0,0 +1,205 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/extensions/HelpDialog.js + * + * Implements the MathJax Help dialog box. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML,AJAX,OUTPUT,LOCALE) { + + var HELP = MathJax.Extension.Help = { + version: "2.7.9" + }; + + var STIXURL = "http://www.stixfonts.org/"; + var MENU = MathJax.Menu; + var FALSE, KEY; + HUB.Register.StartupHook("MathEvents Ready",function () { + FALSE = MathJax.Extension.MathEvents.Event.False; + KEY = MathJax.Extension.MathEvents.Event.KEY; + }); + + + var CONFIG = HUB.CombineConfig("HelpDialog",{ + + styles: { + "#MathJax_Help": { + position:"fixed", left:"50%", width:"auto", "max-width": "90%", "text-align":"center", + border:"3px outset", padding:"1em 2em", "background-color":"#DDDDDD", color:"black", + cursor: "default", "font-family":"message-box", "font-size":"120%", + "font-style":"normal", "text-indent":0, "text-transform":"none", + "line-height":"normal", "letter-spacing":"normal", "word-spacing":"normal", + "word-wrap":"normal", "white-space":"wrap", "float":"none", "z-index":201, + + "border-radius": "15px", // Opera 10.5 and IE9 + "-webkit-border-radius": "15px", // Safari and Chrome + "-moz-border-radius": "15px", // Firefox + "-khtml-border-radius": "15px", // Konqueror + + "box-shadow":"0px 10px 20px #808080", // Opera 10.5 and IE9 + "-webkit-box-shadow":"0px 10px 20px #808080", // Safari 3 and Chrome + "-moz-box-shadow":"0px 10px 20px #808080", // Forefox 3.5 + "-khtml-box-shadow":"0px 10px 20px #808080", // Konqueror + filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')" // IE + }, + "#MathJax_Help.MathJax_MousePost": { + outline:"none" + }, + + "#MathJax_HelpContent": { + overflow:"auto", "text-align":"left", "font-size":"80%", + padding:".4em .6em", border:"1px inset", margin:"1em 0px", + "max-height":"20em", "max-width":"30em", "background-color":"#EEEEEE" + }, + + "#MathJax_HelpClose": { + position:"absolute", top:".2em", right:".2em", + cursor:"pointer", + display:"inline-block", + border:"2px solid #AAA", + "border-radius":"18px", + "-webkit-border-radius": "18px", // Safari and Chrome + "-moz-border-radius": "18px", // Firefox + "-khtml-border-radius": "18px", // Konqueror + "font-family":"'Courier New',Courier", + "font-size":"24px", + color:"#F0F0F0" + }, + "#MathJax_HelpClose span": { + display:"block", "background-color":"#AAA", border:"1.5px solid", + "border-radius":"18px", + "-webkit-border-radius": "18px", // Safari and Chrome + "-moz-border-radius": "18px", // Firefox + "-khtml-border-radius": "18px", // Konqueror + "line-height":0, + padding:"8px 0 6px" // may need to be browser-specific + }, + "#MathJax_HelpClose:hover": { + color:"white!important", + border:"2px solid #CCC!important" + }, + "#MathJax_HelpClose:hover span": { + "background-color":"#CCC!important" + }, + "#MathJax_HelpClose:hover:focus": { + outline:"none" + } + } + }); + + /* + * Handle the Help Dialog box + */ + HELP.Dialog = function (event) { + LOCALE.loadDomain("HelpDialog",["Post",HELP,event]); + }; + + HELP.Post = function (event) { + this.div = MENU.Background(this); + var help = HTML.addElement(this.div,"div",{ + id: "MathJax_Help", tabIndex: 0, onkeydown: HELP.Keydown + },LOCALE._("HelpDialog",[ + ["b",{style:{fontSize:"120%"}},[["Help","MathJax Help"]]], + ["div",{id: "MathJax_HelpContent", tabIndex: 0},[ + ["p",{},[["MathJax", + "*MathJax* is a JavaScript library that allows page authors to include " + + "mathematics within their web pages. As a reader, you don't need to do " + + "anything to make that happen."]] + ], + ["p",{},[["Browsers", + "*Browsers*: MathJax works with all modern browsers including IE6+, Firefox 3+, " + + "Chrome 0.2+, Safari 2+, Opera 9.6+ and most mobile browsers."]] + ], + ["p",{},[["Menu", + "*Math Menu*: MathJax adds a contextual menu to equations. Right-click or " + + "CTRL-click on any mathematics to access the menu."]] + ], + ["div",{style:{"margin-left":"1em"}},[ + ["p",{},[["ShowMath", + "*Show Math As* allows you to view the formula's source markup " + + "for copy & paste (as MathML or in its original format)."]] + ], + ["p",{},[["Settings", + "*Settings* gives you control over features of MathJax, such as the " + + "size of the mathematics, and the mechanism used to display equations."]] + ], + ["p",{},[["Language", + "*Language* lets you select the language used by MathJax for its menus " + + "and warning messages."]] + ], + ]], + ["p",{},[["Zoom", + "*Math Zoom*: If you are having difficulty reading an equation, MathJax can " + + "enlarge it to help you see it better."]] + ], + ["p",{},[["Accessibilty", + "*Accessibility*: MathJax will automatically work with screen readers to make " + + "mathematics accessible to the visually impaired."]] + ], + ["p",{},[["Fonts", + "*Fonts*: MathJax will use certain math fonts if they are installed on your " + + "computer; otherwise, it will use web-based fonts. Although not required, " + + "locally installed fonts will speed up typesetting. We suggest installing " + + "the [STIX fonts](%1).",STIXURL]] + ] + ]], + ["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]], + ["span",{id: "MathJax_HelpClose", onclick: HELP.Remove, + onkeydown: HELP.Keydown, tabIndex: 0, role: "button", + "aria-label": LOCALE._(["HelpDialog","CloseDialog"],"Close help dialog")}, + [["span",{},["\u00D7"]]] + ] + ])); + if (event.type === "mouseup") help.className += " MathJax_MousePost"; + help.focus(); + LOCALE.setCSS(help); + var doc = (document.documentElement||{}); + var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; + if (MENU.prototype.msieAboutBug) { + help.style.width = "20em"; help.style.position = "absolute"; + help.style.left = Math.floor((document.documentElement.scrollWidth - help.offsetWidth)/2)+"px"; + help.style.top = (Math.floor((H-help.offsetHeight)/3)+document.body.scrollTop)+"px"; + } else { + help.style.marginLeft = Math.floor(-help.offsetWidth/2)+"px"; + help.style.top = Math.floor((H-help.offsetHeight)/3)+"px"; + } + }; + HELP.Remove = function (event) { + if (HELP.div) {document.body.removeChild(HELP.div); delete HELP.div} + }; + HELP.Keydown = function(event) { + if (event.keyCode === KEY.ESCAPE || + (this.id === "MathJax_HelpClose" && + (event.keyCode === KEY.SPACE || event.keyCode === KEY.RETURN))) { + HELP.Remove(event); + MENU.CurrentNode().focus(); + FALSE(event); + } + }, + + MathJax.Callback.Queue( + HUB.Register.StartupHook("End Config",{}), // wait until config is complete + ["Styles",AJAX,CONFIG.styles], + ["Post",HUB.Startup.signal,"HelpDialog Ready"], + ["loadComplete",AJAX,"[MathJax]/extensions/HelpDialog.js"] + ); + +})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax,MathJax.Localization); +// @license-end diff --git a/js/mathjax/extensions/MatchWebFonts.js b/js/mathjax/extensions/MatchWebFonts.js new file mode 100644 index 0000000..95e168c --- /dev/null +++ b/js/mathjax/extensions/MatchWebFonts.js @@ -0,0 +1,311 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/MatchWebFonts.js + * + * Adds code to the output jax so that if web fonts are used on the page, + * MathJax will be able to detect their arrival and update the math to + * accommodate the change in font. For the NativeMML output, this works + * both for web fonts in main text, and for web fonts in the math as well. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,AJAX) { + var VERSION = "2.7.9"; + + var CONFIG = MathJax.Hub.CombineConfig("MatchWebFonts",{ + matchFor: { + "HTML-CSS": true, + NativeMML: true, + SVG: true + }, + fontCheckDelay: 500, // initial delay for the first check for web fonts + fontCheckTimeout: 15 * 1000, // how long to keep looking for fonts (15 seconds) + }); + + MathJax.Extension.MatchWebFonts = { + version: VERSION, + config: CONFIG + }; + + HUB.Register.StartupHook("HTML-CSS Jax Ready",function () { + var HTMLCSS = MathJax.OutputJax["HTML-CSS"]; + var POSTTRANSLATE = HTMLCSS.postTranslate; + + HTMLCSS.Augment({ + postTranslate: function (state,partial) { + if (!partial && CONFIG.matchFor["HTML-CSS"] && this.config.matchFontHeight) { + // + // Check for changes in the web fonts that might affect the font + // size for math elements. This is a periodic check that goes on + // until a timeout is reached. + // + AJAX.timer.start(AJAX,["checkFonts",this,state.jax[this.id]], + CONFIG.fontCheckDelay,CONFIG.fontCheckTimeout); + } + return POSTTRANSLATE.apply(this,arguments); // do the original function + }, + + checkFonts: function (check,scripts) { + if (check.time(function () {})) return; + var size = [], i, m, retry = false; + // + // Add the elements used for testing ex and em sizes + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.insertBefore(this.EmExSpan.cloneNode(true),script); + } + } + // + // Check to see if anything has changed + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; retry = true; + var jax = script.MathJax.elementJax; if (!jax) continue; + // + // Check if ex or mex has changed + // + var test = script.previousSibling; + var ex = test.firstChild.offsetHeight/60; + var em = test.lastChild.lastChild.offsetHeight/60; + if (ex === 0 || ex === "NaN") {ex = this.defaultEx; em = this.defaultEm} + if (ex !== jax.HTMLCSS.ex || em !== jax.HTMLCSS.em) { + var scale = ex/this.TeX.x_height/em; + scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale)*this.config.scale); + if (scale/100 !== jax.scale) {size.push(script); scripts[i] = {}} + } + } + // + // Remove markers + // + scripts = scripts.concat(size); // some scripts have been moved to the size array + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script && script.parentNode && script.MathJax.elementJax) { + script.parentNode.removeChild(script.previousSibling); + } + } + // + // Rerender the changed items + // + if (size.length) {HUB.Queue(["Rerender",HUB,[size],{}])} + // + // Try again later + // + if (retry) {setTimeout(check,check.delay)} + } + }); + }); + + HUB.Register.StartupHook("SVG Jax Ready",function () { + var SVG = MathJax.OutputJax.SVG; + var POSTTRANSLATE = SVG.postTranslate; + + SVG.Augment({ + postTranslate: function (state,partial) { + if (!partial && CONFIG.matchFor.SVG) { + // + // Check for changes in the web fonts that might affect the font + // size for math elements. This is a periodic check that goes on + // until a timeout is reached. + // + AJAX.timer.start(AJAX,["checkFonts",this,state.jax[this.id]], + CONFIG.fontCheckDelay,CONFIG.fontCheckTimeout); + } + return POSTTRANSLATE.apply(this,arguments); // do the original function + }, + + checkFonts: function (check,scripts) { + if (check.time(function () {})) return; + var size = [], i, m, retry = false; + // + // Add the elements used for testing ex and em sizes + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.insertBefore(this.ExSpan.cloneNode(true),script); + } + } + // + // Check to see if anything has changed + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; retry = true; + var jax = script.MathJax.elementJax; if (!jax) continue; + // + // Check if ex or mex has changed + // + var test = script.previousSibling; + var ex = test.firstChild.offsetHeight/60; + if (ex === 0 || ex === "NaN") {ex = this.defaultEx} + if (ex !== jax.SVG.ex) {size.push(script); scripts[i] = {}} + } + // + // Remove markers + // + scripts = scripts.concat(size); // some scripts have been moved to the size array + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.removeChild(script.previousSibling); + } + } + // + // Rerender the changed items + // + if (size.length) {HUB.Queue(["Rerender",HUB,[size],{}])} + // + // Try again later (if not all the scripts are null) + // + + if (retry) setTimeout(check,check.delay); + } + }); + }); + + HUB.Register.StartupHook("NativeMML Jax Ready",function () { + var nMML = MathJax.OutputJax.NativeMML; + var POSTTRANSLATE = nMML.postTranslate; + + nMML.Augment({ + postTranslate: function (state) { + if (!HUB.Browser.isMSIE && CONFIG.matchFor.NativeMML) { + // + // Check for changes in the web fonts that might affect the sizes + // of math elements. This is a periodic check that goes on until + // a timeout is reached. + // + AJAX.timer.start(AJAX,["checkFonts",this,state.jax[this.id]], + CONFIG.fontCheckDelay,CONFIG.fontCheckTimeout); + } + POSTTRANSLATE.apply(this,arguments); // do the original routine + }, + + // + // Check to see if web fonts have been loaded that change the ex size + // of the surrounding font, the ex size within the math, or the widths + // of math elements. We do this by rechecking the ex and mex sizes + // (to see if the font scaling needs adjusting) and by checking the + // size of the inner mrow of math elements and mtd elements. The + // sizes of these have been stored in the NativeMML object of the + // element jax so that we can check for them here. + // + checkFonts: function (check,scripts) { + if (check.time(function () {})) return; + var adjust = [], mtd = [], size = [], i, m, script; + // + // Add the elements used for testing ex and em sizes + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.insertBefore(this.EmExSpan.cloneNode(true),script); + } + } + // + // Check to see if anything has changed + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + var jax = script.MathJax.elementJax; if (!jax) continue; + var span = document.getElementById(jax.inputID+"-Frame"); + var math = span.getElementsByTagName("math")[0]; if (!math) continue; + jax = jax.NativeMML; + // + // Check if ex or mex has changed + // + var test = script.previousSibling; + var ex = test.firstChild.offsetWidth/60; + var mex = test.lastChild.offsetWidth/60; + if (ex === 0 || ex === "NaN") {ex = this.defaultEx; mex = this.defaultMEx} + var newEx = (ex !== jax.ex); + if (newEx || mex != jax.mex) { + var scale = (this.config.matchFontHeight && mex > 1 ? ex/mex : 1); + scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale) * this.config.scale); + if (scale/100 !== jax.scale) {size.push([span.style,scale])} + jax.scale = scale/100; jax.fontScale = scale+"%"; jax.ex = ex; jax.mex = mex; + } + + // + // Check width of math elements + // + if ("scrollWidth" in jax && (newEx || jax.scrollWidth !== math.firstChild.scrollWidth)) { + jax.scrollWidth = math.firstChild.scrollWidth; + adjust.push([math.parentNode.style,jax.scrollWidth/jax.ex/jax.scale]); + } + // + // Check widths of mtd elements + // + if (math.MathJaxMtds) { + for (var j = 0, n = math.MathJaxMtds.length; j < n; j++) { + if (!math.MathJaxMtds[j].parentNode) continue; + if (newEx || math.MathJaxMtds[j].firstChild.scrollWidth !== jax.mtds[j]) { + jax.mtds[j] = math.MathJaxMtds[j].firstChild.scrollWidth; + mtd.push([math.MathJaxMtds[j],jax.mtds[j]/jax.ex]); + } + } + } + } + // + // Remove markers + // + for (i = 0, m = scripts.length; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.removeChild(script.previousSibling); + } + } + // + // Adjust scaling factor + // + for (i = 0, m = size.length; i < m; i++) { + size[i][0].fontSize = size[i][1] + "%"; + } + // + // Adjust width of spans containing math elements that have changed + // + for (i = 0, m = adjust.length; i < m; i++) { + adjust[i][0].width = adjust[i][1].toFixed(3)+"ex"; + } + // + // Adjust widths of mtd elements that have changed + // + for (i = 0, m = mtd.length; i < m; i++) { + var style = mtd[i][0].getAttribute("style"); + style = style.replace(/(($|;)\s*min-width:).*?ex/,"$1 "+mtd[i][1].toFixed(3)+"ex"); + mtd[i][0].setAttribute("style",style); + } + // + // Try again later + // + setTimeout(check,check.delay); + } + }); + }); + + HUB.Startup.signal.Post("MatchWebFonts Extension Ready"); + AJAX.loadComplete("[MathJax]/extensions/MatchWebFonts.js"); + +})(MathJax.Hub,MathJax.Ajax); +// @license-end diff --git a/js/mathjax/extensions/MathEvents.js b/js/mathjax/extensions/MathEvents.js new file mode 100644 index 0000000..2f83e05 --- /dev/null +++ b/js/mathjax/extensions/MathEvents.js @@ -0,0 +1,624 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/MathEvents.js + * + * Implements the event handlers needed by the output jax to perform + * menu, hover, and other events. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) { + var VERSION = "2.7.9"; + + var EXTENSION = MathJax.Extension; + var ME = EXTENSION.MathEvents = {version: VERSION}; + + var SETTINGS = HUB.config.menuSettings; + + var CONFIG = { + hover: 500, // time required to be considered a hover + frame: { + x: 3.5, y: 5, // frame padding and + bwidth: 1, // frame border width (in pixels) + bcolor: "#A6D", // frame border color + hwidth: "15px", // haze width + hcolor: "#83A" // haze color + }, + button: { + x: -6, y: -3, // menu button offsets + wx: -2 // button offset for full-width equations + }, + fadeinInc: .2, // increment for fade-in + fadeoutInc: .05, // increment for fade-out + fadeDelay: 50, // delay between fade-in or fade-out steps + fadeoutStart: 400, // delay before fade-out after mouseout + fadeoutDelay: 15*1000, // delay before automatic fade-out + + styles: { + ".MathJax_Hover_Frame": { + "border-radius": ".25em", // Opera 10.5 and IE9 + "-webkit-border-radius": ".25em", // Safari and Chrome + "-moz-border-radius": ".25em", // Firefox + "-khtml-border-radius": ".25em", // Konqueror + + "box-shadow": "0px 0px 15px #83A", // Opera 10.5 and IE9 + "-webkit-box-shadow": "0px 0px 15px #83A", // Safari and Chrome + "-moz-box-shadow": "0px 0px 15px #83A", // Forefox + "-khtml-box-shadow": "0px 0px 15px #83A", // Konqueror + + border: "1px solid #A6D ! important", + display: "inline-block", position:"absolute" + }, + + ".MathJax_Menu_Button .MathJax_Hover_Arrow": { + position:"absolute", + cursor:"pointer", + display:"inline-block", + border:"2px solid #AAA", + "border-radius":"4px", + "-webkit-border-radius": "4px", // Safari and Chrome + "-moz-border-radius": "4px", // Firefox + "-khtml-border-radius": "4px", // Konqueror + "font-family":"'Courier New',Courier", + "font-size":"9px", + color:"#F0F0F0" + }, + ".MathJax_Menu_Button .MathJax_Hover_Arrow span": { + display:"block", + "background-color":"#AAA", + border:"1px solid", + "border-radius":"3px", + "line-height":0, + padding:"4px" + }, + ".MathJax_Hover_Arrow:hover": { + color:"white!important", + border:"2px solid #CCC!important" + }, + ".MathJax_Hover_Arrow:hover span": { + "background-color":"#CCC!important" + } + } + }; + + + // + // Common event-handling code + // + var EVENT = ME.Event = { + + LEFTBUTTON: 0, // the event.button value for left button + RIGHTBUTTON: 2, // the event.button value for right button + MENUKEY: "altKey", // the event value for alternate context menu + + /*************************************************************/ + /* + * Enum element for key codes. + */ + KEY: { + RETURN: 13, + ESCAPE: 27, + SPACE: 32, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + LESS: 188, + GREATER: 190, + DASH: 189 + }, + + Mousedown: function (event) {return EVENT.Handler(event,"Mousedown",this)}, + Mouseup: function (event) {return EVENT.Handler(event,"Mouseup",this)}, + Mousemove: function (event) {return EVENT.Handler(event,"Mousemove",this)}, + Mouseover: function (event) {return EVENT.Handler(event,"Mouseover",this)}, + Mouseout: function (event) {return EVENT.Handler(event,"Mouseout",this)}, + Click: function (event) {return EVENT.Handler(event,"Click",this)}, + DblClick: function (event) {return EVENT.Handler(event,"DblClick",this)}, + Menu: function (event) {return EVENT.Handler(event,"ContextMenu",this)}, + + // + // Call the output jax's event handler or the zoom handler + // + Handler: function (event,type,math) { + if (AJAX.loadingMathMenu) {return EVENT.False(event)} + var jax = OUTPUT[math.jaxID]; + if (!event) {event = window.event} + event.isContextMenu = (type === "ContextMenu"); + if (jax[type]) {return jax[type](event,math)} + if (EXTENSION.MathZoom) {return EXTENSION.MathZoom.HandleEvent(event,type,math)} + }, + + // + // Try to cancel the event in every way we can + // + False: function (event) { + if (!event) {event = window.event} + if (event) { + if (event.preventDefault) {event.preventDefault()} else {event.returnValue = false} + if (event.stopPropagation) {event.stopPropagation()} + event.cancelBubble = true; + } + return false; + }, + + // + // Keydown event handler. Should only fire on Space key. + // + Keydown: function (event, math) { + if (!event) event = window.event; + if (event.keyCode === EVENT.KEY.SPACE) { + EVENT.ContextMenu(event, this); + }; + }, + + // + // Load the contextual menu code, if needed, and post the menu + // + ContextMenu: function (event,math,force) { + // + // Check if we are showing menus + // + var JAX = OUTPUT[math.jaxID], jax = JAX.getJaxFromMath(math); + var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu; + if (!show || (SETTINGS.context !== "MathJax" && !force)) return; + + // + // Remove selections, remove hover fades + // + if (ME.msieEventBug) {event = window.event || event} + EVENT.ClearSelection(); HOVER.ClearHoverTimer(); + if (jax.hover) { + if (jax.hover.remove) {clearTimeout(jax.hover.remove); delete jax.hover.remove} + jax.hover.nofade = true; + } + + // + // If the menu code is loaded, + // Check if localization needs loading; + // If not, post the menu, and return. + // Otherwise wait for the localization to load + // Otherwse load the menu code. + // Try again after the file is loaded. + // + var MENU = MathJax.Menu; var load, fn; + if (MENU) { + if (MENU.loadingDomain) {return EVENT.False(event)} + load = LOCALE.loadDomain("MathMenu"); + if (!load) { + MENU.jax = jax; + var source = MENU.menu.Find("Show Math As").submenu; + source.items[0].name = jax.sourceMenuTitle; + source.items[0].format = (jax.sourceMenuFormat||"MathML"); + source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle; + source.items[5].disabled = !INPUT[jax.inputJax].annotationEncoding; + + // + // Try and find each known annotation format and enable the menu + // items accordingly. + // + var annotations = source.items[2]; annotations.disabled = true; + var annotationItems = annotations.submenu.items; + annotationList = MathJax.Hub.Config.semanticsAnnotations; + for (var i = 0, m = annotationItems.length; i < m; i++) { + var name = annotationItems[i].name[1] + if (jax.root && jax.root.getAnnotation(name) !== null) { + annotations.disabled = false; + annotationItems[i].hidden = false; + } else { + annotationItems[i].hidden = true; + } + } + + var MathPlayer = MENU.menu.Find("Math Settings","MathPlayer"); + MathPlayer.hidden = !(jax.outputJax === "NativeMML" && HUB.Browser.hasMathPlayer); + return MENU.menu.Post(event); + } + MENU.loadingDomain = true; + fn = function () {delete MENU.loadingDomain}; + } else { + if (AJAX.loadingMathMenu) {return EVENT.False(event)} + AJAX.loadingMathMenu = true; + load = AJAX.Require("[MathJax]/extensions/MathMenu.js"); + fn = function () { + delete AJAX.loadingMathMenu; + if (!MathJax.Menu) {MathJax.Menu = {}} + } + } + var ev = { + pageX:event.pageX, pageY:event.pageY, + clientX:event.clientX, clientY:event.clientY + }; + CALLBACK.Queue( + load, fn, // load the file and delete the marker when done + ["ContextMenu",EVENT,ev,math,force] // call this function again + ); + return EVENT.False(event); + }, + + // + // Mousedown handler for alternate means of accessing menu + // + AltContextMenu: function (event,math) { + var JAX = OUTPUT[math.jaxID]; + var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu; + if (show) { + show = (JAX.config.showMathMenuMSIE != null ? JAX : HUB).config.showMathMenuMSIE; + if (SETTINGS.context === "MathJax" && !SETTINGS.mpContext && show) { + if (!ME.noContextMenuBug || event.button !== EVENT.RIGHTBUTTON) return; + } else { + if (!event[EVENT.MENUKEY] || event.button !== EVENT.LEFTBUTTON) return; + } + return JAX.ContextMenu(event,math,true); + } + }, + + ClearSelection: function () { + if (ME.safariContextMenuBug) {setTimeout("window.getSelection().empty()",0)} + if (document.selection) {setTimeout("document.selection.empty()",0)} + }, + + getBBox: function (span) { + span.appendChild(ME.topImg); + var h = ME.topImg.offsetTop, d = span.offsetHeight-h, w = span.offsetWidth; + span.removeChild(ME.topImg); + return {w:w, h:h, d:d}; + } + + }; + + // + // Handle hover "discoverability" + // + var HOVER = ME.Hover = { + + // + // Check if we are moving from a non-MathJax element to a MathJax one + // and either start fading in again (if it is fading out) or start the + // timer for the hover + // + Mouseover: function (event,math) { + if (SETTINGS.discoverable || SETTINGS.zoom === "Hover") { + var from = event.fromElement || event.relatedTarget, + to = event.toElement || event.target; + if (from && to && (HUB.isMathJaxNode(from) !== HUB.isMathJaxNode(to) || + HUB.getJaxFor(from) !== HUB.getJaxFor(to))) { + var jax = this.getJaxFromMath(math); + if (jax.hover) {HOVER.ReHover(jax)} else {HOVER.HoverTimer(jax,math)} + return EVENT.False(event); + } + } + }, + // + // Check if we are moving from a MathJax element to a non-MathJax one + // and either start fading out, or clear the timer if we haven't + // hovered yet + // + Mouseout: function (event,math) { + if (SETTINGS.discoverable || SETTINGS.zoom === "Hover") { + var from = event.fromElement || event.relatedTarget, + to = event.toElement || event.target; + if (from && to && (HUB.isMathJaxNode(from) !== HUB.isMathJaxNode(to) || + HUB.getJaxFor(from) !== HUB.getJaxFor(to))) { + var jax = this.getJaxFromMath(math); + if (jax.hover) {HOVER.UnHover(jax)} else {HOVER.ClearHoverTimer()} + return EVENT.False(event); + } + } + }, + // + // Restart hover timer if the mouse moves + // + Mousemove: function (event,math) { + if (SETTINGS.discoverable || SETTINGS.zoom === "Hover") { + var jax = this.getJaxFromMath(math); if (jax.hover) return; + if (HOVER.lastX == event.clientX && HOVER.lastY == event.clientY) return; + HOVER.lastX = event.clientX; HOVER.lastY = event.clientY; + HOVER.HoverTimer(jax,math); + return EVENT.False(event); + } + }, + + // + // Clear the old timer and start a new one + // + HoverTimer: function (jax,math) { + this.ClearHoverTimer(); + this.hoverTimer = setTimeout(CALLBACK(["Hover",this,jax,math]),CONFIG.hover); + }, + ClearHoverTimer: function () { + if (this.hoverTimer) {clearTimeout(this.hoverTimer); delete this.hoverTimer} + }, + + // + // Handle putting up the hover frame + // + Hover: function (jax,math) { + // + // Check if Zoom handles the hover event + // + if (EXTENSION.MathZoom && EXTENSION.MathZoom.Hover({},math)) return; + // + // Get the hover data + // + var JAX = OUTPUT[jax.outputJax], + span = JAX.getHoverSpan(jax,math), + bbox = JAX.getHoverBBox(jax,span,math), + show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu; + var dx = CONFIG.frame.x, dy = CONFIG.frame.y, dd = CONFIG.frame.bwidth; // frame size + if (ME.msieBorderWidthBug) {dd = 0} + jax.hover = {opacity:0, id:jax.inputID+"-Hover"}; + // + // The frame and menu button + // + var frame = HTML.Element("span",{ + id:jax.hover.id, isMathJax: true, + style:{display:"inline-block", width:0, height:0, position:"relative"} + },[["span",{ + className:"MathJax_Hover_Frame", isMathJax: true, + style:{ + display:"inline-block", position:"absolute", + top:this.Px(-bbox.h-dy-dd-(bbox.y||0)), left:this.Px(-dx-dd+(bbox.x||0)), + width:this.Px(bbox.w+2*dx), height:this.Px(bbox.h+bbox.d+2*dy), + opacity:0, filter:"alpha(opacity=0)" + }} + ]] + ); + var button = HTML.Element("span",{ + isMathJax: true, id:jax.hover.id+"Menu", className:"MathJax_Menu_Button", + style:{display:"inline-block", "z-index": 1, width:0, height:0, position:"relative"} + },[["span",{ + className: "MathJax_Hover_Arrow", isMathJax: true, math: math, + onclick: this.HoverMenu, jax:JAX.id, + style: { + left:this.Px(bbox.w+dx+dd+(bbox.x||0)+CONFIG.button.x), + top:this.Px(-bbox.h-dy-dd-(bbox.y||0)-CONFIG.button.y), + opacity:0, filter:"alpha(opacity=0)" + } + },[["span",{isMathJax:true},"\u25BC"]]]] + ); + if (bbox.width) { + frame.style.width = button.style.width = bbox.width; + frame.style.marginRight = button.style.marginRight = "-"+bbox.width; + frame.firstChild.style.width = bbox.width; + button.firstChild.style.left = ""; + button.firstChild.style.right = this.Px(CONFIG.button.wx); + } + // + // Add the frame and button + // + span.parentNode.insertBefore(frame,span); + if (show) {span.parentNode.insertBefore(button,span)} + if (span.style) {span.style.position = "relative"} // so math is on top of hover frame + // + // Start the hover fade-in + // + this.ReHover(jax); + }, + // + // Restart the hover fade in and fade-out timers + // + ReHover: function (jax) { + if (jax.hover.remove) {clearTimeout(jax.hover.remove)} + jax.hover.remove = setTimeout(CALLBACK(["UnHover",this,jax]),CONFIG.fadeoutDelay); + this.HoverFadeTimer(jax,CONFIG.fadeinInc); + }, + // + // Start the fade-out + // + UnHover: function (jax) { + if (!jax.hover.nofade) {this.HoverFadeTimer(jax,-CONFIG.fadeoutInc,CONFIG.fadeoutStart)} + }, + // + // Handle the fade-in and fade-out + // + HoverFade: function (jax) { + delete jax.hover.timer; + jax.hover.opacity = Math.max(0,Math.min(1,jax.hover.opacity + jax.hover.inc)); + jax.hover.opacity = Math.floor(1000*jax.hover.opacity)/1000; + var frame = document.getElementById(jax.hover.id), + button = document.getElementById(jax.hover.id+"Menu"); + frame.firstChild.style.opacity = jax.hover.opacity; + frame.firstChild.style.filter = "alpha(opacity="+Math.floor(100*jax.hover.opacity)+")"; + if (button) { + button.firstChild.style.opacity = jax.hover.opacity; + button.firstChild.style.filter = frame.style.filter; + } + if (jax.hover.opacity === 1) {return} + if (jax.hover.opacity > 0) {this.HoverFadeTimer(jax,jax.hover.inc); return} + frame.parentNode.removeChild(frame); + if (button) {button.parentNode.removeChild(button)} + if (jax.hover.remove) {clearTimeout(jax.hover.remove)} + delete jax.hover; + }, + // + // Set the fade to in or out (via inc) and start the timer, if needed + // + HoverFadeTimer: function (jax,inc,delay) { + jax.hover.inc = inc; + if (!jax.hover.timer) { + jax.hover.timer = setTimeout(CALLBACK(["HoverFade",this,jax]),(delay||CONFIG.fadeDelay)); + } + }, + + // + // Handle a click on the menu button + // + HoverMenu: function (event) { + if (!event) {event = window.event} + return OUTPUT[this.jax].ContextMenu(event,this.math,true); + }, + + // + // Clear all hover timers + // + ClearHover: function (jax) { + if (jax.hover.remove) {clearTimeout(jax.hover.remove)} + if (jax.hover.timer) {clearTimeout(jax.hover.timer)} + HOVER.ClearHoverTimer(); + delete jax.hover; + }, + + // + // Make a measurement in pixels + // + Px: function (m) { + if (Math.abs(m) < .006) {return "0px"} + return m.toFixed(2).replace(/\.?0+$/,"") + "px"; + }, + + // + // Preload images so they show up with the menu + // + getImages: function () { + if (SETTINGS.discoverable) { + var menu = new Image(); + menu.src = CONFIG.button.src; + } + } + + }; + + // + // Handle touch events. + // + // Use double-tap-and-hold as a replacement for context menu event. + // Use double-tap as a replacement for double click. + // + var TOUCH = ME.Touch = { + + last: 0, // time of last tap event + delay: 500, // delay time for double-click + + // + // Check if this is a double-tap, and if so, start the timer + // for the double-tap and hold (to trigger the contextual menu) + // + start: function (event) { + var now = new Date().getTime(); + var dblTap = (now - TOUCH.last < TOUCH.delay && TOUCH.up); + TOUCH.last = now; TOUCH.up = false; + if (dblTap) { + TOUCH.timeout = setTimeout(TOUCH.menu,TOUCH.delay,event,this); + event.preventDefault(); + } + }, + + // + // Check if there is a timeout pending, i.e., we have a + // double-tap and were waiting to see if it is held long + // enough for the menu. Since we got the end before the + // timeout, it is a double-click, not a double-tap-and-hold. + // Prevent the default action and issue a double click. + // + end: function (event) { + var now = new Date().getTime(); + TOUCH.up = (now - TOUCH.last < TOUCH.delay); + if (TOUCH.timeout) { + clearTimeout(TOUCH.timeout); + delete TOUCH.timeout; TOUCH.last = 0; TOUCH.up = false; + event.preventDefault(); + return EVENT.Handler((event.touches[0]||event.touch),"DblClick",this); + } + }, + + // + // If the timeout passes without an end event, we issue + // the contextual menu event. + // + menu: function (event,math) { + delete TOUCH.timeout; TOUCH.last = 0; TOUCH.up = false; + return EVENT.Handler((event.touches[0]||event.touch),"ContextMenu",math); + } + + }; + + /* + * // + * // Mobile screens are small, so use larger version of arrow + * // + * if (HUB.Browser.isMobile) { + * var arrow = CONFIG.styles[".MathJax_Hover_Arrow"]; + * arrow.width = "25px"; arrow.height = "18px"; + * CONFIG.button.x = -6; + * } + */ + + // + // Set up browser-specific values + // + HUB.Browser.Select({ + MSIE: function (browser) { + var mode = (document.documentMode || 0); + var isIE8 = browser.versionAtLeast("8.0"); + ME.msieBorderWidthBug = (document.compatMode === "BackCompat"); // borders are inside offsetWidth/Height + ME.msieEventBug = browser.isIE9; // must get event from window even though event is passed + ME.msieAlignBug = (!isIE8 || mode < 8); // inline-block spans don't rest on baseline + if (mode < 9) {EVENT.LEFTBUTTON = 1} // IE < 9 has wrong event.button values + }, + Safari: function (browser) { + ME.safariContextMenuBug = true; // selection can be started by contextmenu event + }, + Opera: function (browser) { + ME.operaPositionBug = true; // position is wrong unless border is used + }, + Konqueror: function (browser) { + ME.noContextMenuBug = true; // doesn't produce contextmenu event + } + }); + + // + // Used in measuring zoom and hover positions + // + ME.topImg = (ME.msieAlignBug ? + HTML.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}) : + HTML.Element("span",{style:{width:0,height:0,display:"inline-block"}}) + ); + if (ME.operaPositionBug) {ME.topImg.style.border="1px solid"} + + // + // Get configuration from user + // + ME.config = CONFIG = HUB.CombineConfig("MathEvents",CONFIG); + var SETFRAME = function () { + var haze = CONFIG.styles[".MathJax_Hover_Frame"]; + haze.border = CONFIG.frame.bwidth+"px solid "+CONFIG.frame.bcolor+" ! important"; + haze["box-shadow"] = haze["-webkit-box-shadow"] = + haze["-moz-box-shadow"] = haze["-khtml-box-shadow"] = + "0px 0px "+CONFIG.frame.hwidth+" "+CONFIG.frame.hcolor; + }; + + // + // Queue the events needed for startup + // + CALLBACK.Queue( + HUB.Register.StartupHook("End Config",{}), // wait until config is complete + [SETFRAME], + ["getImages",HOVER], + ["Styles",AJAX,CONFIG.styles], + ["Post",HUB.Startup.signal,"MathEvents Ready"], + ["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"] + ); + +})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback, + MathJax.Localization,MathJax.OutputJax,MathJax.InputJax); +// @license-end diff --git a/js/mathjax/extensions/MathML/content-mathml.js b/js/mathjax/extensions/MathML/content-mathml.js new file mode 100644 index 0000000..250ce43 --- /dev/null +++ b/js/mathjax/extensions/MathML/content-mathml.js @@ -0,0 +1,1745 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/MathML/content-mathml.js + * + * This file provides methods to convert Content-MathML to + * Presentation MathML for processing by MathJax. The transform is + * performed in a DOM filter for the MathML input jax, so that the + * Show Math As menu will still show the Original MathML as Content MathML, + * but the Presentation MathML can be obtained from the main MathML menu. + * + * To load it, include + * + * MathML: { + * extensions: ["content-mathml.js"] + * } + * + * in your configuration. + * + * A portion of this file is taken from ctop.js which is + * Copyright (c) David Carlisle 2001, 2002, 2008, 2009, 2013, + * and is used by permission of David Carlisle, who has agreed to allow us + * to release it under the Apache2 license (see below). That portion is + * indicated via comments. + * + * The remainder falls under the copyright that follows. + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +MathJax.Extension["MathML/content-mathml"] = (function(HUB) { + /* + * Content MathML to Presentation MathML conversion + * + * based on David Carlisle's ctop.js - https://web-xslt.googlecode.com/svn/trunk/ctop/ctop.js + * + */ + + + var isMSIE = HUB.Browser.isMSIE; + + if (isMSIE) { + try {document.namespaces.add("m","http://www.w3.org/1998/Math/MathML")} catch (err) {} + } + + var CONFIG = HUB.CombineConfig("MathML.content-mathml",{ + // render `a+(-b)` as `a-b`? + collapsePlusMinus: true, + + /* mathvariant to use with corresponding type attribute */ + cistyles: { + vector: 'bold-italic', + matrix: 'bold-upright' + }, + + /* Symbol names to translate to characters + */ + symbols: { + gamma: '\u03B3' + } + + }); + + var CToP = { + version: "2.7.9", + settings: CONFIG, + + /* Transform the given elements from Content MathML to Presentation MathML and replace the original elements + */ + transformElements: function(elements) { + for (var i = 0, l = elements.length; i= 0) element = CToP.cloneNode(element,true); // removes namespaces + var mathNode = CToP.cloneNode(element); + for (var j = 0, l = element.childNodes.length; jn instead of -n + // + element.appendChild(document.createTextNode(textContent.substr(1))); + var mrow = CToP.createElement('mrow'); + CToP.appendToken(mrow,'mo','\u2212'); + mrow.appendChild(element); + element = mrow; + } else { + element.appendChild(document.createTextNode(textContent)); + } + parentNode.appendChild(element); + return element; + }, + + /* Transform a Content MathML node to Presentation MathML node(s), and attach it to the parent + */ + applyTransform: function(parentNode,contentMMLNode,precedence) { + if (!contentMMLNode) { + var merror = CToP.createElement('merror'); + CToP.appendToken(merror,'mtext','Missing child node'); + parentNode.appendChild(merror); + return; + } + var nodeName = contentMMLNode.nodeName.replace(/.*:/,''); + if (contentMMLNode.nodeType === 1) { + if (CToP.tokens[nodeName]) { + CToP.tokens[nodeName](parentNode,contentMMLNode,precedence); + } else if (contentMMLNode.childNodes.length === 0) { + var mml = CToP.MML[nodeName]; + if (mml && mml.isa && mml.isa(CToP.mbase)) { + parentNode.appendChild(CToP.cloneNode(contentMMLNode)); + } else { + CToP.appendToken(parentNode,'mi',nodeName); + } + } else { + var clonedChild = CToP.cloneNode(contentMMLNode); + parentNode.appendChild(clonedChild); + for (var j = 0, l = contentMMLNode.childNodes.length; j1) { + CToP.applyTransform(mrow,args[0],tokenPrecedence); + } + CToP.appendToken(mrow,'mo',name); + if (args.length>0) { + var z = args[(args.length === 1)?0:1]; + CToP.applyTransform(mrow,z,tokenPrecedence); + } + if (needsBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + parentNode.appendChild(mrow); + } + }, + + /* Transform an infix operator + * + * (function factory) + */ + infix: function(name,tokenPrecedence) { + return function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + var needsBrackets = precedence>tokenPrecedence; + if (needsBrackets) { + CToP.appendToken(mrow,'mo','('); + } + for (var j = 0, l = args.length; j0) { + CToP.appendToken(mrow,'mo',name); + } + CToP.applyTransform(mrow,args[j],tokenPrecedence); + } + if (needsBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + parentNode.appendChild(mrow); + } + }, + + /* Transform an iterated operation, e.g. summation + * + * (function factory + */ + iteration: function(name,limitSymbol) { + return function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + var mo = CToP.createElement('mo'); + CToP.setTextContent(mo,name); + var munderover = CToP.createElement('munderover'); + munderover.appendChild(mo); + var mrow1 = CToP.createElement('mrow'); + var i, j, num_qualifiers, num_bvars, children, bvar, num_children, num_args; + for (i = 0, num_qualifiers = qualifiers.length; i',1), + lt: CToP.transforms.infix('<',1), + geq: CToP.transforms.infix('\u2265',1), + leq: CToP.transforms.infix('\u2264',1), + equivalent: CToP.transforms.infix('\u2261',1), + approx: CToP.transforms.infix('\u2248',1), + subset: CToP.transforms.infix('\u2286',2), + prsubset: CToP.transforms.infix('\u2282',2), + cartesianproduct: CToP.transforms.infix('\u00D7',2), + "cartesian_product": CToP.transforms.infix('\u00D7',2), + vectorproduct: CToP.transforms.infix('\u00D7',2), + scalarproduct: CToP.transforms.infix('.',2), + outerproduct: CToP.transforms.infix('\u2297',2), + sum: CToP.transforms.iteration('\u2211','='), + product: CToP.transforms.iteration('\u220F','='), + forall: CToP.transforms.bind('\u2200','.',','), + exists: CToP.transforms.bind('\u2203','.',','), + lambda: CToP.transforms.bind('\u03BB','.',','), + limit: CToP.transforms.iteration('lim','\u2192'), + sdev: CToP.transforms.fn('\u03c3'), + determinant: CToP.transforms.fn('det'), + max: CToP.transforms.minmax('max'), + min: CToP.transforms.minmax('min'), + real: CToP.transforms.fn('\u211b'), + imaginary: CToP.transforms.fn('\u2111'), + set: CToP.transforms.set('{','}'), + list: CToP.transforms.set('(',')'), + + exp: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var msup = CToP.createElement('msup'); + CToP.appendToken(msup,'mi','e'); + CToP.applyTransform(msup,args[0],0); + parentNode.appendChild(msup); + }, + + union: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (bvars.length) { + CToP.transforms.iteration('\u22C3','=')(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } else { + CToP.transforms.infix('\u222A',2)(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } + }, + + intersect: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (bvars.length) { + CToP.transforms.iteration('\u22C2','=')(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } else { + var mrow = CToP.createElement('mrow'); + var needsBrackets = precedence>2; + if (needsBrackets) { + CToP.appendToken(mrow,'mo','('); + } + for (var j = 0, l = args.length; j0) { + CToP.appendToken(mrow,'mo','\u2229'); + if (args[j].nodeName === 'apply') { + var child = CToP.getChildren(args[j])[0]; + argBrackets = child.nodeName === 'union'; + } + } + if (argBrackets) { + CToP.appendToken(mrow,'mo','('); + } + CToP.applyTransform(mrow,args[j],2); + if (argBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + } + if (needsBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + parentNode.appendChild(mrow); + } + }, + + floor: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + CToP.appendToken(mrow,'mo','\u230a'); + CToP.applyTransform(mrow,args[0],0); + CToP.appendToken(mrow,'mo','\u230b'); + parentNode.appendChild(mrow); + }, + + conjugate: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mover = CToP.createElement('mover'); + CToP.applyTransform(mover,args[0],0); + CToP.appendToken(mover,'mo','\u00af'); + parentNode.appendChild(mover); + }, + + abs: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + CToP.appendToken(mrow,'mo','|'); + CToP.applyTransform(mrow,args[0],0); + CToP.appendToken(mrow,'mo','|'); + parentNode.appendChild(mrow); + }, + + and: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (bvars.length || qualifiers.length) { + CToP.transforms.iteration('\u22c0','=')(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,4); + } else { + CToP.transforms.infix('\u2227',2)(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } + }, + + or: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (bvars.length || qualifiers.length) { + CToP.transforms.iteration('\u22c1','=')(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,4); + } else { + CToP.transforms.infix('\u2228',2)(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } + }, + + xor: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (bvars.length || qualifiers.length) { + CToP.transforms.iteration('xor','=')(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,4); + } else { + CToP.transforms.infix('xor',2)(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence); + } + }, + + card: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + CToP.appendToken(mrow,'mo','|'); + CToP.applyTransform(mrow,args[0],0); + CToP.appendToken(mrow,'mo','|'); + parentNode.appendChild(mrow); + }, + + mean: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + if (args.length === 1) { + var mover = CToP.createElement('mover'); + CToP.applyTransform(mover,args[0],0); + CToP.appendToken(mover,'mo','\u00af'); + parentNode.appendChild(mover); + } else { + parentNode.appendChild(CToP.createmfenced(args,'\u27e8','\u27e9')); + } + }, + + moment: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var degree, momentabout, children, i, j, l; + + for (i = 0, l = qualifiers.length; i1) { + argrow.appendChild(CToP.createmfenced(args,'(',')')); + } else { + CToP.applyTransform(argrow,args[0],0); + } + if (degree) { + var msup = CToP.createElement('msup'); + msup.appendChild(argrow); + children = CToP.getChildren(degree); + for (j = 0, l = children.length; j3; + if (needsBrackets) { + CToP.appendToken(mrow,'mo','('); + } + for (var j = 0, l = args.length; j0) { + CToP.appendToken(mrow,'mo',(args[j].nodeName === 'cn') ? "\u00D7" :"\u2062"); + } + CToP.applyTransform(mrow,args[j],3); + } + if (needsBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + parentNode.appendChild(mrow); + }, + + plus: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + var needsBrackets = precedence>2; + if (needsBrackets) { + CToP.appendToken(mrow,'mo','('); + } + for (var j = 0, l = args.length; j0) { + var n; + if (CToP.settings.collapsePlusMinus) { + if (arg.nodeName === 'cn' && !(children.length) && (n = Number(CToP.getTextContent(arg))) <0) { + CToP.appendToken(mrow,'mo','\u2212'); + CToP.appendToken(mrow,'mn', -n); + } else if (arg.nodeName === 'apply' && children.length === 2 && children[0].nodeName === 'minus') { + CToP.appendToken(mrow,'mo','\u2212'); + CToP.applyTransform(mrow,children[1],2); + } else if (arg.nodeName === 'apply' && children.length>2 && children[0].nodeName === 'times' && children[1].nodeName === 'cn' && (n = Number(CToP.getTextContent(children[1]))) < 0) { + CToP.appendToken(mrow,'mo','\u2212'); + children[1].textContent = -n; // OK to change MathML since it is being discarded afterward + CToP.applyTransform(mrow,arg,2); + } else{ + CToP.appendToken(mrow,'mo','+'); + CToP.applyTransform(mrow,arg,2); + } + } else { + CToP.appendToken(mrow,'mo','+'); + CToP.applyTransform(mrow,arg,2); + } + } else { + CToP.applyTransform(mrow,arg,2); + } + } + if (needsBrackets) { + CToP.appendToken(mrow,'mo',')'); + } + parentNode.appendChild(mrow); + }, + + transpose: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var msup = CToP.createElement('msup'); + CToP.applyTransform(msup,args[0],precedence); + CToP.appendToken(msup,'mi','T'); + parentNode.appendChild(msup); + }, + + power: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var msup = CToP.createElement('msup'); + CToP.applyTransform(msup,args[0],3); + CToP.applyTransform(msup,args[1],precedence); + parentNode.appendChild(msup); + }, + + selector: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var msub = CToP.createElement('msub'); + var mrow = args ? args[0]: CToP.createElement('mrow'); + CToP.applyTransform(msub,mrow,0); + var mrow2 = CToP.createElement('mrow'); + for (var i = 1, l = args.length; i1) { + CToP.applyTransform(mrow,args[1],0); + } + } + CToP.appendToken(mrow,'mo','\u230B'); + parentNode.appendChild(mrow); + }, + + factorial: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mrow = CToP.createElement('mrow'); + CToP.applyTransform(mrow,args[0],4); + CToP.appendToken(mrow,'mo','!'); + parentNode.appendChild(mrow); + }, + + root: function(parentNode,contentMMLNode,firstArg,args,bvars,qualifiers,precedence) { + var mr; + if (firstArg.nodeName === 'root' && (qualifiers.length === 0 || (qualifiers[0].nodeName === 'degree' && CToP.getTextContent(qualifiers[0]) === '2'))) { + mr = CToP.createElement('msqrt'); + for (var i = 0, l = args.length; i1) { + var msup = CToP.createElement('msup'); + CToP.applyTransform(msup,bvar,0); + CToP.appendToken(msup,'mn',degree); + bottomrow.appendChild(msup); + } else { + CToP.applyTransform(bottomrow,bvar,0); + } + } + for (i = 0, l = lambdaSequence.length; i0) { + if (hadFirst) { + CToP.appendToken(degreeRow,'mo','+'); + } + CToP.appendToken(degreeRow,'mn',degree); + } + } + + if (args.length) { + differendNode = args[0]; + } + + for (i = 0, l = bvars.length; i but use MATHML.Parse's preProcessMath to apply the normal preprocessing. + if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} + var doc = MATHML.ParseXML(PARSE.preProcessMath(data.math)); + + // Now transform the using the mml3 stylesheet. + var newdoc = MATHML.mml3XSLT.transformToDocument(doc); + + if ((typeof newdoc) === "string") { + // Internet Explorer returns a string, so just use it. + data.math = newdoc; + } else if (window.XMLSerializer) { + // Serialize the again. We could directly provide the DOM content + // but other prefilterHooks may assume data.math is still a string. + var serializer = new XMLSerializer(); + data.math = serializer.serializeToString(newdoc.documentElement, doc); + } + }); + + /* + * The following is derived from mml3mj.xsl + * (https://github.com/davidcarlisle/web-xslt/blob/master/ctop/mml3mj.xsl) + * which is Copyright (c) David Carlisle 2008-2015. + * It is used by permission of David Carlisle, who has agreed to allow it to + * be released under the Apache License, Version 2.0. + */ + var BROWSER = MathJax.Hub.Browser; + var exslt = ''; + if (BROWSER.isEdge || BROWSER.isMSIE) { + exslt = 'urn:schemas-microsoft-com:xslt' + } else { + exslt = 'http://exslt.org/common'; + } + var mml3Stylesheet = + '' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + '' + + ' ' + + ' ltr' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + '' + + ' )' + + '' + + ' (' + + '' + + '' + + ' ]' + + '' + + '' + + ' [' + + '' + + '' + + ' }' + + '' + + '' + + ' {' + + '' + + '' + + ' ' + + '' + + ' )' + + '' + + ' (' + + '' + + '' + + ' ]' + + '' + + '' + + ' [' + + '' + + '' + + ' }' + + '' + + '' + + ' {' + + '' + + ' ' + + ' ' + + ' \' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ')' + + '(' + + '}' + + '{' + + '>' + + '<' + + '' + + '' + + '' + + ' top right' + + '' + + '' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' 0' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' decimalpoint' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' decimalpoint' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' .' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' decimalpoint' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' *' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' 0.1em' + + ' 0.15em' + + ' 0.2em' + + ' ' + + ' 0.15em' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' 0' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' )' + + ' ' + + ' (' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' /' + + ' ' + + ' \' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' :' + + ' ' + + ' =' + + ' ' + + ' ' + + ' ' + + ' ' + + ' top' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' )' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ''; + + /* + * End of mml3mj.xsl material. + */ + + var mml3; + if (window.XSLTProcessor) { + // standard method: just use an XSLTProcessor and parse the stylesheet + if (!MATHML.ParseXML) {MATHML.ParseXML = MATHML.createParser()} + MATHML.mml3XSLT = new XSLTProcessor(); + MATHML.mml3XSLT.importStylesheet(MATHML.ParseXML(mml3Stylesheet)); + } else if (MathJax.Hub.Browser.isMSIE) { + // nonstandard methods for Internet Explorer + if (MathJax.Hub.Browser.versionAtLeast("9.0") || (document.documentMode||0) >= 9) { + // For Internet Explorer >= 9, use createProcessor + mml3 = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); + mml3.loadXML(mml3Stylesheet); + var xslt = new ActiveXObject("Msxml2.XSLTemplate"); + xslt.stylesheet = mml3; + MATHML.mml3XSLT = { + mml3: xslt.createProcessor(), + transformToDocument: function(doc) { + this.mml3.input = doc; + this.mml3.transform(); + return this.mml3.output; + } + } + } else { + // For Internet Explorer <= 8, use transformNode + mml3 = MATHML.createMSParser(); + mml3.async = false; + mml3.loadXML(mml3Stylesheet); + MATHML.mml3XSLT = { + mml3: mml3, + transformToDocument: function(doc) { + return doc.documentElement.transformNode(this.mml3); + } + } + } + } else { + // No XSLT support. Do not change the content. + MATHML.mml3XSLT = null; + } + + // Tweak CSS to avoid some browsers rearranging HTML output + MathJax.Ajax.Styles({ + ".MathJax .mi, .MathJax .mo, .MathJax .mn, .MathJax .mtext": { + direction: "ltr", + display: "inline-block" + }, + ".MathJax .ms, .MathJax .mspace, .MathJax .mglyph": { + direction: "ltr", + display: "inline-block" + } + }); + + MathJax.Hub.Startup.signal.Post("MathML mml3.js Ready"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/MathML/mml3.js"); +// @license-end diff --git a/js/mathjax/extensions/MathMenu.js b/js/mathjax/extensions/MathMenu.js new file mode 100644 index 0000000..48b1244 --- /dev/null +++ b/js/mathjax/extensions/MathMenu.js @@ -0,0 +1,1666 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/MathMenu.js + * + * Implements a right-mouse (or CTRL-click) menu over mathematics + * elements that gives the user the ability to copy the source, + * change the math size, and zoom settings. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML,AJAX,CALLBACK,OUTPUT) { + var VERSION = "2.7.9"; + + var SIGNAL = MathJax.Callback.Signal("menu"); // signal for menu events + + MathJax.Extension.MathMenu = { + version: VERSION, + signal: SIGNAL + }; + + var _ = function (id) { + return MathJax.Localization._.apply( + MathJax.Localization, + [["MathMenu",id]].concat([].slice.call(arguments,1)) + ); + }; + + var isArray = MathJax.Object.isArray; + + var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE, isIE9 = ((document.documentMode||0) > 8); + var ROUND = (isPC ? null : "5px"); + + var CONFIG = HUB.CombineConfig("MathMenu",{ + delay: 150, // the delay for submenus + + showRenderer: true, // show the "Math Renderer" menu? + showMathPlayer: true, // show the "MathPlayer" menu? + showFontMenu: false, // show the "Font Preference" menu? + showContext: false, // show the "Context Menu" menu? + showDiscoverable: false, // show the "Discoverable" menu? + showLocale: true, // show the "Locale" menu? + showLocaleURL: false, // show the "Load from URL" menu? + + semanticsAnnotations: { + "TeX": ["TeX", "LaTeX", "application/x-tex"], + "StarMath": ["StarMath 5.0"], + "Maple": ["Maple"], + "ContentMathML": ["MathML-Content", "application/mathml-content+xml"], + "OpenMath": ["OpenMath"] + }, + + windowSettings: { // for source window + status: "no", toolbar: "no", locationbar: "no", menubar: "no", + directories: "no", personalbar: "no", resizable: "yes", scrollbars: "yes", + width: 400, height: 300, + left: Math.round((screen.width - 400)/2), + top: Math.round((screen.height - 300)/3) + }, + + styles: { + "#MathJax_About": { + position:"fixed", left:"50%", width:"auto", "text-align":"center", + border:"3px outset", padding:"1em 2em", "background-color":"#DDDDDD", color:"black", + cursor: "default", "font-family":"message-box", "font-size":"120%", + "font-style":"normal", "text-indent":0, "text-transform":"none", + "line-height":"normal", "letter-spacing":"normal", "word-spacing":"normal", + "word-wrap":"normal", "white-space":"nowrap", "float":"none", "z-index":201, + + "border-radius": "15px", // Opera 10.5 and IE9 + "-webkit-border-radius": "15px", // Safari and Chrome + "-moz-border-radius": "15px", // Firefox + "-khtml-border-radius": "15px", // Konqueror + + "box-shadow":"0px 10px 20px #808080", // Opera 10.5 and IE9 + "-webkit-box-shadow":"0px 10px 20px #808080", // Safari 3 and Chrome + "-moz-box-shadow":"0px 10px 20px #808080", // Forefox 3.5 + "-khtml-box-shadow":"0px 10px 20px #808080", // Konqueror + filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')" // IE + }, + "#MathJax_About.MathJax_MousePost": { + outline:"none" + }, + + ".MathJax_Menu": { + position:"absolute", "background-color":"white", color:"black", + width:"auto", padding:(isPC ? "2px" : "5px 0px"), + border:"1px solid #CCCCCC", margin:0, cursor:"default", + font: "menu", "text-align":"left", "text-indent":0, "text-transform":"none", + "line-height":"normal", "letter-spacing":"normal", "word-spacing":"normal", + "word-wrap":"normal", "white-space":"nowrap", "float":"none", "z-index":201, + + "border-radius": ROUND, // Opera 10.5 and IE9 + "-webkit-border-radius": ROUND, // Safari and Chrome + "-moz-border-radius": ROUND, // Firefox + "-khtml-border-radius": ROUND, // Konqueror + + "box-shadow":"0px 10px 20px #808080", // Opera 10.5 and IE9 + "-webkit-box-shadow":"0px 10px 20px #808080", // Safari 3 and Chrome + "-moz-box-shadow":"0px 10px 20px #808080", // Forefox 3.5 + "-khtml-box-shadow":"0px 10px 20px #808080", // Konqueror + filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')" // IE + }, + + ".MathJax_MenuItem": { + padding: (isPC ? "2px 2em" : "1px 2em"), + background:"transparent" + }, + + ".MathJax_MenuArrow": { + position:"absolute", right:".5em", "padding-top":".25em", color:"#666666", + "font-family": (isMSIE ? "'Arial unicode MS'" : null), "font-size": ".75em" + }, + ".MathJax_MenuActive .MathJax_MenuArrow": {color:"white"}, + ".MathJax_MenuArrow.RTL": {left:".5em", right:"auto"}, + + ".MathJax_MenuCheck": { + position:"absolute", left:".7em", + "font-family": (isMSIE ? "'Arial unicode MS'" : null) + }, + ".MathJax_MenuCheck.RTL": {right:".7em", left:"auto"}, + + ".MathJax_MenuRadioCheck": { + position:"absolute", left: (isPC ? "1em" : ".7em") + }, + ".MathJax_MenuRadioCheck.RTL": { + right: (isPC ? "1em" : ".7em"), left:"auto" + }, + + ".MathJax_MenuLabel": { + padding: (isPC ? "2px 2em 4px 1.33em" : "1px 2em 3px 1.33em"), + "font-style":"italic" + }, + + ".MathJax_MenuRule": { + "border-top": (isPC ? "1px solid #CCCCCC" : "1px solid #DDDDDD"), + margin: (isPC ? "4px 1px 0px" : "4px 3px") + }, + + ".MathJax_MenuDisabled": { + color:"GrayText" + }, + ".MathJax_MenuActive": { + "background-color": (isPC ? "Highlight" : "#606872"), + color: (isPC ? "HighlightText" : "white") + }, + + ".MathJax_MenuDisabled:focus, .MathJax_MenuLabel:focus": { + "background-color": "#E8E8E8" + }, + ".MathJax_ContextMenu:focus": { + outline:"none" + }, + ".MathJax_ContextMenu .MathJax_MenuItem:focus": { + outline:"none" + }, + + "#MathJax_AboutClose": { + top:".2em", right:".2em" + }, + ".MathJax_Menu .MathJax_MenuClose": { + top:"-10px", left:"-10px" + }, + + ".MathJax_MenuClose": { + position:"absolute", + cursor:"pointer", + display:"inline-block", + border:"2px solid #AAA", + "border-radius":"18px", + "-webkit-border-radius": "18px", // Safari and Chrome + "-moz-border-radius": "18px", // Firefox + "-khtml-border-radius": "18px", // Konqueror + "font-family":"'Courier New',Courier", + "font-size":"24px", + color:"#F0F0F0" + }, + ".MathJax_MenuClose span": { + display:"block", "background-color":"#AAA", border:"1.5px solid", + "border-radius":"18px", + "-webkit-border-radius": "18px", // Safari and Chrome + "-moz-border-radius": "18px", // Firefox + "-khtml-border-radius": "18px", // Konqueror + "line-height":0, + padding:"8px 0 6px" // may need to be browser-specific + }, + ".MathJax_MenuClose:hover": { + color:"white!important", + border:"2px solid #CCC!important" + }, + ".MathJax_MenuClose:hover span": { + "background-color":"#CCC!important" + }, + ".MathJax_MenuClose:hover:focus": { + outline:"none" + } + } + }); + + var FALSE, HOVER, KEY; + HUB.Register.StartupHook("MathEvents Ready",function () { + FALSE = MathJax.Extension.MathEvents.Event.False; + HOVER = MathJax.Extension.MathEvents.Hover; + KEY = MathJax.Extension.MathEvents.Event.KEY; + }); + + + /*************************************************************/ + /* + * Abstract class of all keyboard navigatable objects. + */ + var NAV = MathJax.Object.Subclass({ + /* + * Moving in the list of items. + */ + Keydown: function(event, menu) { + switch (event.keyCode) { + case KEY.ESCAPE: + this.Remove(event, menu); + break; + case KEY.RIGHT: + this.Right(event, menu); + break; + case KEY.LEFT: + this.Left(event, menu); + break; + case KEY.UP: + this.Up(event, menu); + break; + case KEY.DOWN: + this.Down(event, menu); + break; + case KEY.RETURN: + case KEY.SPACE: + this.Space(event, menu); + break; + default: + return; + break; + } + return FALSE(event); + }, + Escape: function(event, menu) { }, + Right: function(event, menu) { }, + Left: function(event, menu) { }, + Up: function(event, menu) { }, + Down: function(event, menu) { }, + Space: function(event, menu) { } + }, {}); + + + /*************************************************************/ + /* + * The main menu class + */ + var MENU = MathJax.Menu = NAV.Subclass({ + version: VERSION, + items: [], + posted: false, + title: null, + margin: 5, + + Init: function (def) {this.items = [].slice.call(arguments,0)}, + With: function (def) {if (def) {HUB.Insert(this,def)}; return this}, + + /* + * Display the menu + */ + Post: function (event,parent,forceLTR) { + if (!event) {event = window.event||{}} + var div = document.getElementById("MathJax_MenuFrame"); + if (!div) { + div = MENU.Background(this); + delete ITEM.lastItem; delete ITEM.lastMenu; + delete MENU.skipUp; + SIGNAL.Post(["post",MENU.jax]); + MENU.isRTL = (MathJax.Localization.fontDirection() === "rtl"); + } + var menu = HTML.Element("div",{ + onmouseup: MENU.Mouseup, ondblclick: FALSE, + ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE, + menuItem: this, className: "MathJax_Menu", onkeydown: MENU.Keydown, + role: "menu" + }); + if (event.type === "contextmenu" || event.type === "mouseover") + menu.className += " MathJax_ContextMenu"; + if (!forceLTR) {MathJax.Localization.setCSS(menu)} + + for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)} + if (MENU.isMobile) { + HTML.addElement(menu,"span",{ + className: "MathJax_MenuClose", menu: parent, + ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close, onmouseup: FALSE + },[["span",{},"\u00D7"]]); + } + + div.appendChild(menu); + this.posted = true; + if (menu.offsetWidth) menu.style.width = (menu.offsetWidth+2) + "px"; + var x = event.pageX, y = event.pageY; + var bbox = document.body.getBoundingClientRect(); + var styles = (window.getComputedStyle ? window.getComputedStyle(document.body) : {marginLeft: "0px"}); + var bodyRight = bbox.right - Math.min(0,bbox.left) + parseFloat(styles.marginLeft); + if (!x && !y && "clientX" in event) { + x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; + y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop; + } + if (!parent) { + var node = MENU.CurrentNode() || event.target; + if ((event.type === "keydown" || (!x && !y)) && node) { + var offsetX = window.pageXOffset || document.documentElement.scrollLeft; + var offsetY = window.pageYOffset || document.documentElement.scrollTop; + var rect = node.getBoundingClientRect(); + x = (rect.right + rect.left) / 2 + offsetX; + y = (rect.bottom + rect.top) / 2 + offsetY; + } + if (x + menu.offsetWidth > bodyRight - this.margin) + {x = bodyRight - menu.offsetWidth - this.margin} + if (MENU.isMobile) {x = Math.max(5,x-Math.floor(menu.offsetWidth/2)); y -= 20} + MENU.skipUp = event.isContextMenu; + } else { + var side = "left", mw = parent.offsetWidth; + x = (MENU.isMobile ? 30 : mw - 2); y = 0; + while (parent && parent !== div) { + x += parent.offsetLeft; y += parent.offsetTop; + parent = parent.parentNode; + } + if (!MENU.isMobile) { + if ((MENU.isRTL && x - mw - menu.offsetWidth > this.margin) || + (!MENU.isRTL && x + menu.offsetWidth > bodyRight - this.margin)) + {side = "right"; x = Math.max(this.margin,x - mw - menu.offsetWidth + 6)} + } + if (!isPC) { + // in case these ever get implemented + menu.style["borderRadiusTop"+side] = 0; // Opera 10.5 + menu.style["WebkitBorderRadiusTop"+side] = 0; // Safari and Chrome + menu.style["MozBorderRadiusTop"+side] = 0; // Firefox + menu.style["KhtmlBorderRadiusTop"+side] = 0; // Konqueror + } + } + + menu.style.left = x+"px"; menu.style.top = y+"px"; + if (document.selection && document.selection.empty) {document.selection.empty()} + + // Focusing while keeping the scroll position. + var oldX = window.pageXOffset || document.documentElement.scrollLeft; + var oldY = window.pageYOffset || document.documentElement.scrollTop; + MENU.Focus(menu); + if (event.type === "keydown") { + MENU.skipMouseoverFromKey = true; + setTimeout(function() {delete MENU.skipMouseoverFromKey;}, CONFIG.delay); + } + window.scrollTo(oldX, oldY); + return FALSE(event); + }, + + /* + * Remove the menu from the screen + */ + Remove: function (event,menu) { + SIGNAL.Post(["unpost",MENU.jax]); + var div = document.getElementById("MathJax_MenuFrame"); + if (div) { + div.parentNode.removeChild(div); + if (this.msieFixedPositionBug) {detachEvent("onresize",MENU.Resize)} + } + if (MENU.jax.hover) { + delete MENU.jax.hover.nofade; + HOVER.UnHover(MENU.jax); + } + MENU.Unfocus(menu); + if (event.type === "mousedown") MENU.CurrentNode().blur(); + return FALSE(event); + }, + + /* + * Find an item in a menu (or submenu) by name (Find) or ID (FindID). + * A list of names or IDs means descend into submenus. + */ + Find: function (name) {return this.FindN(1,name,[].slice.call(arguments,1))}, + FindId: function (name) {return this.FindN(0,name,[].slice.call(arguments,1))}, + FindN: function (n,name,names) { + for (var i = 0, m = this.items.length; i < m; i++) { + if (this.items[i].name[n] === name) { + if (names.length) { + if (!this.items[i].submenu) {return null} + return this.items[i].submenu.FindN(n,names[0],names.slice(1)); + } + return this.items[i]; + } + } + return null; + }, + + /* + * Find the index of a menu item (so we can insert before or after it) + */ + IndexOf: function (name) {return this.IndexOfN(1,name)}, + IndexOfId: function (name) {return this.IndexOfN(0,name)}, + IndexOfN: function (n,name) { + for (var i = 0, m = this.items.length; i < m; i++) + {if (this.items[i].name[n] === name) {return i}} + return null; + }, + + Right: function(event, menu) { + MENU.Right(event, menu); + }, + Left: function(event, menu) { + MENU.Left(event, menu); + }, + Up: function(event, menu) { + var node = menu.lastChild; + node.menuItem.Activate(event, node); + }, + Down: function(event, menu) { + var node = menu.firstChild; + node.menuItem.Activate(event, node); + }, + Space: function(event, menu) { + this.Remove(event, menu); + } + },{ + + config: CONFIG, + + Remove: function (event) {return MENU.Event(event,this,"Remove")}, + Mouseover: function (event) {return MENU.Event(event,this,"Mouseover")}, + Mouseout: function (event) {return MENU.Event(event,this,"Mouseout")}, + Mousedown: function (event) {return MENU.Event(event,this,"Mousedown")}, + Mouseup: function (event) {return MENU.Event(event,this,"Mouseup")}, + Keydown: function (event) {return MENU.Event(event,this,"Keydown")}, + /* + * Events for mobile devices. + */ + Touchstart: function (event) {return MENU.Event(event,this,"Touchstart")}, + Touchend: function (event) {return MENU.Event(event,this,"Touchend")}, + Close: function (event) { + return MENU.Event(event,this.menu||this.parentNode,(this.menu?"Touchend":"Remove")); + }, + Event: function (event,menu,type,force) { + if (MENU.skipMouseover && type === "Mouseover" && !force) {return FALSE(event)} + if (MENU.skipMouseoverFromKey && type === "Mouseover") { + delete MENU.skipMouseoverFromKey; + return FALSE(event); + } + if (MENU.skipUp) { + if (type.match(/Mouseup|Touchend/)) {delete MENU.skipUp; return FALSE(event)} + if (type === "Touchstart" || + (type === "Mousedown" && !MENU.skipMousedown)) {delete MENU.skipUp} + } + if (!event) {event = window.event} + var item = menu.menuItem; + if (item && item[type]) {return item[type](event,menu)} + return null; + }, + /* + * Style for the background DIV + */ + BGSTYLE: { + position:"absolute", left:0, top:0, "z-index":200, + width:"100%", height:"100%", border:0, padding:0, margin:0 + }, + + Background: function (menu) { + var div = HTML.addElement(document.body,"div", + {style:this.BGSTYLE, id:"MathJax_MenuFrame"}, + [["div",{style: this.BGSTYLE, menuItem: menu, onmousedown: this.Remove}]]); + var bg = div.firstChild; + if (MENU.msieBackgroundBug) { + // MSIE doesn't allow transparent background to be hit boxes, so + // fake it using opacity with solid background color + bg.style.backgroundColor = "white"; bg.style.filter = "alpha(opacity=0)"; + } + if (MENU.msieFixedPositionBug) { + // MSIE can't do fixed position, so use a full-sized background + // and an onresize handler to update it (stupid, but necessary) + div.width = div.height = 0; this.Resize(); + attachEvent("onresize",this.Resize); + } else { + // otherwise, use a fixed position DIV to cover the viewport + bg.style.position = "fixed"; + } + return div; + }, + Resize: function () {setTimeout(MENU.SetWH,0)}, + SetWH: function () { + var bg = document.getElementById("MathJax_MenuFrame"); + if (bg) { + bg = bg.firstChild; + bg.style.width = bg.style.height = "1px"; // so scrollWidth/Height will be right below + bg.style.width = document.body.scrollWidth + "px"; + bg.style.height = document.body.scrollHeight + "px"; + } + }, + + /*************************************************************/ + /* + * Keyboard navigation of menu. + */ + posted: false, // Is a menu open? + active: null, // The focused in HTML node in the menu. + + GetNode: function(jax) { + var node = document.getElementById(jax.inputID + "-Frame"); + return node.isMathJax ? node : node.firstChild; + }, + CurrentNode: function() { + return MENU.GetNode(MENU.jax); + }, + AllNodes: function() { + var jaxs = MathJax.Hub.getAllJax(); + var nodes = []; + for (var i = 0, jax; jax = jaxs[i]; i++) { + nodes.push(MENU.GetNode(jax)); + } + return nodes; + }, + ActiveNode: function() { + return MENU.active; + }, + FocusNode: function(node) { + MENU.active = node; + node.focus(); + }, + // + // Focus is a global affair, since we only ever want a single focused item. + // + Focus: function(menu) { + !MENU.posted ? MENU.Activate(menu) : MENU.ActiveNode().tabIndex = -1; + menu.tabIndex = 0; + MENU.FocusNode(menu); + }, + Activate: function(event, menu) { + MENU.UnsetTabIndex(); + MENU.posted = true; + }, + Unfocus: function() { + MENU.ActiveNode().tabIndex = -1; + MENU.SetTabIndex(); + MENU.FocusNode(MENU.CurrentNode()); + MENU.posted = false; + }, + MoveHorizontal: function(event, menu, move) { + if (!event.shiftKey) return; + var jaxs = MENU.AllNodes(); + var len = jaxs.length; + if (len === 0) return; + var next = jaxs[MENU.Mod(move(MENU.IndexOf(jaxs, MENU.CurrentNode())), len)]; + if (next === MENU.CurrentNode()) return; + MENU.menu.Remove(event, menu); + MENU.jax = MathJax.Hub.getJaxFor(next); + MENU.FocusNode(next); + MENU.menu.Post(null); + }, + Right: function(event, menu) { + MENU.MoveHorizontal(event, menu, function(x) {return x + 1;}); + }, + Left: function(event, menu) { + MENU.MoveHorizontal(event, menu, function(x) {return x - 1;}); + }, + UnsetTabIndex: function () { + var jaxs = MENU.AllNodes(); + for (var j = 0, jax; jax = jaxs[j]; j++) { + if (jax.tabIndex > 0) { + jax.oldTabIndex = jax.tabIndex; + } + jax.tabIndex = -1; + } + }, + SetTabIndex: function () { + var jaxs = MENU.AllNodes(); + for (var j = 0, jax; jax = jaxs[j]; j++) { + if (jax.oldTabIndex !== undefined) { + jax.tabIndex = jax.oldTabIndex + delete jax.oldTabIndex; + } else { + jax.tabIndex = HUB.getTabOrder(jax); + } + } + }, + + //TODO: Move to utility class. + // Computes a mod n. + Mod: function(a, n) { + return ((a % n) + n) % n; + }, + IndexOf: (Array.prototype.indexOf ? + function (A, item, start) {return A.indexOf(item, start);} : + function (A, item, start) { + for (var i = (start || 0), j = A.length; i < j; i++) { + if (item === A[i]) return i; + } + return -1; + }), + + saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)}, + getCookie: function () {this.cookie = HTML.Cookie.Get("menu")} + + }); + + MathJax.Menu.NAV = NAV; + + /*************************************************************/ + /* + * Abstract class of menu items. + */ + var ITEM = MENU.ITEM = NAV.Subclass({ + + name: "", // The menu item's label as [id,label] pair. + node: null, // The HTML node of the item. + menu: null, // The parent menu containing that item. HTML node. + + Attributes: function(def) { + return HUB.Insert( + {onmouseup: MENU.Mouseup, + ondragstart: FALSE, onselectstart: FALSE, onselectend: FALSE, + ontouchstart: MENU.Touchstart, ontouchend: MENU.Touchend, + className: "MathJax_MenuItem", role: this.role, + menuItem: this}, + def); + }, + + Create: function (menu) { + if (!this.hidden) { + var def = this.Attributes(); + var label = this.Label(def,menu); + HTML.addElement(menu, "div", def, label); + } + }, + Name: function () {return _(this.name[0],this.name[1])}, + + Mouseover: function (event,menu) { + if (menu.parentNode === MENU.ActiveNode().parentNode) { + this.Deactivate(MENU.ActiveNode()); + } + this.Activate(event, menu); + }, + Mouseout: function (event,menu) { + this.Deactivate(menu); + }, + Mouseup: function (event,menu) {return this.Remove(event,menu)}, + + + DeactivateSubmenus: function(menu) { + var menus = document.getElementById("MathJax_MenuFrame").childNodes, + items = ITEM.GetMenuNode(menu).childNodes; + for (var i = 0, m = items.length; i < m; i++) { + var item = items[i].menuItem; + // Deactivates submenu items. + if (item && item.submenu && item.submenu.posted && + item !== menu.menuItem) { + item.Deactivate(items[i]); + } + } + this.RemoveSubmenus(menu, menus); + }, + RemoveSubmenus: function(menu, menus) { + menus = menus || document.getElementById("MathJax_MenuFrame").childNodes; + var m = menus.length-1; + while (m >= 0 && ITEM.GetMenuNode(menu).menuItem !== menus[m].menuItem) { + menus[m].menuItem.posted = false; + menus[m].parentNode.removeChild(menus[m]); + m--; + } + }, + + Touchstart: function (event,menu) {return this.TouchEvent(event,menu,"Mousedown")}, + Touchend: function (event,menu) {return this.TouchEvent(event,menu,"Mouseup")}, + TouchEvent: function (event,menu,type) { + if (this !== ITEM.lastItem) { + if (ITEM.lastMenu) {MENU.Event(event,ITEM.lastMenu,"Mouseout")} + MENU.Event(event,menu,"Mouseover",true); + ITEM.lastItem = this; ITEM.lastMenu = menu; + } + if (this.nativeTouch) {return null} + MENU.Event(event,menu,type); + return false; + }, + + Remove: function (event,menu) { + menu = menu.parentNode.menuItem; + return menu.Remove(event,menu); + }, + + With: function (def) {if (def) {HUB.Insert(this,def)}; return this}, + + isRTL: function () {return MENU.isRTL}, + rtlClass: function () {return (this.isRTL() ? " RTL" : "")} + }, { + GetMenuNode: function(item) { + return item.parentNode; + } + }); + + /*************************************************************/ + /* + * Abstract class of menu items that are focusable and perform some action + */ + MENU.ENTRY = MENU.ITEM.Subclass({ + role: "menuitem", // Aria role. + + Attributes: function(def) { + def = HUB.Insert( + {onmouseover: MENU.Mouseover, onmouseout: MENU.Mouseout, + onmousedown: MENU.Mousedown, onkeydown: MENU.Keydown, + "aria-disabled": !!this.disabled}, + def); + def = this.SUPER(arguments).Attributes.call(this, def); + if (this.disabled) { + def.className += " MathJax_MenuDisabled"; + } + return def; + }, + MoveVertical: function(event, item, move) { + var menuNode = ITEM.GetMenuNode(item); + var items = []; + for (var i = 0, allItems = menuNode.menuItem.items, it; + it = allItems[i]; i++) { + if (!it.hidden) { + items.push(it); + } + } + var index = MENU.IndexOf(items, this); + if (index === -1) return; + var len = items.length; + var children = menuNode.childNodes; + do { + index = MENU.Mod(move(index), len); + } while (items[index].hidden || !children[index].role || + children[index].role === "separator"); + this.Deactivate(item); + items[index].Activate(event, children[index]); + }, + Up: function(event, item) { + this.MoveVertical(event, item, function(x) { return x - 1; }); + }, + Down: function(event, item) { + this.MoveVertical(event, item, function(x) { return x + 1; }); + }, + Right: function(event, item) { + this.MoveHorizontal(event, item, MENU.Right, !this.isRTL()); + }, + Left: function(event, item) { + this.MoveHorizontal(event, item, MENU.Left, this.isRTL()); + }, + MoveHorizontal: function(event, item, move, rtl) { + var menuNode = ITEM.GetMenuNode(item); + if (menuNode.menuItem === MENU.menu && event.shiftKey) { + move(event, item); + } + if (rtl) return; + if (menuNode.menuItem !== MENU.menu) { + this.Deactivate(item); + } + var parentNodes = menuNode.previousSibling.childNodes; + var length = parentNodes.length; + while (length--) { + var parent = parentNodes[length]; + if (parent.menuItem.submenu && + parent.menuItem.submenu === menuNode.menuItem) { + MENU.Focus(parent); + break; + } + } + this.RemoveSubmenus(item); + }, + Space: function (event, menu) { + this.Mouseup(event, menu); + }, + + Activate: function (event, menu) { + this.Deactivate(menu); + if (!this.disabled) { + menu.className += " MathJax_MenuActive"; + } + this.DeactivateSubmenus(menu); + MENU.Focus(menu); + }, + Deactivate: function (menu) { + menu.className = menu.className.replace(/ MathJax_MenuActive/,""); + } + + }); + + /*************************************************************/ + /* + * A menu item that performs a command when selected + */ + MENU.ITEM.COMMAND = MENU.ENTRY.Subclass({ + action: function () {}, + + Init: function (name,action,def) { + if (!isArray(name)) {name = [name,name]} // make [id,label] pair + this.name = name; this.action = action; + this.With(def); + }, + + Label: function (def,menu) {return [this.Name()]}, + Mouseup: function (event,menu) { + if (!this.disabled) { + this.Remove(event,menu); + SIGNAL.Post(["command",this]); + this.action.call(this,event); + } + return FALSE(event); + } + }); + + /*************************************************************/ + /* + * A menu item that posts a submenu + */ + MENU.ITEM.SUBMENU = MENU.ENTRY.Subclass({ + submenu: null, // the submenu + marker: "\u25BA", // the submenu arrow + markerRTL: "\u25C4", // the submenu arrow for RTL + + Attributes: function(def) { + def = HUB.Insert({"aria-haspopup": "true"}, def); + def = this.SUPER(arguments).Attributes.call(this, def); + return def; + }, + Init: function (name,def) { + if (!isArray(name)) {name = [name,name]} // make [id,label] pair + this.name = name; var i = 1; + if (!(def instanceof MENU.ITEM)) {this.With(def), i++} + this.submenu = MENU.apply(MENU,[].slice.call(arguments,i)); + }, + Label: function (def,menu) { + this.submenu.posted = false; + return [this.Name()+" ",["span",{ + className:"MathJax_MenuArrow" + this.rtlClass() + },[this.isRTL() ? this.markerRTL : this.marker]]]; + }, + Timer: function (event,menu) { + this.ClearTimer(); + event = {type: event.type, + clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below + this.timer = setTimeout(CALLBACK(["Mouseup",this,event,menu]),CONFIG.delay); + }, + ClearTimer: function() { + if (this.timer) { + clearTimeout(this.timer); + } + }, + Touchend: function (event,menu) { + var forceout = this.submenu.posted; + var result = this.SUPER(arguments).Touchend.apply(this,arguments); + if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu} + return result; + }, + Mouseout: function(event, menu) { + if (!this.submenu.posted) { + this.Deactivate(menu); + } + this.ClearTimer(); + }, + Mouseover: function(event, menu) { + this.Activate(event, menu); + }, + Mouseup: function (event,menu) { + if (!this.disabled) { + if (!this.submenu.posted) { + this.ClearTimer(); + this.submenu.Post(event, menu, this.ltr); + MENU.Focus(menu); + } else { + this.DeactivateSubmenus(menu); + } + } + return FALSE(event); + }, + Activate: function (event, menu) { + if (!this.disabled) { + this.Deactivate(menu); + menu.className += " MathJax_MenuActive"; + } + if (!this.submenu.posted) { + this.DeactivateSubmenus(menu); + if (!MENU.isMobile) { + this.Timer(event,menu); + } + } + MENU.Focus(menu); + }, + MoveVertical: function(event, item, move) { + this.ClearTimer(); + this.SUPER(arguments).MoveVertical.apply(this, arguments); + }, + MoveHorizontal: function(event, menu, move, rtl) { + if (!rtl) { + this.SUPER(arguments).MoveHorizontal.apply(this, arguments); + return; + } + if (this.disabled) return; + if (!this.submenu.posted) { + this.Activate(event, menu); + return; + } + var submenuNodes = ITEM.GetMenuNode(menu).nextSibling.childNodes; + if (submenuNodes.length > 0) { + this.submenu.items[0].Activate(event, submenuNodes[0]); + } + } + }); + + /*************************************************************/ + /* + * A menu item that is one of several radio buttons + */ + MENU.ITEM.RADIO = MENU.ENTRY.Subclass({ + variable: null, // the variable name + marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark + role: "menuitemradio", + + Attributes: function(def) { + var checked = CONFIG.settings[this.variable] === this.value ? "true" : "false"; + def = HUB.Insert({"aria-checked": checked}, def); + def = this.SUPER(arguments).Attributes.call(this, def); + return def; + }, + Init: function (name,variable,def) { + if (!isArray(name)) {name = [name,name]} // make [id,label] pair + this.name = name; this.variable = variable; this.With(def); + if (this.value == null) {this.value = this.name[0]} + }, + Label: function (def,menu) { + var span = {className:"MathJax_MenuRadioCheck" + this.rtlClass()}; + if (CONFIG.settings[this.variable] !== this.value) { + span = {style:{display:"none"}}; + } + return [["span",span,[this.marker]]," "+this.Name()]; + }, + Mouseup: function (event,menu) { + if (!this.disabled) { + var child = menu.parentNode.childNodes; + for (var i = 0, m = child.length; i < m; i++) { + var item = child[i].menuItem; + if (item && item.variable === this.variable) { + child[i].firstChild.style.display = "none"; + } + } + menu.firstChild.display = ""; + CONFIG.settings[this.variable] = this.value; + MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie(); + SIGNAL.Post(["radio button",this]); + } + this.Remove(event,menu); + if (this.action && !this.disabled) {this.action.call(MENU,this)} + return FALSE(event); + } + }); + + /*************************************************************/ + /* + * A menu item that is checkable + */ + MENU.ITEM.CHECKBOX = MENU.ENTRY.Subclass({ + variable: null, // the variable name + marker: "\u2713", // the checkmark + role: "menuitemcheckbox", + + Attributes: function(def) { + var checked = CONFIG.settings[this.variable] ? "true" : "false"; + def = HUB.Insert({"aria-checked": checked}, def); + def = this.SUPER(arguments).Attributes.call(this, def); + return def; + }, + Init: function (name,variable,def) { + if (!isArray(name)) {name = [name,name]} // make [id,label] pair + this.name = name; this.variable = variable; this.With(def); + }, + Label: function (def,menu) { + var span = {className:"MathJax_MenuCheck" + this.rtlClass()}; + if (!CONFIG.settings[this.variable]) {span = {style:{display:"none"}}} + return [["span",span,[this.marker]]," "+this.Name()]; + }, + Mouseup: function (event,menu) { + if (!this.disabled) { + menu.firstChild.display = (CONFIG.settings[this.variable] ? "none" : ""); + CONFIG.settings[this.variable] = !CONFIG.settings[this.variable]; + MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie(); + SIGNAL.Post(["checkbox",this]); + } + this.Remove(event,menu); + if (this.action && !this.disabled) {this.action.call(MENU,this)} + return FALSE(event); + } + }); + + /*************************************************************/ + /* + * A menu item that is a label + */ + MENU.ITEM.LABEL = MENU.ENTRY.Subclass({ + role: "menuitem", // Aria role. + + Init: function (name,def) { + if (!isArray(name)) {name = [name,name]} // make [id,label] pair + this.name = name; this.With(def); + }, + Label: function (def,menu) { + def.className += " MathJax_MenuLabel"; + return [this.Name()]; + }, + Activate: function(event, menu) { + this.Deactivate(menu); + MENU.Focus(menu); + }, + Mouseup: function (event,menu) { } + }); + + /*************************************************************/ + /* + * A rule in a menu + */ + MENU.ITEM.RULE = MENU.ITEM.Subclass({ + role: "separator", + + Attributes: function(def) { + def = HUB.Insert({"aria-orientation": "vertical"}, def); + def = this.SUPER(arguments).Attributes.call(this, def); + return def; + }, + Label: function (def,menu) { + def.className += " MathJax_MenuRule"; + return null; + } + }); + + /*************************************************************/ + /*************************************************************/ + + /* + * Handle the ABOUT box + */ + MENU.About = function (event) { + var font = MENU.About.GetFont(); + var format = MENU.About.GetFormat(); + var jax = ["MathJax.js v"+MathJax.fileversion,["br"]]; + jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); + MENU.About.GetJax(jax,MathJax.InputJax,["InputJax","%1 Input Jax v%2"]); + MENU.About.GetJax(jax,MathJax.OutputJax,["OutputJax","%1 Output Jax v%2"]); + MENU.About.GetJax(jax,MathJax.ElementJax,["ElementJax","%1 Element Jax v%2"]); + jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); + MENU.About.GetJax(jax,MathJax.Extension,["Extension","%1 Extension v%2"],true); + jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[ + HUB.Browser + " v"+HUB.Browser.version + (format ? + " \u2014 " + _(format.replace(/ /g,""),format) : "") + ]]); + MENU.About.div = MENU.Background(MENU.About); + var about = HTML.addElement(MENU.About.div,"div",{ + id: "MathJax_About", tabIndex: 0, onkeydown: MENU.About.Keydown + },[ + ["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"], + _(font.replace(/ /g,""),"using "+font),["br"],["br"], + ["span",{style:{ + display:"inline-block", "text-align":"left", "font-size":"80%", + "max-height":"20em", overflow:"auto", + "background-color":"#E4E4E4", padding:".4em .6em", border:"1px inset" + }, tabIndex: 0},jax],["br"],["br"], + ["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]], + ["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose", + onclick:MENU.About.Remove, + onkeydown: MENU.About.Keydown, tabIndex: 0, role: "button", + "aria-label": _("CloseAboutDialog","Close about MathJax dialog")}, + [["span",{},"\u00D7"]]] + ]); + if (event.type === "mouseup") about.className += " MathJax_MousePost"; + about.focus(); + MathJax.Localization.setCSS(about); + var doc = (document.documentElement||{}); + var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; + if (MENU.prototype.msieAboutBug) { + about.style.width = "20em"; about.style.position = "absolute"; + about.style.left = Math.floor((document.documentElement.scrollWidth - about.offsetWidth)/2)+"px"; + about.style.top = (Math.floor((H-about.offsetHeight)/3)+document.body.scrollTop)+"px"; + } else { + about.style.marginLeft = Math.floor(-about.offsetWidth/2)+"px"; + about.style.top = Math.floor((H-about.offsetHeight)/3)+"px"; + } + }; + MENU.About.Remove = function (event) { + if (MENU.About.div) {document.body.removeChild(MENU.About.div); delete MENU.About.div} + }; + MENU.About.Keydown = function(event) { + if (event.keyCode === KEY.ESCAPE || + (this.id === "MathJax_AboutClose" && + (event.keyCode === KEY.SPACE || event.keyCode === KEY.RETURN))) { + MENU.About.Remove(event); + MENU.CurrentNode().focus(); + FALSE(event); + } + }, + MENU.About.GetJax = function (jax,JAX,type,noTypeCheck) { + var info = []; + for (var id in JAX) {if (JAX.hasOwnProperty(id) && JAX[id]) { + if ((noTypeCheck && JAX[id].version) || (JAX[id].isa && JAX[id].isa(JAX))) + {info.push(_(type[0],type[1],(JAX[id].id||id),JAX[id].version))} + }} + info.sort(); + for (var i = 0, m = info.length; i < m; i++) {jax.push(info[i],["br"])} + return jax; + }; + MENU.About.GetFont = function () { + var jax = MathJax.Hub.outputJax["jax/mml"][0] || {}; + var font = { + SVG: "web SVG", + CommonHTML: "web TeX", + "HTML-CSS": (jax.imgFonts ? "image" : (jax.webFonts ? "web" : "local")+" "+jax.fontInUse) + }[jax.id] || "generic"; + return font + " fonts"; + }; + MENU.About.GetFormat = function () { + var jax = MathJax.Hub.outputJax["jax/mml"][0] || {}; + if (jax.id !== "HTML-CSS"|| !jax.webFonts || jax.imgFonts) return; + return jax.allowWebFonts.replace(/otf/,"woff or otf") + " fonts"; + }; + + + /* + * Handle the MathJax HELP menu + */ + MENU.Help = function (event) { + AJAX.Require("[MathJax]/extensions/HelpDialog.js", + function () {MathJax.Extension.Help.Dialog({type:event.type})}); + }; + + /* + * Handle showing of element's source + */ + MENU.ShowSource = function (event) { + if (!event) {event = window.event} + var EVENT = {screenX:event.screenX, screenY:event.screenY}; + if (!MENU.jax) return; + if (this.format === "MathML") { + var MML = MathJax.ElementJax.mml; + if (MML && typeof(MML.mbase.prototype.toMathML) !== "undefined") { + // toMathML() can call MathJax.Hub.RestartAfter, so trap errors and check + try {MENU.ShowSource.Text(MENU.jax.root.toMathML("",MENU.jax),event)} catch (err) { + if (!err.restart) {throw err} + CALLBACK.After([this,MENU.ShowSource,EVENT],err.restart); + } + } else if (!AJAX.loadingToMathML) { + AJAX.loadingToMathML = true; + MENU.ShowSource.Window(event); // WeBKit needs to open window on click event + CALLBACK.Queue( + AJAX.Require("[MathJax]/extensions/toMathML.js"), + function () { + delete AJAX.loadingToMathML; + if (!MML.mbase.prototype.toMathML) {MML.mbase.prototype.toMathML = function () {}} + }, + [this,MENU.ShowSource,EVENT] // call this function again + ); + return; + } + } else if (this.format === "Error") { + MENU.ShowSource.Text(MENU.jax.errorText,event); + } else if (CONFIG.semanticsAnnotations[this.format]) { + var annotation = MENU.jax.root.getAnnotation(this.format); + if (annotation.data[0]) MENU.ShowSource.Text(annotation.data[0].toString()); + } else { + if (MENU.jax.originalText == null) { + alert(_("NoOriginalForm","No original form available")); + return; + } + MENU.ShowSource.Text(MENU.jax.originalText,event); + } + }; + MENU.ShowSource.Window = function (event) { + if (!MENU.ShowSource.w) { + var def = [], DEF = CONFIG.windowSettings; + for (var id in DEF) {if (DEF.hasOwnProperty(id)) {def.push(id+"="+DEF[id])}} + MENU.ShowSource.w = window.open("","_blank",def.join(",")); + } + return MENU.ShowSource.w; + }; + MENU.ShowSource.Text = function (text,event) { + var w = MENU.ShowSource.Window(event); delete MENU.ShowSource.w; + text = text.replace(/^\s*/,"").replace(/\s*$/,""); + text = text.replace(/&/g,"&").replace(//g,">"); + var title = _("EqSource","MathJax Equation Source"); + if (MENU.isMobile) { + w.document.open(); + w.document.write(""+title+""); + w.document.write("
"+text+"
"); + w.document.write("
"); + w.document.write(""); + w.document.close(); + } else { + w.document.open(); + w.document.write(""+title+""); + w.document.write("
"+text+"
"); + w.document.write(""); + w.document.close(); + var table = w.document.body.firstChild; + setTimeout(function () { + var H = (w.outerHeight-w.innerHeight)||30, W = (w.outerWidth-w.innerWidth)||30, x, y; + W = Math.max(140,Math.min(Math.floor(.5*screen.width),table.offsetWidth+W+25)); + H = Math.max(40,Math.min(Math.floor(.5*screen.height),table.offsetHeight+H+25)); + if (MENU.prototype.msieHeightBug) {H += 35}; // for title bar in XP + w.resizeTo(W,H); + var X; try {X = event.screenX} catch (e) {}; // IE8 throws an error accessing screenX + if (event && X != null) { + x = Math.max(0,Math.min(event.screenX-Math.floor(W/2), screen.width-W-20)); + y = Math.max(0,Math.min(event.screenY-Math.floor(H/2), screen.height-H-20)); + w.moveTo(x,y); + } + },50); + } + }; + + /* + * Handle rescaling all the math + */ + MENU.Scale = function () { + var JAX = ["CommonHTML","HTML-CSS","SVG","NativeMML","PreviewHTML"], m = JAX.length, + SCALE = 100, i, jax; + for (i = 0; i < m; i++) { + jax = OUTPUT[JAX[i]]; + if (jax) {SCALE = jax.config.scale; break} + } + var scale = prompt(_("ScaleMath","Scale all mathematics (compared to surrounding text) by"),SCALE+"%"); + if (scale) { + if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) { + scale = parseFloat(scale); + if (scale) { + if (scale !== SCALE) { + for (i = 0; i < m; i++) { + jax = OUTPUT[JAX[i]]; + if (jax) jax.config.scale = scale; + } + MENU.cookie.scale = HUB.config.scale = scale; + MENU.saveCookie(); + HUB.Queue(["Rerender",HUB]); + } + } else {alert(_("NonZeroScale","The scale should not be zero"))} + } else {alert(_("PercentScale", + "The scale should be a percentage (e.g., 120%%)"))} + } + }; + + /* + * Handle loading the zoom code + */ + MENU.Zoom = function () { + if (!MathJax.Extension.MathZoom) {AJAX.Require("[MathJax]/extensions/MathZoom.js")} + }; + + /* + * Handle changing the renderer + */ + MENU.Renderer = function () { + var jax = HUB.outputJax["jax/mml"]; + if (jax[0] !== CONFIG.settings.renderer) { + var BROWSER = HUB.Browser, message, MESSAGE = MENU.Renderer.Messages, warned; + // + // Check that the new renderer is appropriate for the browser + // + switch (CONFIG.settings.renderer) { + case "NativeMML": + if (!CONFIG.settings.warnedMML) { + if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit} + else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit} + else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}} + else if (BROWSER.isEdge) {message = MESSAGE.MML.WebKit} + else {message = MESSAGE.MML[BROWSER]} + warned = "warnedMML"; + } + break; + + case "SVG": + if (!CONFIG.settings.warnedSVG) { + if (BROWSER.isMSIE && !isIE9) {message = MESSAGE.SVG.MSIE} + } + break; + } + if (message) { + message = _(message[0],message[1]); + message += "\n\n"; + message += _("SwitchAnyway", + "Switch the renderer anyway?\n\n" + + "(Press OK to switch, CANCEL to continue with the current renderer)"); + MENU.cookie.renderer = jax[0].id; MENU.saveCookie(); + if (!confirm(message)) { + MENU.cookie.renderer = CONFIG.settings.renderer = HTML.Cookie.Get("menu").renderer; + MENU.saveCookie(); + return; + } + if (warned) {MENU.cookie.warned = CONFIG.settings.warned = true} + MENU.cookie.renderer = CONFIG.settings.renderer; MENU.saveCookie(); + } + HUB.Queue( + ["setRenderer",HUB,CONFIG.settings.renderer,"jax/mml"], + ["Rerender",HUB] + ); + } + }; + MENU.Renderer.Messages = { + MML: { + WebKit: ["WebkitNativeMMLWarning", + "Your browser doesn't seem to support MathML natively, " + + "so switching to MathML output may cause the mathematics " + + "on the page to become unreadable."], + + MSIE: ["MSIENativeMMLWarning", + "Internet Explorer requires the MathPlayer plugin " + + "in order to process MathML output."], + + Opera: ["OperaNativeMMLWarning", + "Opera's support for MathML is limited, so switching to " + + "MathML output may cause some expressions to render poorly."], + + Safari: ["SafariNativeMMLWarning", + "Your browser's native MathML does not implement all the features " + + "used by MathJax, so some expressions may not render properly."], + + Firefox: ["FirefoxNativeMMLWarning", + "Your browser's native MathML does not implement all the features " + + "used by MathJax, so some expressions may not render properly."] + }, + + SVG: { + MSIE: ["MSIESVGWarning", + "SVG is not implemented in Internet Explorer prior to " + + "IE9 or when it is emulating IE8 or below. " + + "Switching to SVG output will cause the mathematics to " + + "not display properly."] + } + }; + + /* + * Toggle assistive MML settings + */ + MENU.AssistiveMML = function (item,restart) { + var AMML = MathJax.Extension.AssistiveMML; + if (!AMML) { + // Try to load the extension, but only try once. + if (!restart) + AJAX.Require("[MathJax]/extensions/AssistiveMML.js",["AssistiveMML",MENU,item,true]); + return; + } + MathJax.Hub.Queue([(CONFIG.settings.assistiveMML ? "Add" : "Remove")+"AssistiveMathML",AMML]); + }; + + /* + * Handle setting the HTMLCSS fonts + */ + MENU.Font = function () { + var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return; + document.location.reload(); + }; + + /* + * Handle selection of locale and rerender the page + */ + MENU.Locale = function () { + MathJax.Localization.setLocale(CONFIG.settings.locale); + MathJax.Hub.Queue(["Reprocess",MathJax.Hub]); // FIXME: Just reprocess error messages? + }; + MENU.LoadLocale = function () { + var url = prompt(_("LoadURL","Load translation data from this URL:")); + if (url) { + if (!url.match(/\.js$/)) { + alert(_("BadURL", + "The URL should be for a javascript file that defines MathJax translation data. " + + "Javascript file names should end with '.js'" + )); + } + AJAX.Require(url,function (status) { + if (status != AJAX.STATUS.OK) {alert(_("BadData","Failed to load translation data from %1",url))} + }); + } + }; + + /* + * Handle setting MathPlayer events + */ + MENU.MPEvents = function (item) { + var discoverable = CONFIG.settings.discoverable, + MESSAGE = MENU.MPEvents.Messages; + if (!isIE9) { + if (CONFIG.settings.mpMouse && !confirm(_.apply(_,MESSAGE.IE8warning))) { + delete MENU.cookie.mpContext; delete CONFIG.settings.mpContext; + delete MENU.cookie.mpMouse; delete CONFIG.settings.mpMouse; + MENU.saveCookie(); + return; + } + CONFIG.settings.mpContext = CONFIG.settings.mpMouse; + MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse; + MENU.saveCookie(); + MathJax.Hub.Queue(["Rerender",MathJax.Hub]) + } else if (!discoverable && item.name[1] === "Menu Events" && CONFIG.settings.mpContext) { + alert(_.apply(_,MESSAGE.IE9warning)); + } + }; + + MENU.MPEvents.Messages = { + IE8warning: ["IE8warning", + "This will disable the MathJax menu and zoom features, " + + "but you can Alt-Click on an expression to obtain the MathJax " + + "menu instead.\n\nReally change the MathPlayer settings?"], + + IE9warning: ["IE9warning", + "The MathJax contextual menu will be disabled, but you can " + + "Alt-Click on an expression to obtain the MathJax menu instead."] + }; + + /*************************************************************/ + /*************************************************************/ + + HUB.Browser.Select({ + MSIE: function (browser) { + var quirks = (document.compatMode === "BackCompat"); + var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7; + MENU.Augment({ + margin: 20, + msieBackgroundBug: ((document.documentMode||0) < 9), + msieFixedPositionBug: (quirks || !isIE8), + msieAboutBug: quirks, + msieHeightBug: ((document.documentMode||0) < 9) + // height of window doesn't include title bar in XP + }); + if (isIE9) { + delete CONFIG.styles["#MathJax_About"].filter; + delete CONFIG.styles[".MathJax_Menu"].filter; + } + }, + Firefox: function (browser) { + MENU.skipMouseover = browser.isMobile && browser.versionAtLeast("6.0"); + MENU.skipMousedown = browser.isMobile; + } + }); + MENU.isMobile = HUB.Browser.isMobile; + MENU.noContextMenu = HUB.Browser.noContextMenu; + + /*************************************************************/ + + // + // Creates the locale menu from the list of locales in MathJax.Localization.strings + // + MENU.CreateLocaleMenu = function () { + if (!MENU.menu) return; + var menu = MENU.menu.Find("Language").submenu, items = menu.items; + // + // Get the names of the languages and sort them + // + var locales = [], LOCALE = MathJax.Localization.strings; + for (var id in LOCALE) {if (LOCALE.hasOwnProperty(id)) {locales.push(id)}} + locales = locales.sort(); menu.items = []; + // + // Add a menu item for each + // + for (var i = 0, m = locales.length; i < m; i++) { + var title = LOCALE[locales[i]].menuTitle; + if (title) {title += " ("+locales[i]+")"} else {title = locales[i]} + menu.items.push(ITEM.RADIO([locales[i],title],"locale",{action:MENU.Locale})); + } + // + // Add the rule and "Load from URL" items + // + menu.items.push(items[items.length-2],items[items.length-1]); + }; + + // + // Create the annotation menu from MathJax.Hub.config.semanticsAnnotations + // + MENU.CreateAnnotationMenu = function () { + if (!MENU.menu) return; + var menu = MENU.menu.Find("Show Math As","Annotation").submenu; + var annotations = CONFIG.semanticsAnnotations; + for (var a in annotations) { + if (annotations.hasOwnProperty(a)) { + menu.items.push(ITEM.COMMAND([a,a], MENU.ShowSource, {hidden: true, nativeTouch: true, format: a})); + } + } + }; + + /*************************************************************/ + + HUB.Register.StartupHook("End Config",function () { + + /* + * Get the menu settings from the HUB (which includes the + * data from the cookie already), and add the format, if + * it wasn't set in the cookie. + */ + CONFIG.settings = HUB.config.menuSettings; + if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer} + if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu} + if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext} + MENU.getCookie(); + + /* + * The main menu + */ + // Localization: items used as key, should be refactored. + MENU.menu = MENU( + ITEM.SUBMENU(["Show","Show Math As"], + ITEM.COMMAND(["MathMLcode","MathML Code"], MENU.ShowSource, {nativeTouch: true, format: "MathML"}), + ITEM.COMMAND(["Original","Original Form"], MENU.ShowSource, {nativeTouch: true}), + ITEM.SUBMENU(["Annotation","Annotation"], {disabled:true}), + ITEM.RULE(), + ITEM.CHECKBOX(["texHints","Show TeX hints in MathML"], "texHints"), + ITEM.CHECKBOX(["semantics","Add original form as annotation"], "semantics") + ), + ITEM.RULE(), + ITEM.SUBMENU(["Settings","Math Settings"], + ITEM.SUBMENU(["ZoomTrigger","Zoom Trigger"], + ITEM.RADIO(["Hover","Hover"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["Click","Click"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["DoubleClick","Double-Click"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["NoZoom","No Zoom"], "zoom", {value: "None"}), + ITEM.RULE(), + ITEM.LABEL(["TriggerRequires","Trigger Requires:"]), + ITEM.CHECKBOX((HUB.Browser.isMac ? ["Option","Option"] : ["Alt","Alt"]), "ALT"), + ITEM.CHECKBOX(["Command","Command"], "CMD", {hidden: !HUB.Browser.isMac}), + ITEM.CHECKBOX(["Control","Control"], "CTRL", {hidden: HUB.Browser.isMac}), + ITEM.CHECKBOX(["Shift","Shift"], "Shift") + ), + ITEM.SUBMENU(["ZoomFactor","Zoom Factor"], + ITEM.RADIO("125%", "zscale"), + ITEM.RADIO("133%", "zscale"), + ITEM.RADIO("150%", "zscale"), + ITEM.RADIO("175%", "zscale"), + ITEM.RADIO("200%", "zscale"), + ITEM.RADIO("250%", "zscale"), + ITEM.RADIO("300%", "zscale"), + ITEM.RADIO("400%", "zscale") + ), + ITEM.RULE(), + ITEM.SUBMENU(["Renderer","Math Renderer"], {hidden:!CONFIG.showRenderer}, + ITEM.RADIO(["HTML-CSS","HTML-CSS"], "renderer", {action: MENU.Renderer}), + ITEM.RADIO(["CommonHTML","Common HTML"], "renderer", {action: MENU.Renderer, value:"CommonHTML"}), + ITEM.RADIO(["PreviewHTML","Preview HTML"],"renderer", {action: MENU.Renderer, value:"PreviewHTML"}), + ITEM.RADIO(["MathML","MathML"], "renderer", {action: MENU.Renderer, value:"NativeMML"}), + ITEM.RADIO(["SVG","SVG"], "renderer", {action: MENU.Renderer}), + ITEM.RADIO(["PlainSource","Plain Source"],"renderer", {action: MENU.Renderer, value:"PlainSource"}), + ITEM.RULE(), + ITEM.CHECKBOX(["FastPreview","Fast Preview"], "FastPreview") + ), + ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || !CONFIG.showMathPlayer, + disabled:!HUB.Browser.hasMathPlayer}, + ITEM.LABEL(["MPHandles","Let MathPlayer Handle:"]), + ITEM.CHECKBOX(["MenuEvents","Menu Events"], "mpContext", {action: MENU.MPEvents, hidden:!isIE9}), + ITEM.CHECKBOX(["MouseEvents","Mouse Events"], "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}), + ITEM.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"], "mpMouse", {action: MENU.MPEvents, hidden:isIE9}) + ), + ITEM.SUBMENU(["FontPrefs","Font Preference"], {hidden:!CONFIG.showFontMenu}, + ITEM.LABEL(["ForHTMLCSS","For HTML-CSS:"]), + ITEM.RADIO(["Auto","Auto"], "font", {action: MENU.Font}), + ITEM.RULE(), + ITEM.RADIO(["TeXLocal","TeX (local)"], "font", {action: MENU.Font}), + ITEM.RADIO(["TeXWeb","TeX (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["TeXImage","TeX (image)"], "font", {action: MENU.Font}), + ITEM.RULE(), + ITEM.RADIO(["STIXLocal","STIX (local)"], "font", {action: MENU.Font}), + ITEM.RADIO(["STIXWeb","STIX (web)"], "font", {action: MENU.Font}), + ITEM.RULE(), + ITEM.RADIO(["AsanaMathWeb","Asana Math (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["GyrePagellaWeb","Gyre Pagella (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["GyreTermesWeb","Gyre Termes (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["LatinModernWeb","Latin Modern (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["NeoEulerWeb","Neo Euler (web)"], "font", {action: MENU.Font}) + ), + ITEM.SUBMENU(["ContextMenu","Contextual Menu"], {hidden:!CONFIG.showContext}, + ITEM.RADIO(["MathJax","MathJax"], "context"), + ITEM.RADIO(["Browser","Browser"], "context") + ), + ITEM.COMMAND(["Scale","Scale All Math ..."],MENU.Scale), + ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:["","discover_rule"]}), + ITEM.CHECKBOX(["Discoverable","Highlight on Hover"], "discoverable", {hidden:!CONFIG.showDiscoverable}) + ), + ITEM.SUBMENU(["Accessibility","Accessibility"], + ITEM.CHECKBOX(["AssistiveMML","Assistive MathML"], "assistiveMML", {action:MENU.AssistiveMML}), + ITEM.CHECKBOX(["InTabOrder","Include in Tab Order"], "inTabOrder") + ), + ITEM.SUBMENU(["Locale","Language"], {hidden:!CONFIG.showLocale, ltr:true}, + ITEM.RADIO("en", "locale", {action: MENU.Locale}), + ITEM.RULE().With({hidden:!CONFIG.showLocaleURL, name:["","localURL_rule"]}), + ITEM.COMMAND(["LoadLocale","Load from URL ..."], MENU.LoadLocale, {hidden:!CONFIG.showLocaleURL}) + ), + ITEM.RULE(), + ITEM.COMMAND(["About","About MathJax"],MENU.About), + ITEM.COMMAND(["Help","MathJax Help"],MENU.Help) + ); + + if (MENU.isMobile) { + (function () { + var settings = CONFIG.settings; + var trigger = MENU.menu.Find("Math Settings","Zoom Trigger").submenu; + trigger.items[0].disabled = trigger.items[1].disabled = true; + if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"} + trigger.items = trigger.items.slice(0,4); + + if (navigator.appVersion.match(/[ (]Android[) ]/)) { + MENU.ITEM.SUBMENU.Augment({marker: "\u00BB"}); + } + })(); + } + + MENU.CreateLocaleMenu(); + MENU.CreateAnnotationMenu(); + }); + + MENU.showRenderer = function (show) { + MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie(); + MENU.menu.Find("Math Settings","Math Renderer").hidden = !show; + }; + MENU.showMathPlayer = function (show) { + MENU.cookie.showMathPlayer = CONFIG.showMathPlayer = show; MENU.saveCookie(); + MENU.menu.Find("Math Settings","MathPlayer").hidden = !show; + }; + MENU.showFontMenu = function (show) { + MENU.cookie.showFontMenu = CONFIG.showFontMenu = show; MENU.saveCookie(); + MENU.menu.Find("Math Settings","Font Preference").hidden = !show; + }; + MENU.showContext = function (show) { + MENU.cookie.showContext = CONFIG.showContext = show; MENU.saveCookie(); + MENU.menu.Find("Math Settings","Contextual Menu").hidden = !show; + }; + MENU.showDiscoverable = function (show) { + MENU.cookie.showDiscoverable = CONFIG.showDiscoverable = show; MENU.saveCookie(); + MENU.menu.Find("Math Settings","Highlight on Hover").hidden = !show; + MENU.menu.Find("Math Settings","discover_rule").hidden = !show; + }; + MENU.showLocale = function (show) { + MENU.cookie.showLocale = CONFIG.showLocale = show; MENU.saveCookie(); + MENU.menu.Find("Language").hidden = !show; + }; + + MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { + if (!MathJax.OutputJax["HTML-CSS"].config.imageFont) + {MENU.menu.Find("Math Settings","Font Preference","TeX (image)").disabled = true} + }); + + /*************************************************************/ + + CALLBACK.Queue( + HUB.Register.StartupHook("End Config",{}), // wait until config is complete + ["Styles",AJAX,CONFIG.styles], + ["Post",HUB.Startup.signal,"MathMenu Ready"], + ["loadComplete",AJAX,"[MathJax]/extensions/MathMenu.js"] + ); + +})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.CallBack,MathJax.OutputJax); +// @license-end diff --git a/js/mathjax/extensions/MathZoom.js b/js/mathjax/extensions/MathZoom.js new file mode 100644 index 0000000..610746d --- /dev/null +++ b/js/mathjax/extensions/MathZoom.js @@ -0,0 +1,368 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/MathZoom.js + * + * Implements the zoom feature for enlarging math expressions. It is + * loaded automatically when the Zoom menu selection changes from "None". + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML,AJAX,HTMLCSS,nMML) { + var VERSION = "2.7.9"; + + var CONFIG = HUB.CombineConfig("MathZoom",{ + styles: { + // + // The styles for the MathZoom display box + // + "#MathJax_Zoom": { + position:"absolute", "background-color":"#F0F0F0", overflow:"auto", + display:"block", "z-index":301, padding:".5em", border:"1px solid black", margin:0, + "font-weight":"normal", "font-style":"normal", + "text-align":"left", "text-indent":0, "text-transform":"none", + "line-height":"normal", "letter-spacing":"normal", "word-spacing":"normal", + "word-wrap":"normal", "white-space":"nowrap", "float":"none", + "-webkit-box-sizing":"content-box", // Android ≤ 2.3, iOS ≤ 4 + "-moz-box-sizing":"content-box", // Firefox ≤ 28 + "box-sizing":"content-box", // Chrome, Firefox 29+, IE 8+, Opera, Safari 5.1 + "box-shadow":"5px 5px 15px #AAAAAA", // Opera 10.5 and IE9 + "-webkit-box-shadow":"5px 5px 15px #AAAAAA", // Safari 3 and Chrome + "-moz-box-shadow":"5px 5px 15px #AAAAAA", // Forefox 3.5 + "-khtml-box-shadow":"5px 5px 15px #AAAAAA", // Konqueror + filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')" // IE + }, + + // + // The styles for the hidden overlay (should not need to be adjusted by the page author) + // + "#MathJax_ZoomOverlay": { + position:"absolute", left:0, top:0, "z-index":300, display:"inline-block", + width:"100%", height:"100%", border:0, padding:0, margin:0, + "background-color":"white", opacity:0, filter:"alpha(opacity=0)" + }, + + "#MathJax_ZoomFrame": { + position:"relative", display:"inline-block", + height:0, width:0 + }, + + "#MathJax_ZoomEventTrap": { + position:"absolute", left:0, top:0, "z-index":302, + display:"inline-block", border:0, padding:0, margin:0, + "background-color":"white", opacity:0, filter:"alpha(opacity=0)" + } + } + }); + + var FALSE, HOVER, EVENT; + MathJax.Hub.Register.StartupHook("MathEvents Ready",function () { + EVENT = MathJax.Extension.MathEvents.Event; + FALSE = MathJax.Extension.MathEvents.Event.False; + HOVER = MathJax.Extension.MathEvents.Hover; + }); + + /*************************************************************/ + + var ZOOM = MathJax.Extension.MathZoom = { + version: VERSION, + settings: HUB.config.menuSettings, + scrollSize: 18, // width of scrool bars + + // + // Process events passed from output jax + // + HandleEvent: function (event,type,math) { + if (ZOOM.settings.CTRL && !event.ctrlKey) return true; + if (ZOOM.settings.ALT && !event.altKey) return true; + if (ZOOM.settings.CMD && !event.metaKey) return true; + if (ZOOM.settings.Shift && !event.shiftKey) return true; + if (!ZOOM[type]) return true; + return ZOOM[type](event,math); + }, + + // + // Zoom on click + // + Click: function (event,math) { + if (this.settings.zoom === "Click") {return this.Zoom(event,math)} + }, + + // + // Zoom on double click + // + DblClick: function (event,math) { + if (this.settings.zoom === "Double-Click" || this.settings.zoom === "DoubleClick") {return this.Zoom(event,math)} + }, + + // + // Zoom on hover (called by MathEvents.Hover) + // + Hover: function (event,math) { + if (this.settings.zoom === "Hover") {this.Zoom(event,math); return true} + return false; + }, + + + // + // Handle the actual zooming + // + Zoom: function (event,math) { + // + // Remove any other zoom and clear timers + // + this.Remove(); HOVER.ClearHoverTimer(); EVENT.ClearSelection(); + + // + // Find the jax + // + var JAX = MathJax.OutputJax[math.jaxID]; + var jax = JAX.getJaxFromMath(math); + if (jax.hover) {HOVER.UnHover(jax)} + + // + // Create the DOM elements for the zoom box + // + var container = this.findContainer(math); + var Mw = Math.floor(.85*container.clientWidth), + Mh = Math.max(document.body.clientHeight,document.documentElement.clientHeight); + if (this.getOverflow(container) !== "visible") {Mh = Math.min(container.clientHeight,Mh)} + Mh = Math.floor(.85*Mh); + var div = HTML.Element( + "span",{id:"MathJax_ZoomFrame"},[ + ["span",{id:"MathJax_ZoomOverlay", onmousedown:this.Remove}], + ["span",{ + id:"MathJax_Zoom", onclick:this.Remove, + style:{visibility:"hidden", fontSize:this.settings.zscale} + },[["span",{style:{display:"inline-block", "white-space":"nowrap"}}]] + ]] + ); + var zoom = div.lastChild, span = zoom.firstChild, overlay = div.firstChild; + math.parentNode.insertBefore(div,math); math.parentNode.insertBefore(math,div); // put div after math + if (span.addEventListener) {span.addEventListener("mousedown",this.Remove,true)} + var eW = zoom.offsetWidth || zoom.clientWidth; Mw -= eW; Mh -= eW; + zoom.style.maxWidth = Mw+"px"; zoom.style.maxHeight = Mh+"px"; + + if (this.msieTrapEventBug) { + var trap = HTML.Element("span",{id:"MathJax_ZoomEventTrap", onmousedown:this.Remove}); + div.insertBefore(trap,zoom); + } + + // + // Display the zoomed math + // + if (this.msieZIndexBug) { + // MSIE doesn't do z-index properly, so move the div to the document.body, + // and use an image as a tracker for the usual position + var tracker = HTML.addElement(document.body,"img",{ + src:"about:blank", id:"MathJax_ZoomTracker", width:0, height:0, + style:{width:0, height:0, position:"relative"} + }); + div.style.position = "relative"; + div.style.zIndex = CONFIG.styles["#MathJax_ZoomOverlay"]["z-index"]; + div = tracker; + } + + var bbox = JAX.Zoom(jax,span,math,Mw,Mh); + + // + // Fix up size and position for browsers with bugs (IE) + // + if (this.msiePositionBug) { + if (this.msieSizeBug) + {zoom.style.height = bbox.zH+"px"; zoom.style.width = bbox.zW+"px"} // IE8 gets the dimensions completely wrong + if (zoom.offsetHeight > Mh) {zoom.style.height = Mh+"px"; zoom.style.width = (bbox.zW+this.scrollSize)+"px"} // IE doesn't do max-height? + if (zoom.offsetWidth > Mw) {zoom.style.width = Mw+"px"; zoom.style.height = (bbox.zH+this.scrollSize)+"px"} + } + if (this.operaPositionBug) {zoom.style.width = Math.min(Mw,bbox.zW)+"px"} // Opera gets width as 0? + if (zoom.offsetWidth > eW && zoom.offsetWidth-eW < Mw && zoom.offsetHeight-eW < Mh) + {zoom.style.overflow = "visible"} // don't show scroll bars if we don't need to + this.Position(zoom,bbox); + if (this.msieTrapEventBug) { + trap.style.height = zoom.clientHeight+"px"; trap.style.width = zoom.clientWidth+"px"; + trap.style.left = (parseFloat(zoom.style.left)+zoom.clientLeft)+"px"; + trap.style.top = (parseFloat(zoom.style.top)+zoom.clientTop)+"px"; + } + zoom.style.visibility = ""; + + // + // Add event handlers + // + if (this.settings.zoom === "Hover") {overlay.onmouseover = this.Remove} + if (window.addEventListener) {addEventListener("resize",this.Resize,false)} + else if (window.attachEvent) {attachEvent("onresize",this.Resize)} + else {this.onresize = window.onresize; window.onresize = this.Resize} + + // + // Let others know about the zoomed math + // + HUB.signal.Post(["math zoomed",jax]); + + // + // Canel further actions + // + return FALSE(event); + }, + + // + // Set the position of the zoom box and overlay + // + Position: function (zoom,bbox) { + zoom.style.display = "none"; // avoids getting excessive width in Resize() + var XY = this.Resize(), x = XY.x, y = XY.y, W = bbox.mW; + zoom.style.display = ""; + var dx = -W-Math.floor((zoom.offsetWidth-W)/2), dy = bbox.Y; + zoom.style.left = Math.max(dx,10-x)+"px"; zoom.style.top = Math.max(dy,10-y)+"px"; + if (!ZOOM.msiePositionBug) {ZOOM.SetWH()} // refigure overlay width/height + }, + + // + // Handle resizing of overlay while zoom is displayed + // + Resize: function (event) { + if (ZOOM.onresize) {ZOOM.onresize(event)} + var div = document.getElementById("MathJax_ZoomFrame"), + overlay = document.getElementById("MathJax_ZoomOverlay"); + var xy = ZOOM.getXY(div), obj = ZOOM.findContainer(div); + if (ZOOM.getOverflow(obj) !== "visible") { + overlay.scroll_parent = obj; // Save this for future reference. + var XY = ZOOM.getXY(obj); // Remove container position + xy.x -= XY.x; xy.y -= XY.y; + XY = ZOOM.getBorder(obj); // Remove container border + xy.x -= XY.x; xy.y -= XY.y; + } + overlay.style.left = (-xy.x)+"px"; overlay.style.top = (-xy.y)+"px"; + if (ZOOM.msiePositionBug) {setTimeout(ZOOM.SetWH,0)} else {ZOOM.SetWH()} + return xy; + }, + SetWH: function () { + var overlay = document.getElementById("MathJax_ZoomOverlay"); + if (!overlay) return; + overlay.style.display = "none"; // so scrollWidth/Height will be right below + var doc = overlay.scroll_parent || document.documentElement || document.body; + overlay.style.width = doc.scrollWidth + "px"; + overlay.style.height = Math.max(doc.clientHeight,doc.scrollHeight) + "px"; + overlay.style.display = ""; + }, + findContainer: function (obj) { + obj = obj.parentNode; + while (obj.parentNode && obj !== document.body && ZOOM.getOverflow(obj) === "visible") + {obj = obj.parentNode} + return obj; + }, + // + // Look up CSS properties (use getComputeStyle if available, or currentStyle if not) + // + getOverflow: (window.getComputedStyle ? + function (obj) {return getComputedStyle(obj).overflow} : + function (obj) {return (obj.currentStyle||{overflow:"visible"}).overflow}), + getBorder: function (obj) { + var size = {thin: 1, medium: 2, thick: 3}; + var style = (window.getComputedStyle ? getComputedStyle(obj) : + (obj.currentStyle || {borderLeftWidth:0,borderTopWidth:0})); + var x = style.borderLeftWidth, y = style.borderTopWidth; + if (size[x]) {x = size[x]} else {x = parseInt(x)} + if (size[y]) {y = size[y]} else {y = parseInt(y)} + return {x:x, y:y}; + }, + // + // Get the position of an element on the page + // + getXY: function (div) { + var x = 0, y = 0, obj; + obj = div; while (obj.offsetParent) {x += obj.offsetLeft; obj = obj.offsetParent} + if (ZOOM.operaPositionBug) {div.style.border = "1px solid"} // to get vertical position right + obj = div; while (obj.offsetParent) {y += obj.offsetTop; obj = obj.offsetParent} + if (ZOOM.operaPositionBug) {div.style.border = ""} + return {x:x, y:y}; + }, + + // + // Remove zoom display and event handlers + // + Remove: function (event) { + var div = document.getElementById("MathJax_ZoomFrame"); + if (div) { + var JAX = MathJax.OutputJax[div.previousSibling.jaxID]; + var jax = JAX.getJaxFromMath(div.previousSibling); + HUB.signal.Post(["math unzoomed",jax]); + div.parentNode.removeChild(div); + div = document.getElementById("MathJax_ZoomTracker"); + if (div) {div.parentNode.removeChild(div)} + if (ZOOM.operaRefreshBug) { + // force a redisplay of the page + // (Opera doesn't refresh properly after the zoom is removed) + var overlay = HTML.addElement(document.body,"div",{ + style:{position:"fixed", left:0, top:0, width:"100%", height:"100%", + backgroundColor:"white", opacity:0}, + id: "MathJax_OperaDiv" + }); + document.body.removeChild(overlay); + } + if (window.removeEventListener) {removeEventListener("resize",ZOOM.Resize,false)} + else if (window.detachEvent) {detachEvent("onresize",ZOOM.Resize)} + else {window.onresize = ZOOM.onresize; delete ZOOM.onresize} + } + return FALSE(event); + } + + }; + + + /*************************************************************/ + + HUB.Browser.Select({ + MSIE: function (browser) { + var mode = (document.documentMode || 0); + var isIE9 = (mode >= 9); + ZOOM.msiePositionBug = !isIE9; + ZOOM.msieSizeBug = browser.versionAtLeast("7.0") && + (!document.documentMode || mode === 7 || mode === 8); + ZOOM.msieZIndexBug = (mode <= 7); + ZOOM.msieInlineBlockAlignBug = (mode <= 7); + ZOOM.msieTrapEventBug = !window.addEventListener; + if (document.compatMode === "BackCompat") {ZOOM.scrollSize = 52} // don't know why this is so far off + if (isIE9) {delete CONFIG.styles["#MathJax_Zoom"].filter} + }, + + Opera: function (browser) { + ZOOM.operaPositionBug = true; + ZOOM.operaRefreshBug = true; + } + }); + + ZOOM.topImg = (ZOOM.msieInlineBlockAlignBug ? + HTML.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}) : + HTML.Element("span",{style:{width:0,height:0,display:"inline-block"}}) + ); + if (ZOOM.operaPositionBug || ZOOM.msieTopBug) {ZOOM.topImg.style.border="1px solid"} + + /*************************************************************/ + + MathJax.Callback.Queue( + ["StartupHook",MathJax.Hub.Register,"Begin Styles",{}], + ["Styles",AJAX,CONFIG.styles], + ["Post",HUB.Startup.signal,"MathZoom Ready"], + ["loadComplete",AJAX,"[MathJax]/extensions/MathZoom.js"] + ); + +})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax["HTML-CSS"],MathJax.OutputJax.NativeMML); +// @license-end diff --git a/js/mathjax/extensions/Safe.js b/js/mathjax/extensions/Safe.js new file mode 100644 index 0000000..8b77af4 --- /dev/null +++ b/js/mathjax/extensions/Safe.js @@ -0,0 +1,430 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/Safe.js + * + * Implements a "Safe" mode that disables features that could be + * misused in a shared environment (such as href's to javascript URL's). + * See the CONFIG variable below for configuration options. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,AJAX) { + var VERSION = "2.7.9"; + + var CONFIG = MathJax.Hub.CombineConfig("Safe",{ + allow: { + // + // Values can be "all", "safe", or "none" + // + URLs: "safe", // safe are in safeProtocols below + classes: "safe", // safe start with MJX- + cssIDs: "safe", // safe start with MJX- + styles: "safe", // safe are in safeStyles below + fontsize: "all", // safe are between sizeMin and sizeMax em's + require: "safe" // safe are in safeRequire below + }, + sizeMin: .7, // \scriptsize + sizeMax: 1.44, // \large + lengthMax: 3, // largest padding/border/margin, etc. in em's + safeProtocols: { + http: true, + https: true, + file: true, + javascript: false + }, + safeStyles: { + color: true, + backgroundColor: true, + border: true, + cursor: true, + margin: true, + padding: true, + textShadow: true, + fontFamily: true, + fontSize: true, + fontStyle: true, + fontWeight: true, + opacity: true, + outline: true + }, + safeRequire: { + action: true, + amscd: true, + amsmath: true, + amssymbols: true, + autobold: false, + "autoload-all": false, + bbox: true, + begingroup: true, + boldsymbol: true, + cancel: true, + color: true, + enclose: true, + extpfeil: true, + HTML: true, + mathchoice: true, + mhchem: true, + newcommand: true, + noErrors: false, + noUndefined: false, + unicode: true, + verb: true + }, + // + // CSS styles that have Top/Right/Bottom/Left versions + // + styleParts: { + border: true, + padding: true, + margin: true, + outline: true + }, + // + // CSS styles that are lengths needing max/min testing + // A string value means test that style value; + // An array gives [min,max] in em's + // Otherwise use [-lengthMax,lengthMax] from above + // + styleLengths: { + borderTop: "borderTopWidth", + borderRight: "borderRightWidth", + borderBottom: "borderBottomWidth", + borderLeft: "borderLeftWidth", + paddingTop: true, + paddingRight: true, + paddingBottom: true, + paddingLeft: true, + marginTop: true, + marginRight: true, + marginBottom: true, + marginLeft: true, + outlineTop: true, + outlineRight: true, + outlineBottom: true, + outlineLeft: true, + fontSize: [.7,1.44] + } + }); + + var ALLOW = CONFIG.allow; + if (ALLOW.fontsize !== "all") {CONFIG.safeStyles.fontSize = false} + + var SAFE = MathJax.Extension.Safe = { + version: VERSION, + config: CONFIG, + div1: document.createElement("div"), // for CSS processing + div2: document.createElement("div"), + + // + // Methods called for MathML attribute processing + // + filter: { + href: "filterURL", + src: "filterURL", + altimg: "filterURL", + "class": "filterClass", + style: "filterStyles", + id: "filterID", + fontsize: "filterFontSize", + mathsize: "filterFontSize", + scriptminsize: "filterFontSize", + scriptsizemultiplier: "filterSizeMultiplier", + scriptlevel: "filterScriptLevel" + }, + + // + // Filter HREF URL's + // + filterURL: function (url) { + var protocol = (url.match(/^\s*([a-z]+):/i)||[null,""])[1].toLowerCase(); + if (ALLOW.URLs === "none" || + (ALLOW.URLs !== "all" && !CONFIG.safeProtocols[protocol])) {url = null} + return url; + }, + + // + // Filter class names and css ID's + // + filterClass: function (CLASS) { + if (ALLOW.classes === "none" || + (ALLOW.classes !== "all" && !CLASS.match(/^MJX-[-a-zA-Z0-9_.]+$/))) {CLASS = null} + return CLASS; + }, + filterID: function (id) { + if (ALLOW.cssIDs === "none" || + (ALLOW.cssIDs !== "all" && !id.match(/^MJX-[-a-zA-Z0-9_.]+$/))) {id = null} + return id; + }, + + // + // Filter style strings + // + filterStyles: function (styles) { + if (ALLOW.styles === "all") {return styles} + if (ALLOW.styles === "none") {return null} + try { + // + // Set the div1 styles to the given styles, and clear div2 + // + var STYLE1 = this.div1.style, STYLE2 = this.div2.style, value; + STYLE1.cssText = styles; STYLE2.cssText = ""; + // + // Check each allowed style and transfer OK ones to div2 + // If the style has Top/Right/Bottom/Left, look at all four separately + // + for (var name in CONFIG.safeStyles) {if (CONFIG.safeStyles.hasOwnProperty(name)) { + if (CONFIG.styleParts[name]) { + for (var i = 0; i < 4; i++) { + var NAME = name+["Top","Right","Bottom","Left"][i] + value = this.filterStyle(NAME,STYLE1); + if (value) {STYLE2[NAME] = value} + } + } else { + value = this.filterStyle(name,STYLE1); + if (value) {STYLE2[name] = value} + } + }} + // + // Return the div2 style string + // + styles = STYLE2.cssText; + } catch (e) {styles = null} + return styles; + }, + // + // Filter an individual name:value style pair + // + filterStyle: function (name,styles) { + var value = styles[name]; + if (typeof value !== "string" || value === "") {return null} + if (value.match(/^\s*expression/)) {return null} + if (value.match(/javascript:/)) {return null} + var NAME = name.replace(/Top|Right|Left|Bottom/,""); + if (!CONFIG.safeStyles[name] && !CONFIG.safeStyles[NAME]) {return null} + if (!CONFIG.styleLengths[name]) {return value} + return (this.filterStyleLength(name,value,styles) ? value : null); + }, + filterStyleLength: function (name,value,styles) { + if (typeof CONFIG.styleLengths[name] === "string") value = styles[CONFIG.styleLengths[name]]; + value = this.length2em(value); + if (value == null) return false; + var mM = [-CONFIG.lengthMax,CONFIG.lengthMax]; + if (MathJax.Object.isArray(CONFIG.styleLengths[name])) mM = CONFIG.styleLengths[name]; + return (value >= mM[0] && value <= mM[1]); + }, + // + // Conversion of units to em's + // + unit2em: { + em: 1, + ex: .5, // assume 1ex = .5em + ch: .5, // assume 1ch = .5em + rem: 1, // assume 1rem = 1em + px: 1/16, // assume 1em = 16px + mm: 96/25.4/16, // 25.4mm = 96px + cm: 96/2.54/16, // 2.54cm = 96px + 'in': 96/16, // 1in = 96px + pt: 96/72/16, // 72pt = 1in + pc: 96/6/16 // 1pc = 12pt + }, + length2em: function (value) { + var match = value.match(/(.+)(em|ex|ch|rem|px|mm|cm|in|pt|pc)/); + if (!match) return null; + return parseFloat(match[1])*this.unit2em[match[2]]; + }, + + // + // Filter TeX font size values (in em's) + // + filterSize: function (size) { + if (ALLOW.fontsize === "none") {return null} + if (ALLOW.fontsize !== "all") + {size = Math.min(Math.max(size,CONFIG.sizeMin),CONFIG.sizeMax)} + return size; + }, + filterFontSize: function (size) { + return (ALLOW.fontsize === "all" ? size: null); + }, + + // + // Filter scriptsizemultiplier + // + filterSizeMultiplier: function (size) { + if (ALLOW.fontsize === "none") {size = null} + else if (ALLOW.fontsize !== "all") {size = Math.min(1,Math.max(.6,size)).toString()} + return size; + }, + // + // Filter scriptLevel + // + filterScriptLevel: function (level) { + if (ALLOW.fontsize === "none") {level = null} + else if (ALLOW.fontsize !== "all") {level = Math.max(0,level).toString()} + return level; + }, + + // + // Filter TeX extension names + // + filterRequire: function (name) { + if (ALLOW.require === "none" || + (ALLOW.require !== "all" && !CONFIG.safeRequire[name.toLowerCase()])) + {name = null} + return name; + } + + }; + + HUB.Register.StartupHook("TeX HTML Ready",function () { + var TEX = MathJax.InputJax.TeX; + + TEX.Parse.Augment({ + + // + // Implements \href{url}{math} with URL filter + // + HREF_attribute: function (name) { + var url = SAFE.filterURL(this.GetArgument(name)), + arg = this.GetArgumentMML(name); + if (url) {arg.With({href:url})} + this.Push(arg); + }, + + // + // Implements \class{name}{math} with class-name filter + // + CLASS_attribute: function (name) { + var CLASS = SAFE.filterClass(this.GetArgument(name)), + arg = this.GetArgumentMML(name); + if (CLASS) { + if (arg["class"] != null) {CLASS = arg["class"] + " " + CLASS} + arg.With({"class":CLASS}); + } + this.Push(arg); + }, + + // + // Implements \style{style-string}{math} with style filter + // + STYLE_attribute: function (name) { + var style = SAFE.filterStyles(this.GetArgument(name)), + arg = this.GetArgumentMML(name); + if (style) { + if (arg.style != null) { + if (style.charAt(style.length-1) !== ";") {style += ";"} + style = arg.style + " " + style; + } + arg.With({style: style}); + } + this.Push(arg); + }, + + // + // Implements \cssId{id}{math} with ID filter + // + ID_attribute: function (name) { + var ID = SAFE.filterID(this.GetArgument(name)), + arg = this.GetArgumentMML(name); + if (ID) {arg.With({id:ID})} + this.Push(arg); + } + + }); + + }); + + HUB.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX, + PARSE = TEX.Parse, METHOD = SAFE.filter; + + PARSE.Augment({ + + // + // Implements \require{name} with filtering + // + Require: function (name) { + var file = this.GetArgument(name).replace(/.*\//,"").replace(/[^a-z0-9_.-]/ig,""); + file = SAFE.filterRequire(file); + if (file) {this.Extension(null,file)} + }, + + // + // Controls \mmlToken attributes + // + MmlFilterAttribute: function (name,value) { + if (METHOD[name]) {value = SAFE[METHOD[name]](value)} + return value; + }, + + // + // Handles font size macros with filtering + // + SetSize: function (name,size) { + size = SAFE.filterSize(size); + if (size) { + this.stack.env.size = size; + this.Push(TEX.Stack.Item.style().With({styles: {mathsize: size+"em"}})); + } + } + + }); + }); + + HUB.Register.StartupHook("TeX bbox Ready",function () { + var TEX = MathJax.InputJax.TeX; + + // + // Filter the styles for \bbox + // + TEX.Parse.Augment({ + BBoxStyle: function (styles) {return SAFE.filterStyles(styles)}, + BBoxPadding: function (pad) { + var styles = SAFE.filterStyles("padding: "+pad); + return (styles ? pad : 0); + } + }); + + }); + + HUB.Register.StartupHook("MathML Jax Ready",function () { + var PARSE = MathJax.InputJax.MathML.Parse, + METHOD = SAFE.filter; + + // + // Filter MathML attributes + // + PARSE.Augment({ + filterAttribute: function (name,value) { + if (METHOD[name]) {value = SAFE[METHOD[name]](value)} + return value; + } + }); + + }); + + // MathML input (href, style, fontsize, class, id) + + HUB.Startup.signal.Post("Safe Extension Ready"); + AJAX.loadComplete("[MathJax]/extensions/Safe.js"); + +})(MathJax.Hub,MathJax.Ajax); +// @license-end diff --git a/js/mathjax/extensions/TeX/AMScd.js b/js/mathjax/extensions/TeX/AMScd.js new file mode 100644 index 0000000..d6bee02 --- /dev/null +++ b/js/mathjax/extensions/TeX/AMScd.js @@ -0,0 +1,160 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/AMScd.js + * + * Implements the CD environment for commutative diagrams. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/AMScd"] = { + version: "2.7.9", + config: MathJax.Hub.CombineConfig("TeX.CD",{ + colspace: "5pt", + rowspace: "5pt", + harrowsize: "2.75em", + varrowsize: "1.75em", + hideHorizontalLabels: false + }) +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var MML = MathJax.ElementJax.mml, + TEX = MathJax.InputJax.TeX, + STACKITEM = TEX.Stack.Item, + TEXDEF = TEX.Definitions, + CONFIG = MathJax.Extension["TeX/AMScd"].config; + + TEXDEF.environment.CD = "CD_env"; + TEXDEF.special["@"] = "CD_arrow"; + TEXDEF.macros.minCDarrowwidth = "CD_minwidth"; + TEXDEF.macros.minCDarrowheight = "CD_minheight"; + + TEX.Parse.Augment({ + // + // Implements \begin{CD}...\end{CD} + // + CD_env: function (begin) { + this.Push(begin); + return STACKITEM.array().With({ + arraydef: { + columnalign: "center", + columnspacing: CONFIG.colspace, + rowspacing: CONFIG.rowspace, + displaystyle: true + }, + minw: this.stack.env.CD_minw || CONFIG.harrowsize, + minh: this.stack.env.CD_minh || CONFIG.varrowsize + }); + }, + + CD_arrow: function (name) { + var c = this.string.charAt(this.i); + if (!c.match(/[>>> @<<< @VVV and @AAA, get the arrow and labels + // + var arrow = {">":"\u2192", "<":"\u2190", V:"\u2193", A:"\u2191"}[c]; + var a = this.GetUpTo(name+c,c), + b = this.GetUpTo(name+c,c); + + if (c === ">" || c === "<") { + // + // Lay out horizontal arrows with munderover if it has labels + // + mml = MML.mo(arrow).With(hdef); + if (!a) {a = "\\kern "+top.minw} // minsize needs work + if (a || b) { + var pad = {width:"+11mu", lspace:"6mu"}; + mml = MML.munderover(this.mmlToken(mml)); + if (a) { + a = TEX.Parse(a,this.stack.env).mml(); + mml.SetData(mml.over,MML.mpadded(a).With(pad).With({voffset:".1em"})); + } + if (b) { + b = TEX.Parse(b,this.stack.env).mml(); + mml.SetData(mml.under,MML.mpadded(b).With(pad)); + } + if (CONFIG.hideHorizontalLabels) + {mml = MML.mpadded(mml).With({depth:0, height:".67em"})} + } + } else { + // + // Lay out vertical arrows with mrow if there are labels + // + mml = arrow = this.mmlToken(MML.mo(arrow).With(vdef)); + if (a || b) { + mml = MML.mrow(); + if (a) {mml.Append(TEX.Parse("\\scriptstyle\\llap{"+a+"}",this.stack.env).mml())} + mml.Append(arrow.With({texClass: MML.TEXCLASS.ORD})); + if (b) {mml.Append(TEX.Parse("\\scriptstyle\\rlap{"+b+"}",this.stack.env).mml())} + } + } + } + if (mml) {this.Push(mml)}; + this.CD_cell(name); + }, + CD_cell: function (name) { + var top = this.stack.Top(); + if ((top.table||[]).length % 2 === 0 && (top.row||[]).length === 0) { + // + // Add a strut to the first cell in even rows to get + // better spacing of arrow rows. + // + this.Push(MML.mpadded().With({height:"8.5pt",depth:"2pt"})); + } + this.Push(STACKITEM.cell().With({isEntry:true, name:name})); + }, + + CD_minwidth: function (name) { + this.stack.env.CD_minw = this.GetDimen(name); + }, + CD_minheight: function (name) { + this.stack.env.CD_minh = this.GetDimen(name); + } + + }); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMScd.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/AMSmath.js b/js/mathjax/extensions/TeX/AMSmath.js new file mode 100644 index 0000000..70d5183 --- /dev/null +++ b/js/mathjax/extensions/TeX/AMSmath.js @@ -0,0 +1,665 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/AMSmath.js + * + * Implements AMS math environments and macros. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/AMSmath"] = { + version: "2.7.9", + + number: 0, // current equation number + startNumber: 0, // current starting equation number (for when equation is restarted) + IDs: {}, // IDs used in previous equations + eqIDs: {}, // IDs used in this equation + labels: {}, // the set of labels + eqlabels: {}, // labels in the current equation + refs: [] // array of jax with unresolved references +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var MML = MathJax.ElementJax.mml, + TEX = MathJax.InputJax.TeX, + AMS = MathJax.Extension["TeX/AMSmath"]; + + var TEXDEF = TEX.Definitions, + STACKITEM = TEX.Stack.Item, + CONFIG = TEX.config.equationNumbers; + + var COLS = function (W) { + var WW = []; + for (var i = 0, m = W.length; i < m; i++) + {WW[i] = TEX.Parse.prototype.Em(W[i])} + return WW.join(" "); + }; + + // + // Get the URL of the page (for use with formatURL) when there + // is a element on the page. + // + var baseURL = (document.getElementsByTagName("base").length === 0) ? "" : + String(document.location).replace(/#.*$/,""); + + + /******************************************************************************/ + + TEXDEF.Add({ + mathchar0mo: { + iiiint: ['2A0C',{texClass: MML.TEXCLASS.OP}] + }, + + macros: { + mathring: ['Accent','2DA'], // or 0x30A + + nobreakspace: 'Tilde', + negmedspace: ['Spacer',MML.LENGTH.NEGATIVEMEDIUMMATHSPACE], + negthickspace: ['Spacer',MML.LENGTH.NEGATIVETHICKMATHSPACE], + +// intI: ['Macro','\\mathchoice{\\!}{}{}{}\\!\\!\\int'], +// iint: ['MultiIntegral','\\int\\intI'], // now in core TeX input jax +// iiint: ['MultiIntegral','\\int\\intI\\intI'], // now in core TeX input jax +// iiiint: ['MultiIntegral','\\int\\intI\\intI\\intI'], // now in mathchar0mo above + idotsint: ['MultiIntegral','\\int\\cdots\\int'], + +// dddot: ['Macro','\\mathop{#1}\\limits^{\\textstyle \\mathord{.}\\mathord{.}\\mathord{.}}',1], +// ddddot: ['Macro','\\mathop{#1}\\limits^{\\textstyle \\mathord{.}\\mathord{.}\\mathord{.}\\mathord{.}}',1], + dddot: ['Accent','20DB'], + ddddot: ['Accent','20DC'], + + sideset: ['Macro','\\mathop{\\mathop{\\rlap{\\phantom{#3}}}\\nolimits#1\\!\\mathop{#3}\\nolimits#2}',3], + + boxed: ['Macro','\\fbox{$\\displaystyle{#1}$}',1], + + tag: 'HandleTag', + notag: 'HandleNoTag', + label: 'HandleLabel', + ref: 'HandleRef', + eqref: ['HandleRef',true], + + substack: ['Macro','\\begin{subarray}{c}#1\\end{subarray}',1], + + injlim: ['NamedOp','inj lim'], + projlim: ['NamedOp','proj lim'], + varliminf: ['Macro','\\mathop{\\underline{\\mmlToken{mi}{lim}}}'], + varlimsup: ['Macro','\\mathop{\\overline{\\mmlToken{mi}{lim}}}'], + varinjlim: ['Macro','\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}'], + varprojlim: ['Macro','\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}'], + + DeclareMathOperator: 'HandleDeclareOp', + operatorname: 'HandleOperatorName', + SkipLimits: 'SkipLimits', + + genfrac: 'Genfrac', + frac: ['Genfrac',"","","",""], + tfrac: ['Genfrac',"","","",1], + dfrac: ['Genfrac',"","","",0], + binom: ['Genfrac',"(",")","0",""], + tbinom: ['Genfrac',"(",")","0",1], + dbinom: ['Genfrac',"(",")","0",0], + + cfrac: 'CFrac', + + shoveleft: ['HandleShove',MML.ALIGN.LEFT], + shoveright: ['HandleShove',MML.ALIGN.RIGHT], + + xrightarrow: ['xArrow',0x2192,5,6], + xleftarrow: ['xArrow',0x2190,7,3] + }, + + environment: { + align: ['AMSarray',null,true,true, 'rlrlrlrlrlrl',COLS([0,2,0,2,0,2,0,2,0,2,0])], + 'align*': ['AMSarray',null,false,true, 'rlrlrlrlrlrl',COLS([0,2,0,2,0,2,0,2,0,2,0])], + multline: ['Multline',null,true], + 'multline*': ['Multline',null,false], + split: ['AMSarray',null,false,false,'rl',COLS([0])], + gather: ['AMSarray',null,true,true, 'c'], + 'gather*': ['AMSarray',null,false,true, 'c'], + + alignat: ['AlignAt',null,true,true], + 'alignat*': ['AlignAt',null,false,true], + alignedat: ['AlignAt',null,false,false], + + aligned: ['AlignedAMSArray',null,null,null,'rlrlrlrlrlrl',COLS([0,2,0,2,0,2,0,2,0,2,0]),".5em",'D'], + gathered: ['AlignedAMSArray',null,null,null,'c',null,".5em",'D'], + + subarray: ['Array',null,null,null,null,COLS([0]),"0.1em",'S',1], + smallmatrix: ['Array',null,null,null,'c',COLS([1/3]),".2em",'S',1], + + 'equation': ['EquationBegin','Equation',true], + 'equation*': ['EquationBegin','EquationStar',false], + + eqnarray: ['AMSarray',null,true,true, 'rcl',"0 "+MML.LENGTH.THICKMATHSPACE,".5em"], + 'eqnarray*': ['AMSarray',null,false,true,'rcl',"0 "+MML.LENGTH.THICKMATHSPACE,".5em"] + }, + + delimiter: { + '\\lvert': ['007C',{texClass:MML.TEXCLASS.OPEN}], + '\\rvert': ['007C',{texClass:MML.TEXCLASS.CLOSE}], + '\\lVert': ['2016',{texClass:MML.TEXCLASS.OPEN}], + '\\rVert': ['2016',{texClass:MML.TEXCLASS.CLOSE}] + } + },null,true); + + + /******************************************************************************/ + + TEX.Parse.Augment({ + + /* + * Add the tag to the environment (to be added to the table row later) + */ + HandleTag: function (name) { + var star = this.GetStar(); + var arg = this.trimSpaces(this.GetArgument(name)), tag = arg; + if (!star) {arg = CONFIG.formatTag(arg)} + var global = this.stack.global; global.tagID = tag; + if (global.notags) { + TEX.Error(["CommandNotAllowedInEnv", + "%1 not allowed in %2 environment", + name,global.notags] + ); + } + if (global.tag) {TEX.Error(["MultipleCommand","Multiple %1",name])} + global.tag = MML.mtd.apply(MML,this.InternalMath(arg)).With({id:CONFIG.formatID(tag)}); + }, + HandleNoTag: function (name) { + if (this.stack.global.tag) {delete this.stack.global.tag} + this.stack.global.notag = true; // prevent auto-tagging + }, + + /* + * Record a label name for a tag + */ + HandleLabel: function (name) { + var global = this.stack.global, label = this.GetArgument(name); + if (label === "") return; + if (!AMS.refUpdate) { + if (global.label) {TEX.Error(["MultipleCommand","Multiple %1",name])} + global.label = label; + if (AMS.labels[label] || AMS.eqlabels[label]) + {TEX.Error(["MultipleLabel","Label '%1' multiply defined",label])} + AMS.eqlabels[label] = {tag:"???", id:""}; // will be replaced by tag value later + } + }, + + /* + * Handle a label reference + */ + HandleRef: function (name,eqref) { + var label = this.GetArgument(name); + var ref = AMS.labels[label] || AMS.eqlabels[label]; + if (!ref) {ref = {tag:"???",id:""}; AMS.badref = !AMS.refUpdate} + var tag = ref.tag; if (eqref) {tag = CONFIG.formatTag(tag)} + this.Push(MML.mrow.apply(MML,this.InternalMath(tag)).With({ + href:CONFIG.formatURL(ref.id,baseURL), "class":"MathJax_ref" + })); + }, + + /* + * Handle \DeclareMathOperator + */ + HandleDeclareOp: function (name) { + var limits = (this.GetStar() ? "" : "\\nolimits\\SkipLimits"); + var cs = this.trimSpaces(this.GetArgument(name)); + if (cs.charAt(0) == "\\") {cs = cs.substr(1)} + var op = this.GetArgument(name); + if (!op.match(/\\text/)) op = op.replace(/\*/g,'\\text{*}').replace(/-/g,'\\text{-}'); + this.setDef(cs, ['Macro', '\\mathop{\\rm '+op+'}'+limits]); + }, + + HandleOperatorName: function (name) { + var limits = (this.GetStar() ? "" : "\\nolimits\\SkipLimits"); + var op = this.trimSpaces(this.GetArgument(name)); + if (!op.match(/\\text/)) op = op.replace(/\*/g,'\\text{*}').replace(/-/g,'\\text{-}'); + this.string = '\\mathop{\\rm '+op+'}'+limits+" "+this.string.slice(this.i); + this.i = 0; + }, + + SkipLimits: function (name) { + var c = this.GetNext(), i = this.i; + if (c === "\\" && ++this.i && this.GetCS() !== "limits") this.i = i; + }, + + /* + * Record presence of \shoveleft and \shoveright + */ + HandleShove: function (name,shove) { + var top = this.stack.Top(); + if (top.type !== "multline") { + TEX.Error(["CommandInMultline", + "%1 can only appear within the multline environment",name]); + } + if (top.data.length) { + TEX.Error(["CommandAtTheBeginingOfLine", + "%1 must come at the beginning of the line",name]); + } + top.data.shove = shove; + }, + + /* + * Handle \cfrac + */ + CFrac: function (name) { + var lr = this.trimSpaces(this.GetBrackets(name,"")), + num = this.GetArgument(name), + den = this.GetArgument(name); + var frac = MML.mfrac(TEX.Parse('\\strut\\textstyle{'+num+'}',this.stack.env).mml(), + TEX.Parse('\\strut\\textstyle{'+den+'}',this.stack.env).mml()); + lr = ({l:MML.ALIGN.LEFT, r:MML.ALIGN.RIGHT,"":""})[lr]; + if (lr == null) + {TEX.Error(["IllegalAlign","Illegal alignment specified in %1",name])} + if (lr) {frac.numalign = frac.denomalign = lr} + this.Push(frac); + }, + + /* + * Implement AMS generalized fraction + */ + Genfrac: function (name,left,right,thick,style) { + if (left == null) {left = this.GetDelimiterArg(name)} + if (right == null) {right = this.GetDelimiterArg(name)} + if (thick == null) {thick = this.GetArgument(name)} + if (style == null) {style = this.trimSpaces(this.GetArgument(name))} + var num = this.ParseArg(name); + var den = this.ParseArg(name); + var frac = MML.mfrac(num,den); + if (thick !== "") {frac.linethickness = thick} + if (left || right) {frac = TEX.fixedFence(left,frac.With({texWithDelims:true}),right)} + if (style !== "") { + var STYLE = (["D","T","S","SS"])[style]; + if (STYLE == null) + {TEX.Error(["BadMathStyleFor","Bad math style for %1",name])} + frac = MML.mstyle(frac); + if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0} + else {frac.displaystyle = false; frac.scriptlevel = style - 1} + } + this.Push(frac); + }, + + /* + * Implements multline environment (mostly handled through STACKITEM below) + */ + Multline: function (begin,numbered) { + this.Push(begin); this.checkEqnEnv(); + return STACKITEM.multline(numbered,this.stack).With({ + arraydef: { + displaystyle: true, + rowspacing: ".5em", + width: TEX.config.MultLineWidth, columnwidth:"100%", + side: TEX.config.TagSide, + minlabelspacing: TEX.config.TagIndent + } + }); + }, + + /* + * Handle AMS aligned environments + */ + AMSarray: function (begin,numbered,taggable,align,spacing) { + this.Push(begin); if (taggable) {this.checkEqnEnv()} + align = align.replace(/[^clr]/g,'').split('').join(' '); + align = align.replace(/l/g,'left').replace(/r/g,'right').replace(/c/g,'center'); + return STACKITEM.AMSarray(begin.name,numbered,taggable,this.stack).With({ + arraydef: { + displaystyle: true, + rowspacing: ".5em", + columnalign: align, + columnspacing: (spacing||"1em"), + rowspacing: "3pt", + side: TEX.config.TagSide, + minlabelspacing: TEX.config.TagIndent + } + }); + }, + + AlignedAMSArray: function (begin) { + var align = this.GetBrackets("\\begin{"+begin.name+"}"); + return this.setArrayAlign(this.AMSarray.apply(this,arguments),align); + }, + + /* + * Handle alignat environments + */ + AlignAt: function (begin,numbered,taggable) { + var n, valign, align = "", spacing = []; + if (!taggable) {valign = this.GetBrackets("\\begin{"+begin.name+"}")} + n = this.GetArgument("\\begin{"+begin.name+"}"); + if (n.match(/[^0-9]/)) { + TEX.Error(["PositiveIntegerArg","Argument to %1 must me a positive integer", + "\\begin{"+begin.name+"}"]); + } + while (n > 0) {align += "rl"; spacing.push("0em 0em"); n--} + spacing = spacing.join(" "); + if (taggable) {return this.AMSarray(begin,numbered,taggable,align,spacing)} + var array = this.AMSarray(begin,numbered,taggable,align,spacing); + return this.setArrayAlign(array,valign); + }, + + /* + * Handle equation environment + */ + EquationBegin: function (begin,force) { + this.checkEqnEnv(); + this.stack.global.forcetag = (force && CONFIG.autoNumber !== "none"); + return begin; + }, + EquationStar: function (begin,row) { + this.stack.global.tagged = true; // prevent automatic tagging + return row; + }, + + /* + * Check for bad nesting of equation environments + */ + checkEqnEnv: function () { + if (this.stack.global.eqnenv) + {TEX.Error(["ErroneousNestingEq","Erroneous nesting of equation structures"])} + this.stack.global.eqnenv = true; + }, + + /* + * Handle multiple integrals (make a mathop if followed by limits) + */ + MultiIntegral: function (name,integral) { + var next = this.GetNext(); + if (next === "\\") { + var i = this.i; next = this.GetArgument(name); this.i = i; + if (next === "\\limits") { + if (name === "\\idotsint") {integral = "\\!\\!\\mathop{\\,\\,"+integral+"}"} + else {integral = "\\!\\!\\!\\mathop{\\,\\,\\,"+integral+"}"} + } + } + this.string = integral + " " + this.string.slice(this.i); + this.i = 0; + }, + + /* + * Handle stretchable arrows + */ + xArrow: function (name,chr,l,r) { + var def = {width: "+"+(l+r)+"mu", lspace: l+"mu"}; + var bot = this.GetBrackets(name), + top = this.ParseArg(name); + var arrow = MML.mo(MML.chars(String.fromCharCode(chr))).With({ + stretchy: true, texClass: MML.TEXCLASS.REL + }); + var mml = MML.munderover(arrow); + mml.SetData(mml.over,MML.mpadded(top).With(def).With({voffset:".15em"})); + if (bot) { + bot = TEX.Parse(bot,this.stack.env).mml() + mml.SetData(mml.under,MML.mpadded(bot).With(def).With({voffset:"-.24em"})); + } + this.Push(mml.With({subsupOK:true})); + }, + + /* + * Get a delimiter or empty argument + */ + GetDelimiterArg: function (name) { + var c = this.trimSpaces(this.GetArgument(name)); + if (c == "") return null; + if (c in TEXDEF.delimiter) return c; + TEX.Error(["MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",name]); + }, + + /* + * Get a star following a control sequence name, if any + */ + GetStar: function () { + var star = (this.GetNext() === "*"); + if (star) {this.i++} + return star; + } + + }); + + /******************************************************************************/ + + STACKITEM.Augment({ + /* + * Increment equation number and form tag mtd element + */ + autoTag: function () { + var global = this.global; + if (!global.notag) { + AMS.number++; global.tagID = CONFIG.formatNumber(AMS.number.toString()); + var mml = TEX.Parse("\\text{"+CONFIG.formatTag(global.tagID)+"}",{}).mml(); + global.tag = MML.mtd(mml).With({id:CONFIG.formatID(global.tagID)}); + } + }, + + /* + * Get the tag and record the label, if any + */ + getTag: function () { + var global = this.global, tag = global.tag; global.tagged = true; + if (global.label) { + if (CONFIG.useLabelIds) {tag.id = CONFIG.formatID(global.label)} + AMS.eqlabels[global.label] = {tag:global.tagID, id:tag.id}; + } + // + // Check for repeated ID's (either in the document or as + // a previous tag) and find a unique related one. (#240) + // + if (document.getElementById(tag.id) || AMS.IDs[tag.id] || AMS.eqIDs[tag.id]) { + var i = 0, ID; + do {i++; ID = tag.id+"_"+i} + while (document.getElementById(ID) || AMS.IDs[ID] || AMS.eqIDs[ID]); + tag.id = ID; if (global.label) {AMS.eqlabels[global.label].id = ID} + } + AMS.eqIDs[tag.id] = 1; + this.clearTag(); + return tag; + }, + clearTag: function () { + var global = this.global; + delete global.tag; delete global.tagID; delete global.label; + }, + + /* + * If the initial child, skipping any initial space or + * empty braces (TeXAtom with child being an empty inferred row), + * is an , precede it by an empty to force the to + * be infix. + */ + fixInitialMO: function (data) { + for (var i = 0, m = data.length; i < m; i++) { + if (data[i] && (data[i].type !== "mspace" && + (data[i].type !== "texatom" || (data[i].data[0] && data[i].data[0].data.length)))) { + if (data[i].isEmbellished() || + (data[i].type === "texatom" && data[i].texClass === MML.TEXCLASS.REL)) data.unshift(MML.mi()); + break; + } + } + } + }); + + /* + * Implement multline environment via a STACKITEM + */ + STACKITEM.multline = STACKITEM.array.Subclass({ + type: "multline", + Init: function (numbered,stack) { + this.SUPER(arguments).Init.apply(this); + this.numbered = (numbered && CONFIG.autoNumber !== "none"); + this.save = {notag: stack.global.notag}; + stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments + }, + EndEntry: function () { + if (this.table.length) {this.fixInitialMO(this.data)} + var mtd = MML.mtd.apply(MML,this.data); + if (this.data.shove) {mtd.columnalign = this.data.shove} + this.row.push(mtd); + this.data = []; + }, + EndRow: function () { + if (this.row.length != 1) { + TEX.Error(["MultlineRowsOneCol", + "The rows within the %1 environment must have exactly one column", + "multline"]); + } + this.table.push(this.row); this.row = []; + }, + EndTable: function () { + this.SUPER(arguments).EndTable.call(this); + if (this.table.length) { + var m = this.table.length-1, i, label = -1; + if (!this.table[0][0].columnalign) {this.table[0][0].columnalign = MML.ALIGN.LEFT} + if (!this.table[m][0].columnalign) {this.table[m][0].columnalign = MML.ALIGN.RIGHT} + if (!this.global.tag && this.numbered) {this.autoTag()} + if (this.global.tag && !this.global.notags) { + label = (this.arraydef.side === "left" ? 0 : this.table.length - 1); + this.table[label] = [this.getTag()].concat(this.table[label]); + } + for (i = 0, m = this.table.length; i < m; i++) { + var mtr = (i === label ? MML.mlabeledtr : MML.mtr); + this.table[i] = mtr.apply(MML,this.table[i]); + } + } + this.global.notag = this.save.notag; + } + }); + + /* + * Save data about numbering and taging equations, and add + * tags at the ends of rows. + */ + STACKITEM.AMSarray = STACKITEM.array.Subclass({ + type: "AMSarray", + Init: function (name,numbered,taggable,stack) { + this.SUPER(arguments).Init.apply(this); + this.numbered = (numbered && CONFIG.autoNumber !== "none"); + this.save = {notags: stack.global.notags, notag: stack.global.notag}; + stack.global.notags = (taggable ? null : name); + stack.global.tagged = !numbered && taggable && !stack.global.forcetag; // prevent automatic tagging in starred environments + }, + EndEntry: function () { + if (this.row.length % 2 === 1) {this.fixInitialMO(this.data)} + this.row.push(MML.mtd.apply(MML,this.data)); + this.data = []; + }, + EndRow: function () { + var mtr = MML.mtr; + if (!this.global.tag && this.numbered) {this.autoTag()} + if (!this.global.notags) { + if (this.global.tag) { + this.row = [this.getTag()].concat(this.row); + mtr = MML.mlabeledtr; + } else { + this.clearTag(); + } + } + if (this.numbered) {delete this.global.notag} + this.table.push(mtr.apply(MML,this.row)); this.row = []; + }, + EndTable: function () { + this.SUPER(arguments).EndTable.call(this); + this.global.notags = this.save.notags; + this.global.notag = this.save.notag; + } + }); + + // + // Look for \tag on a formula and make an mtable to include it + // + STACKITEM.start.Augment({ + oldCheckItem: STACKITEM.start.prototype.checkItem, + checkItem: function (item) { + if (item.type === "stop") { + var mml = this.mmlData(), global = this.global; + if (AMS.display && !global.tag && !global.tagged && !global.isInner && + (CONFIG.autoNumber === "all" || global.forcetag)) {this.autoTag()} + if (global.tag) { + var row = [this.getTag(),MML.mtd(mml)]; + var def = { + side: TEX.config.TagSide, + minlabelspacing: TEX.config.TagIndent, + displaystyle: "inherit" // replaced by TeX input jax Translate() function with actual value + }; + mml = MML.mtable(MML.mlabeledtr.apply(MML,row)).With(def); + } + return STACKITEM.mml(mml); + } + return this.oldCheckItem.call(this,item); + } + }); + + /******************************************************************************/ + + /* + * Add pre- and post-filters to handle the equation number maintenance. + */ + TEX.prefilterHooks.Add(function (data) { + AMS.display = data.display; + AMS.number = AMS.startNumber; // reset equation numbers (in case the equation restarted) + AMS.eqlabels = {}; + AMS.eqIDs = {}; + AMS.badref = false; + if (AMS.refUpdate) {AMS.number = data.script.MathJax.startNumber} + }); + TEX.postfilterHooks.Add(function (data) { + data.script.MathJax.startNumber = AMS.startNumber; + AMS.startNumber = AMS.number; // equation numbers for next equation + MathJax.Hub.Insert(AMS.IDs,AMS.eqIDs); // save IDs from this equation + MathJax.Hub.Insert(AMS.labels,AMS.eqlabels); // save labels from this equation + if (AMS.badref && !data.math.texError) {AMS.refs.push(data.script)} // reprocess later + },100); + + MathJax.Hub.Register.MessageHook("Begin Math Input",function () { + AMS.refs = []; // array of jax with bad references + AMS.refUpdate = false; + }); + MathJax.Hub.Register.MessageHook("End Math Input",function (message) { + if (AMS.refs.length) { + AMS.refUpdate = true; + for (var i = 0, m = AMS.refs.length; i < m; i++) + {AMS.refs[i].MathJax.state = MathJax.ElementJax.STATE.UPDATE} + return MathJax.Hub.processInput({ + scripts:AMS.refs, + start: new Date().getTime(), + i:0, j:0, jax:{}, jaxIDs:[] + }); + } + return null; + }); + + // + // Clear the equation numbers and labels + // + TEX.resetEquationNumbers = function (n,keepLabels) { + AMS.startNumber = (n || 0); + if (!keepLabels) { + AMS.labels = {}; + AMS.IDs = {}; + } + } + + /******************************************************************************/ + + MathJax.Hub.Startup.signal.Post("TeX AMSmath Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMSmath.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/AMSsymbols.js b/js/mathjax/extensions/TeX/AMSsymbols.js new file mode 100644 index 0000000..ef7ae5f --- /dev/null +++ b/js/mathjax/extensions/TeX/AMSsymbols.js @@ -0,0 +1,351 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/AMSsymbols.js + * + * Implements macros for accessing the AMS symbol fonts. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/AMSsymbols"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var MML = MathJax.ElementJax.mml, + TEXDEF = MathJax.InputJax.TeX.Definitions; + + TEXDEF.Add({ + + mathchar0mi: { + // Lowercase Greek letters + digamma: '03DD', + varkappa: '03F0', + + // Uppercase Greek letters + varGamma: ['0393',{mathvariant: MML.VARIANT.ITALIC}], + varDelta: ['0394',{mathvariant: MML.VARIANT.ITALIC}], + varTheta: ['0398',{mathvariant: MML.VARIANT.ITALIC}], + varLambda: ['039B',{mathvariant: MML.VARIANT.ITALIC}], + varXi: ['039E',{mathvariant: MML.VARIANT.ITALIC}], + varPi: ['03A0',{mathvariant: MML.VARIANT.ITALIC}], + varSigma: ['03A3',{mathvariant: MML.VARIANT.ITALIC}], + varUpsilon: ['03A5',{mathvariant: MML.VARIANT.ITALIC}], + varPhi: ['03A6',{mathvariant: MML.VARIANT.ITALIC}], + varPsi: ['03A8',{mathvariant: MML.VARIANT.ITALIC}], + varOmega: ['03A9',{mathvariant: MML.VARIANT.ITALIC}], + + // Hebrew letters + beth: '2136', + gimel: '2137', + daleth: '2138', + + // Miscellaneous symbols +// hbar: '0127', // in TeX/jax.js + backprime: ['2035',{variantForm: true}], + hslash: '210F', + varnothing: ['2205',{variantForm: true}], + blacktriangle: '25B4', + triangledown: ['25BD',{variantForm: true}], + blacktriangledown: '25BE', + square: '25FB', + Box: '25FB', + blacksquare: '25FC', + lozenge: '25CA', + Diamond: '25CA', + blacklozenge: '29EB', + circledS: ['24C8',{mathvariant: MML.VARIANT.NORMAL}], + bigstar: '2605', +// angle: '2220', // in TeX/jax.js + sphericalangle: '2222', + measuredangle: '2221', + nexists: '2204', + complement: '2201', + mho: '2127', + eth: ['00F0',{mathvariant: MML.VARIANT.NORMAL}], + Finv: '2132', + diagup: '2571', + Game: '2141', + diagdown: '2572', + Bbbk: ['006B',{mathvariant: MML.VARIANT.DOUBLESTRUCK}], + + yen: '00A5', + circledR: '00AE', + checkmark: '2713', + maltese: '2720' + }, + + mathchar0mo: { + // Binary operators + dotplus: '2214', + ltimes: '22C9', + smallsetminus: '2216', + rtimes: '22CA', + Cap: '22D2', + doublecap: '22D2', + leftthreetimes: '22CB', + Cup: '22D3', + doublecup: '22D3', + rightthreetimes: '22CC', + barwedge: '22BC', + curlywedge: '22CF', + veebar: '22BB', + curlyvee: '22CE', + doublebarwedge: '2A5E', + boxminus: '229F', + circleddash: '229D', + boxtimes: '22A0', + circledast: '229B', + boxdot: '22A1', + circledcirc: '229A', + boxplus: '229E', + centerdot: ['22C5',{variantForm: true}], + divideontimes: '22C7', + intercal: '22BA', + + // Binary relations + leqq: '2266', + geqq: '2267', + leqslant: '2A7D', + geqslant: '2A7E', + eqslantless: '2A95', + eqslantgtr: '2A96', + lesssim: '2272', + gtrsim: '2273', + lessapprox: '2A85', + gtrapprox: '2A86', + approxeq: '224A', + lessdot: '22D6', + gtrdot: '22D7', + lll: '22D8', + llless: '22D8', + ggg: '22D9', + gggtr: '22D9', + lessgtr: '2276', + gtrless: '2277', + lesseqgtr: '22DA', + gtreqless: '22DB', + lesseqqgtr: '2A8B', + gtreqqless: '2A8C', + doteqdot: '2251', + Doteq: '2251', + eqcirc: '2256', + risingdotseq: '2253', + circeq: '2257', + fallingdotseq: '2252', + triangleq: '225C', + backsim: '223D', + thicksim: ['223C',{variantForm: true}], + backsimeq: '22CD', + thickapprox: ['2248',{variantForm: true}], + subseteqq: '2AC5', + supseteqq: '2AC6', + Subset: '22D0', + Supset: '22D1', + sqsubset: '228F', + sqsupset: '2290', + preccurlyeq: '227C', + succcurlyeq: '227D', + curlyeqprec: '22DE', + curlyeqsucc: '22DF', + precsim: '227E', + succsim: '227F', + precapprox: '2AB7', + succapprox: '2AB8', + vartriangleleft: '22B2', + lhd: '22B2', + vartriangleright: '22B3', + rhd: '22B3', + trianglelefteq: '22B4', + unlhd: '22B4', + trianglerighteq: '22B5', + unrhd: '22B5', + vDash: '22A8', + Vdash: '22A9', + Vvdash: '22AA', + smallsmile: ['2323',{variantForm: true}], + shortmid: ['2223',{variantForm: true}], + smallfrown: ['2322',{variantForm: true}], + shortparallel: ['2225',{variantForm: true}], + bumpeq: '224F', + between: '226C', + Bumpeq: '224E', + pitchfork: '22D4', + varpropto: '221D', + backepsilon: '220D', + blacktriangleleft: '25C2', + blacktriangleright: '25B8', + therefore: '2234', + because: '2235', + eqsim: '2242', + vartriangle: ['25B3',{variantForm: true}], + Join: '22C8', + + // Negated relations + nless: '226E', + ngtr: '226F', + nleq: '2270', + ngeq: '2271', + nleqslant: ['2A87',{variantForm: true}], + ngeqslant: ['2A88',{variantForm: true}], + nleqq: ['2270',{variantForm: true}], + ngeqq: ['2271',{variantForm: true}], + lneq: '2A87', + gneq: '2A88', + lneqq: '2268', + gneqq: '2269', + lvertneqq: ['2268',{variantForm: true}], + gvertneqq: ['2269',{variantForm: true}], + lnsim: '22E6', + gnsim: '22E7', + lnapprox: '2A89', + gnapprox: '2A8A', + nprec: '2280', + nsucc: '2281', + npreceq: ['22E0',{variantForm: true}], + nsucceq: ['22E1',{variantForm: true}], + precneqq: '2AB5', + succneqq: '2AB6', + precnsim: '22E8', + succnsim: '22E9', + precnapprox: '2AB9', + succnapprox: '2ABA', + nsim: '2241', + ncong: '2246', + nshortmid: ['2224',{variantForm: true}], + nshortparallel: ['2226',{variantForm: true}], + nmid: '2224', + nparallel: '2226', + nvdash: '22AC', + nvDash: '22AD', + nVdash: '22AE', + nVDash: '22AF', + ntriangleleft: '22EA', + ntriangleright: '22EB', + ntrianglelefteq: '22EC', + ntrianglerighteq: '22ED', + nsubseteq: '2288', + nsupseteq: '2289', + nsubseteqq: ['2288',{variantForm: true}], + nsupseteqq: ['2289',{variantForm: true}], + subsetneq: '228A', + supsetneq: '228B', + varsubsetneq: ['228A',{variantForm: true}], + varsupsetneq: ['228B',{variantForm: true}], + subsetneqq: '2ACB', + supsetneqq: '2ACC', + varsubsetneqq: ['2ACB',{variantForm: true}], + varsupsetneqq: ['2ACC',{variantForm: true}], + + + // Arrows + leftleftarrows: '21C7', + rightrightarrows: '21C9', + leftrightarrows: '21C6', + rightleftarrows: '21C4', + Lleftarrow: '21DA', + Rrightarrow: '21DB', + twoheadleftarrow: '219E', + twoheadrightarrow: '21A0', + leftarrowtail: '21A2', + rightarrowtail: '21A3', + looparrowleft: '21AB', + looparrowright: '21AC', + leftrightharpoons: '21CB', + rightleftharpoons: ['21CC',{variantForm: true}], + curvearrowleft: '21B6', + curvearrowright: '21B7', + circlearrowleft: '21BA', + circlearrowright: '21BB', + Lsh: '21B0', + Rsh: '21B1', + upuparrows: '21C8', + downdownarrows: '21CA', + upharpoonleft: '21BF', + upharpoonright: '21BE', + downharpoonleft: '21C3', + restriction: '21BE', + multimap: '22B8', + downharpoonright: '21C2', + leftrightsquigarrow: '21AD', + rightsquigarrow: '21DD', + leadsto: '21DD', + dashrightarrow: '21E2', + dashleftarrow: '21E0', + + // Negated arrows + nleftarrow: '219A', + nrightarrow: '219B', + nLeftarrow: '21CD', + nRightarrow: '21CF', + nleftrightarrow: '21AE', + nLeftrightarrow: '21CE' + }, + + delimiter: { + // corners + "\\ulcorner": '231C', + "\\urcorner": '231D', + "\\llcorner": '231E', + "\\lrcorner": '231F' + }, + + macros: { + implies: ['Macro','\\;\\Longrightarrow\\;'], + impliedby: ['Macro','\\;\\Longleftarrow\\;'] + } + + },null,true); + + var REL = MML.mo.OPTYPES.REL; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u2322': REL, // smallfrown + '\u2323': REL, // smallsmile + '\u25B3': REL, // vartriangle + '\uE006': REL, // nshortmid + '\uE007': REL, // nshortparallel + '\uE00C': REL, // lvertneqq + '\uE00D': REL, // gvertneqq + '\uE00E': REL, // ngeqq + '\uE00F': REL, // ngeqslant + '\uE010': REL, // nleqslant + '\uE011': REL, // nleqq + '\uE016': REL, // nsubseteqq + '\uE017': REL, // varsubsetneqq + '\uE018': REL, // nsupseteqq + '\uE019': REL, // varsupsetneqq + '\uE01A': REL, // varsubsetneq + '\uE01B': REL, // varsupsetneq + '\uE04B': REL, // npreceq + '\uE04F': REL // nsucceq + } + } + }); + + MathJax.Hub.Startup.signal.Post("TeX AMSsymbols Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMSsymbols.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/HTML.js b/js/mathjax/extensions/TeX/HTML.js new file mode 100644 index 0000000..75e4e45 --- /dev/null +++ b/js/mathjax/extensions/TeX/HTML.js @@ -0,0 +1,108 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/HTML.js + * + * Implements the \href, \class, \style, \cssId macros. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/HTML"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + TEXDEF.Add({ + macros: { + href: 'HREF_attribute', + "class": 'CLASS_attribute', + style: 'STYLE_attribute', + cssId: 'ID_attribute' + } + },null,true); + + TEX.Parse.Augment({ + + // + // Implements \href{url}{math} + // + HREF_attribute: function (name) { + var url = this.GetArgument(name), + arg = this.GetArgumentMML(name); + this.Push(arg.With({href:url})); + }, + + // + // Implements \class{name}{math} + // + CLASS_attribute: function (name) { + var CLASS = this.GetArgument(name), + arg = this.GetArgumentMML(name); + if (arg["class"] != null) {CLASS = arg["class"] + " " + CLASS} + this.Push(arg.With({"class":CLASS})); + }, + + // + // Implements \style{style-string}{math} + // + STYLE_attribute: function (name) { + var style = this.GetArgument(name), + arg = this.GetArgumentMML(name); + // check that it looks like a style string + if (arg.style != null) { + if (style.charAt(style.length-1) !== ";") {style += ";"} + style = arg.style + " " + style; + } + this.Push(arg.With({style: style})); + }, + + // + // Implements \cssId{id}{math} + // + ID_attribute: function (name) { + var ID = this.GetArgument(name), + arg = this.GetArgumentMML(name); + this.Push(arg.With({id:ID})); + }, + + // + // returns an argument that is a single MathML element + // (in an mrow if necessary) + // + GetArgumentMML: function (name) { + var arg = this.ParseArg(name); + if (arg.inferred && arg.data.length == 1) + {arg = arg.data[0]} else {delete arg.inferred} + return arg; + } + + }); + + MathJax.Hub.Startup.signal.Post("TeX HTML Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/action.js b/js/mathjax/extensions/TeX/action.js new file mode 100644 index 0000000..5ef06fd --- /dev/null +++ b/js/mathjax/extensions/TeX/action.js @@ -0,0 +1,85 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/action.js + * + * Implements the \mathtip, \texttip, and \toggle macros, which give + * access from TeX to the tag in the MathML that underlies + * MathJax's internal format. + * + * Usage: + * + * \mathtip{math}{tip} % use "tip" (in math mode) as tooltip for "math" + * \texttip{math}{tip} % use "tip" (in text mode) as tooltip for "math" + * \toggle{math1}{math2}...\endtoggle + * % show math1, and when clicked, show math2, and so on. + * % When the last one is clicked, go back to math1. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/action"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX, + MML = MathJax.ElementJax.mml; + + // + // Set up control sequenecs + // + TEX.Definitions.Add({ + macros: { + toggle: 'Toggle', + mathtip: 'Mathtip', + texttip: ['Macro','\\mathtip{#1}{\\text{#2}}',2] + } + },null,true); + + TEX.Parse.Augment({ + + // + // Implement \toggle {math1} {math2} ... \endtoggle + // (as an ) + // + Toggle: function (name) { + var data = [], arg; + while ((arg = this.GetArgument(name)) !== "\\endtoggle") + {data.push(TEX.Parse(arg,this.stack.env).mml())} + this.Push(MML.maction.apply(MML,data).With({actiontype: MML.ACTIONTYPE.TOGGLE})); + }, + + // + // Implement \mathtip{math}{tip} + // (an an ) + // + Mathtip: function(name) { + var arg = this.ParseArg(name), tip = this.ParseArg(name); + this.Push(MML.maction(arg,tip).With({actiontype: MML.ACTIONTYPE.TOOLTIP})); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX action Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/action.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/autobold.js b/js/mathjax/extensions/TeX/autobold.js new file mode 100644 index 0000000..1d058ee --- /dev/null +++ b/js/mathjax/extensions/TeX/autobold.js @@ -0,0 +1,52 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/autobold.js + * + * Adds \boldsymbol around mathematics that appears in a section + * of an HTML page that is in bold. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/autobold"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX; + + TEX.prefilterHooks.Add(function (data) { + var span = data.script.parentNode.insertBefore(document.createElement("span"),data.script); + span.visibility = "hidden"; + span.style.fontFamily = "Times, serif"; + span.appendChild(document.createTextNode("ABCXYZabcxyz")); + var W = span.offsetWidth; + span.style.fontWeight = "bold"; + if (W && span.offsetWidth === W) {data.math = "\\boldsymbol{"+data.math+"}"} + span.parentNode.removeChild(span); + }); + + MathJax.Hub.Startup.signal.Post("TeX autobold Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/autobold.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/autoload-all.js b/js/mathjax/extensions/TeX/autoload-all.js new file mode 100644 index 0000000..6032aad --- /dev/null +++ b/js/mathjax/extensions/TeX/autoload-all.js @@ -0,0 +1,85 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/autoload-all.js + * + * Provides pre-defined macros to autoload all the extensions + * so that all macros that MathJax knows about are available. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/autoload-all"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var EXTENSIONS = { + action: ["mathtip","texttip","toggle"], + AMSmath: ["mathring","nobreakspace","negmedspace","negthickspace","intI", + "iiiint","idotsint","dddot","ddddot","sideset","boxed", + "substack","injlim","projlim","varliminf","varlimsup", + "varinjlim","varprojlim","DeclareMathOperator","operatorname", + "genfrac","tfrac","dfrac","binom","tbinom","dbinom","cfrac", + "shoveleft","shoveright","xrightarrow","xleftarrow"], + begingroup: ["begingroup","endgroup","gdef","global"], + cancel: ["cancel","bcancel","xcancel","cancelto"], + color: ["color","textcolor","colorbox","fcolorbox","definecolor"], + enclose: ["enclose"], + extpfeil: ["Newextarrow","xlongequal","xmapsto","xtofrom", + "xtwoheadleftarrow","xtwoheadrightarrow"], + mhchem: ["ce","cee","cf"] + }; + + var ENVIRONMENTS = { + AMSmath: ["subarray","smallmatrix","equation","equation*"], + AMScd: ["CD"] + }; + + var name, i, m, defs = {macros:{}, environment:{}}; + + for (name in EXTENSIONS) {if (EXTENSIONS.hasOwnProperty(name)) { + if (!MathJax.Extension["TeX/"+name]) { + var macros = EXTENSIONS[name]; + for (i = 0, m = macros.length; i < m; i++) + {defs.macros[macros[i]] = ["Extension",name]} + } + }} + + for (name in ENVIRONMENTS) {if (ENVIRONMENTS.hasOwnProperty(name)) { + if (!MathJax.Extension["TeX/"+name]) { + var envs = ENVIRONMENTS[name]; + for (i = 0, m = envs.length; i < m; i++) + {defs.environment[envs[i]] = ["ExtensionEnv",null,name]} + } + }} + + MathJax.InputJax.TeX.Definitions.Add(defs); + + MathJax.Hub.Startup.signal.Post("TeX autoload-all Ready"); + +}); + +MathJax.Callback.Queue( + ["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/AMSsymbols.js"], + ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/autoload-all.js"] +); +// @license-end diff --git a/js/mathjax/extensions/TeX/bbox.js b/js/mathjax/extensions/TeX/bbox.js new file mode 100644 index 0000000..cc5440a --- /dev/null +++ b/js/mathjax/extensions/TeX/bbox.js @@ -0,0 +1,104 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/bbox.js + * + * This file implements the \bbox macro, which creates an box that + * can be styled (for background colors, and so on). You can include + * an optional dimension that tells how much extra padding to include + * around the bounding box for the mathematics, or a color specification + * for the background color to use, or both. E.g., + * + * \bbox[2pt]{x+y} % an invisible box around x+y with 2pt of extra space + * \bbox[green]{x+y} % a green box around x+y + * \bbox[green,2pt]{x+y} % a green box with 2pt of extra space + * + * You can also specify style attributes, for example + * + * \bbox[red,border:3px solid blue,5px]{x+y} + * + * would give a red background with a 3px solid blue border that has 5px + * of padding between the border and the mathematics. Note that not all + * output formats support the style specifications. In particular, the + * NativeMML output depends on the browser to render the attributes, and + * not all MathML renderers will honor them (e.g., MathPlayer2 doesn't + * render border styles). + * + * This file will be loaded automatically when \bbox is first used. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/bbox"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX, + MML = MathJax.ElementJax.mml; + + TEX.Definitions.Add({macros: {bbox: "BBox"}},null,true); + + TEX.Parse.Augment({ + BBox: function (name) { + var bbox = this.GetBrackets(name,""), + math = this.ParseArg(name); + var parts = bbox.split(/,/), def, background, style; + for (var i = 0, m = parts.length; i < m; i++) { + var part = parts[i].replace(/^\s+/,'').replace(/\s+$/,''); + var match = part.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/); + if (match) { + if (def) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])} + var pad = this.BBoxPadding(match[1]+match[3]); + if (pad) def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]}; + } else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) { + if (background) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])} + background = part; + } else if (part.match(/^[-a-z]+:/i)) { + if (style) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2", "Style",name])} + style = this.BBoxStyle(part); + } else if (part !== "") { + TEX.Error( + ["InvalidBBoxProperty", + "'%1' doesn't look like a color, a padding dimension, or a style", + part] + ); + } + } + if (def) {math = MML.mpadded(math).With(def)} + if (background || style) { + math = MML.mstyle(math).With({mathbackground:background, style:style}); + } + this.Push(math); + }, + BBoxStyle: function (styles) {return styles}, + BBoxPadding: function (pad) {return pad} + }); + + MathJax.Hub.Startup.signal.Post("TeX bbox Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/bbox.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/begingroup.js b/js/mathjax/extensions/TeX/begingroup.js new file mode 100644 index 0000000..f750fc5 --- /dev/null +++ b/js/mathjax/extensions/TeX/begingroup.js @@ -0,0 +1,294 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/begingroup.js + * + * Implements \begingroup and \endgroup commands that make local + * definitions possible and are removed when the \endgroup occurs. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/begingroup"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX, + TEXDEF = TEX.Definitions; + + /****************************************************/ + + // + // A namespace for localizing macros and environments + // (\begingroup and \endgroup create and destroy these) + // + var NSFRAME = MathJax.Object.Subclass({ + macros: null, // the local macro definitions + environments: null, // the local environments + Init: function (macros,environments) { + this.macros = (macros || {}); + this.environments = (environments || {}); + }, + // + // Find a macro or environment by name + // + Find: function (name,type) {if (this[type].hasOwnProperty(name)) {return this[type][name]}}, + // + // Define or remove a macro or environment + // + Def: function (name,value,type) {this[type][name] = value}, + Undef: function (name,type) {delete this[type][name]}, + // + // Merge two namespaces (used when the equation namespace is combined with the root one) + // + Merge: function (frame) { + MathJax.Hub.Insert(this.macros,frame.macros); + MathJax.Hub.Insert(this.environments,frame.environments); + }, + // + // Move global macros to the stack (globally) and remove from the frame + // + MergeGlobals: function (stack) { + var macros = this.macros; + for (var cs in macros) {if (macros.hasOwnProperty(cs) && macros[cs].global) { + stack.Def(cs,macros[cs],"macros",true); + delete macros[cs].global; delete macros[cs]; + }} + }, + // + // Clear the macro and environment lists + // (but not global macros unless "all" is true) + // + Clear: function (all) { + this.environments = {}; + if (all) {this.macros = {}} else { + var macros = this.macros; + for (var cs in macros) { + if (macros.hasOwnProperty(cs) && !macros[cs].global) {delete macros[cs]} + } + } + return this; + } + }); + + /****************************************************/ + + // + // A Stack of namespace frames + // + var NSSTACK = TEX.nsStack = MathJax.Object.Subclass({ + stack: null, // the namespace frames + top: 0, // the current top one (we don't pop for real until the equation completes) + isEqn: false, // true if this is the equation stack (not the global one) + // + // Set up the initial stack frame + // + Init: function (eqn) { + this.isEqn = eqn; this.stack = []; + if (!eqn) {this.Push(NSFRAME(TEXDEF.macros,TEXDEF.environment))} + else {this.Push(NSFRAME())} + }, + // + // Define a macro or environment in the top frame + // + Def: function (name,value,type,global) { + var n = this.top-1; + if (global) { + // + // Define global macros in the base frame and remove that cs + // from all other frames. Mark the global ones in equations + // so they can be made global when merged with the root stack. + // + while (n > 0) {this.stack[n].Undef(name,type); n--} + if (!MathJax.Object.isArray(value)) {value = [value]} + if (this.isEqn) {value.global = true} + } + this.stack[n].Def(name,value,type); + }, + // + // Push a new namespace frame on the stack + // + Push: function (frame) { + this.stack.push(frame); + this.top = this.stack.length; + }, + // + // Pop the top stack frame + // (if it is the root, just keep track of the pop so we can + // reset it if the equation is reprocessed) + // + Pop: function () { + var top; + if (this.top > 1) { + top = this.stack[--this.top]; + if (this.isEqn) {this.stack.pop()} + } else if (this.isEqn) { + this.Clear(); + } + return top; + }, + // + // Search the stack from top to bottom for the first + // definition of the given control sequence in the given type + // + Find: function (name,type) { + for (var i = this.top-1; i >= 0; i--) { + var def = this.stack[i].Find(name,type); + if (def) {return def} + } + return null; + }, + // + // Combine the equation stack with the global one + // (The bottom frame of the equation goes with the top frame of the global one, + // and the remainder are pushed on the global stack, truncated to the + // position where items were poped from it.) + // + Merge: function (stack) { + stack.stack[0].MergeGlobals(this); + this.stack[this.top-1].Merge(stack.stack[0]); + var data = [this.top,this.stack.length-this.top].concat(stack.stack.slice(1)); + this.stack.splice.apply(this.stack,data); + this.top = this.stack.length; + }, + // + // Put back the temporarily poped items + // + Reset: function () {this.top = this.stack.length}, + // + // Clear the stack and start with a blank frame + // + Clear: function (all) { + this.stack = [this.stack[0].Clear()]; + this.top = this.stack.length; + } + },{ + nsFrame: NSFRAME + }); + + /****************************************************/ + + // + // Define the new macros + // + TEXDEF.Add({ + macros: { + begingroup: "BeginGroup", + endgroup: "EndGroup", + global: "Global", + gdef: ["Macro","\\global\\def"] + } + },null,true); + + TEX.Parse.Augment({ + // + // Implement \begingroup + // + BeginGroup: function (name) { + TEX.eqnStack.Push(NSFRAME()); + }, + // + // Implements \endgroup + // + EndGroup: function (name) { + // + // If the equation has pushed frames, pop one, + // Otherwise clear the equation stack and pop the top global one + // + if (TEX.eqnStack.top > 1) { + TEX.eqnStack.Pop(); + } else if (TEX.rootStack.top === 1) { + TEX.Error(["ExtraEndMissingBegin","Extra %1 or missing \\begingroup",name]); + } else { + TEX.eqnStack.Clear(); + TEX.rootStack.Pop(); + } + }, + + // + // Replace the original routines with ones that looks through the + // equation and root stacks for the given name + // + csFindMacro: function (name) { + return (TEX.eqnStack.Find(name,"macros") || TEX.rootStack.Find(name,"macros")); + }, + envFindName: function (name) { + return (TEX.eqnStack.Find(name,"environments") || TEX.rootStack.Find(name,"environments")); + }, + + // + // Modify the way macros and environments are defined + // to make them go into the equation namespace stack + // + setDef: function (name,value) { + value.isUser = true; + TEX.eqnStack.Def(name,value,"macros",this.stack.env.isGlobal); + delete this.stack.env.isGlobal; + }, + setEnv: function (name,value) { + value.isUser = true; + TEX.eqnStack.Def(name,value,"environments") + }, + + // + // Implement \global (for \global\let, \global\def and \global\newcommand) + // + Global: function (name) { + var i = this.i; var cs = this.GetCSname(name); this.i = i; + if (cs !== "let" && cs !== "def" && cs !== "newcommand" && + cs !== "DeclareMathOperator" && cs !== "Newextarrow") { + TEX.Error(["GlobalNotFollowedBy", + "%1 not followed by \\let, \\def, or \\newcommand",name]); + } + this.stack.env.isGlobal = true; + } + }); + + /****************************************************/ + + TEX.rootStack = NSSTACK(); // the global namespace stack + TEX.eqnStack = NSSTACK(true); // the equation stack + + // + // Reset the global stack and clear the equation stack + // (this gets us back to the initial stack state as it was + // before the equation was first processed, in case the equation + // get restarted due to an autoloaded file) + // + TEX.prefilterHooks.Add(function () {TEX.rootStack.Reset(); TEX.eqnStack.Clear(true)}); + + // + // We only get here if there were no errors and the equation is fully + // processed (all restarts are complete). So we merge the equation + // stack into the global stack, thus making the changes from this + // equation permanent. + // + TEX.postfilterHooks.Add(function () {TEX.rootStack.Merge(TEX.eqnStack)}); + + /*********************************************************/ + + MathJax.Hub.Startup.signal.Post("TeX begingroup Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/begingroup.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/boldsymbol.js b/js/mathjax/extensions/TeX/boldsymbol.js new file mode 100644 index 0000000..e25fff0 --- /dev/null +++ b/js/mathjax/extensions/TeX/boldsymbol.js @@ -0,0 +1,77 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/boldsymbol.js + * + * Implements the \boldsymbol{...} command to make bold + * versions of all math characters (not just variables). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/boldsymbol"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var MML = MathJax.ElementJax.mml; + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + var BOLDVARIANT = {}; + BOLDVARIANT[MML.VARIANT.NORMAL] = MML.VARIANT.BOLD; + BOLDVARIANT[MML.VARIANT.ITALIC] = MML.VARIANT.BOLDITALIC; + BOLDVARIANT[MML.VARIANT.FRAKTUR] = MML.VARIANT.BOLDFRAKTUR; + BOLDVARIANT[MML.VARIANT.SCRIPT] = MML.VARIANT.BOLDSCRIPT; + BOLDVARIANT[MML.VARIANT.SANSSERIF] = MML.VARIANT.BOLDSANSSERIF; + BOLDVARIANT["-tex-caligraphic"] = "-tex-caligraphic-bold"; + BOLDVARIANT["-tex-oldstyle"] = "-tex-oldstyle-bold"; + + TEXDEF.Add({macros: {boldsymbol: 'Boldsymbol'}},null,true); + + TEX.Parse.Augment({ + mmlToken: function (token) { + if (this.stack.env.boldsymbol) { + var variant = token.Get("mathvariant"); + if (variant == null) {token.mathvariant = MML.VARIANT.BOLD} + else {token.mathvariant = (BOLDVARIANT[variant]||variant)} + } + return token; + }, + + Boldsymbol: function (name) { + var boldsymbol = this.stack.env.boldsymbol, + font = this.stack.env.font; + this.stack.env.boldsymbol = true; + this.stack.env.font = null; + var mml = this.ParseArg(name); + this.stack.env.font = font; + this.stack.env.boldsymbol = boldsymbol; + this.Push(mml); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX boldsymbol Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/boldsymbol.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/cancel.js b/js/mathjax/extensions/TeX/cancel.js new file mode 100644 index 0000000..9f2afe8 --- /dev/null +++ b/js/mathjax/extensions/TeX/cancel.js @@ -0,0 +1,112 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/cancel.js + * + * Implements the \cancel, \bcancel, \xcancel, and \cancelto macros. + * + * Usage: + * + * \cancel{math} % strikeout math from lower left to upper right + * \bcancel{math} % strikeout from upper left to lower right + * \xcancel{math} % strikeout with an X + * \cancelto{value}{math} % strikeout with arrow going to value + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/cancel"] = { + version: "2.7.9", + + // + // The attributes allowed in \enclose{notation}[attributes]{math} + // + ALLOWED: { + color: 1, mathcolor: 1, + background: 1, mathbackground: 1, + padding: 1, + thickness: 1 + } +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX, + MML = MathJax.ElementJax.mml, + CANCEL = MathJax.Extension["TeX/cancel"]; + + CANCEL.setAttributes = function (def,attr) { + if (attr !== "") { + attr = attr.replace(/ /g,"").split(/,/); + for (var i = 0, m = attr.length; i < m; i++) { + var keyvalue = attr[i].split(/[:=]/); + if (CANCEL.ALLOWED[keyvalue[0]]) { + if (keyvalue[1] === "true") {keyvalue[1] = true} + if (keyvalue[1] === "false") {keyvalue[1] = false} + def[keyvalue[0]] = keyvalue[1]; + } + } + } + return def; + }; + + // + // Set up macros + // + TEX.Definitions.Add({ + macros: { + cancel: ['Cancel',MML.NOTATION.UPDIAGONALSTRIKE], + bcancel: ['Cancel',MML.NOTATION.DOWNDIAGONALSTRIKE], + xcancel: ['Cancel',MML.NOTATION.UPDIAGONALSTRIKE+" "+MML.NOTATION.DOWNDIAGONALSTRIKE], + cancelto: 'CancelTo' + } + },null,true); + + TEX.Parse.Augment({ + // + // Implement \cancel[attributes]{math}, + // \bcancel[attributes]{math}, and + // \xcancel[attributes]{math} + // + Cancel: function(name,notation) { + var attr = this.GetBrackets(name,""), math = this.ParseArg(name); + var def = CANCEL.setAttributes({notation: notation},attr); + this.Push(MML.menclose(math).With(def)); + }, + + // + // Implement \cancelto{value}[attributes]{math} + // + CancelTo: function(name,notation) { + var value = this.ParseArg(name), + attr = this.GetBrackets(name,""), + math = this.ParseArg(name); + var def = CANCEL.setAttributes({notation: MML.NOTATION.UPDIAGONALSTRIKE+" "+MML.NOTATION.UPDIAGONALARROW},attr); + value = MML.mpadded(value).With({depth:"-.1em",height:"+.1em",voffset:".1em"}); + this.Push(MML.msup(MML.menclose(math).With(def),value)); + } + + }); + + MathJax.Hub.Startup.signal.Post("TeX cancel Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/cancel.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/color.js b/js/mathjax/extensions/TeX/color.js new file mode 100644 index 0000000..45c9b9e --- /dev/null +++ b/js/mathjax/extensions/TeX/color.js @@ -0,0 +1,283 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/color.js + * + * Implements LaTeX-compatible \color macro rather than MathJax's original + * (non-standard) version. It includes the rgb, RGB, gray, and named color + * models, and the \textcolor, \definecolor, \colorbox, and \fcolorbox + * macros. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// The configuration defaults, augmented by the user settings +// +MathJax.Extension["TeX/color"] = { + version: "2.7.9", + + config: MathJax.Hub.CombineConfig("TeX.color",{ + padding: "5px", + border: "2px" + }), + + colors: { + Apricot: "#FBB982", + Aquamarine: "#00B5BE", + Bittersweet: "#C04F17", + Black: "#221E1F", + Blue: "#2D2F92", + BlueGreen: "#00B3B8", + BlueViolet: "#473992", + BrickRed: "#B6321C", + Brown: "#792500", + BurntOrange: "#F7921D", + CadetBlue: "#74729A", + CarnationPink: "#F282B4", + Cerulean: "#00A2E3", + CornflowerBlue: "#41B0E4", + Cyan: "#00AEEF", + Dandelion: "#FDBC42", + DarkOrchid: "#A4538A", + Emerald: "#00A99D", + ForestGreen: "#009B55", + Fuchsia: "#8C368C", + Goldenrod: "#FFDF42", + Gray: "#949698", + Green: "#00A64F", + GreenYellow: "#DFE674", + JungleGreen: "#00A99A", + Lavender: "#F49EC4", + LimeGreen: "#8DC73E", + Magenta: "#EC008C", + Mahogany: "#A9341F", + Maroon: "#AF3235", + Melon: "#F89E7B", + MidnightBlue: "#006795", + Mulberry: "#A93C93", + NavyBlue: "#006EB8", + OliveGreen: "#3C8031", + Orange: "#F58137", + OrangeRed: "#ED135A", + Orchid: "#AF72B0", + Peach: "#F7965A", + Periwinkle: "#7977B8", + PineGreen: "#008B72", + Plum: "#92268F", + ProcessBlue: "#00B0F0", + Purple: "#99479B", + RawSienna: "#974006", + Red: "#ED1B23", + RedOrange: "#F26035", + RedViolet: "#A1246B", + Rhodamine: "#EF559F", + RoyalBlue: "#0071BC", + RoyalPurple: "#613F99", + RubineRed: "#ED017D", + Salmon: "#F69289", + SeaGreen: "#3FBC9D", + Sepia: "#671800", + SkyBlue: "#46C5DD", + SpringGreen: "#C6DC67", + Tan: "#DA9D76", + TealBlue: "#00AEB3", + Thistle: "#D883B7", + Turquoise: "#00B4CE", + Violet: "#58429B", + VioletRed: "#EF58A0", + White: "#FFFFFF", + WildStrawberry: "#EE2967", + Yellow: "#FFF200", + YellowGreen: "#98CC70", + YellowOrange: "#FAA21A" + }, + + /* + * Look up a color based on its model and definition + */ + getColor: function (model,def) { + if (!model) {model = "named"} + var fn = this["get_"+model]; + if (!fn) {this.TEX.Error(["UndefinedColorModel","Color model '%1' not defined",model])} + return fn.call(this,def); + }, + + /* + * Get an rgb color + */ + get_rgb: function (rgb) { + rgb = rgb.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s*,\s*/); var RGB = "#"; + if (rgb.length !== 3) + {this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","rgb"])} + for (var i = 0; i < 3; i++) { + if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) + {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} + var n = parseFloat(rgb[i]); + if (n < 0 || n > 1) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "rgb",0,1]); + } + n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} + RGB += n; + } + return RGB; + }, + + /* + * Get an RGB color + */ + get_RGB: function (rgb) { + rgb = rgb.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s*,\s*/); var RGB = "#"; + if (rgb.length !== 3) + {this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","RGB"])} + for (var i = 0; i < 3; i++) { + if (!rgb[i].match(/^\d+$/)) + {this.TEX.Error(["InvalidNumber","Invalid number"])} + var n = parseInt(rgb[i]); + if (n > 255) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "RGB",0,255]); + } + n = n.toString(16); if (n.length < 2) {n = "0"+n} + RGB += n; + } + return RGB; + }, + + /* + * Get a gray-scale value + */ + get_gray: function (gray) { + if (!gray.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/)) + {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} + var n = parseFloat(gray); + if (n < 0 || n > 1) { + this.TEX.Error(["ModelArg2", + "Color values for the %1 model must be between %2 and %3", + "gray",0,1]); + } + n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} + return "#"+n+n+n; + }, + + /* + * Get a named value + */ + get_named: function (name) { + if (this.colors.hasOwnProperty(name)) {return this.colors[name]} + return name; + }, + + padding: function () { + var pad = "+"+this.config.padding; + var unit = this.config.padding.replace(/^.*?([a-z]*)$/,"$1"); + var pad2 = "+"+(2*parseFloat(pad))+unit; + return {width:pad2, height:pad, depth:pad, lspace:this.config.padding}; + } + +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX, + MML = MathJax.ElementJax.mml; + var STACKITEM = TEX.Stack.Item; + var COLOR = MathJax.Extension["TeX/color"]; + + COLOR.TEX = TEX; // for reference in getColor above + + TEX.Definitions.Add({ + macros: { + color: "Color", + textcolor: "TextColor", + definecolor: "DefineColor", + colorbox: "ColorBox", + fcolorbox: "fColorBox" + } + },null,true); + + TEX.Parse.Augment({ + + // + // Override \color macro definition + // + Color: function (name) { + var model = this.GetBrackets(name), + color = this.GetArgument(name); + color = COLOR.getColor(model,color); + var mml = STACKITEM.style().With({styles:{mathcolor:color}}); + this.stack.env.color = color; + this.Push(mml); + }, + + TextColor: function (name) { + var model = this.GetBrackets(name), + color = this.GetArgument(name); + color = COLOR.getColor(model,color); + var old = this.stack.env.color; this.stack.env.color = color; + var math = this.ParseArg(name); + if (old) {this.stack.env.color} else {delete this.stack.env.color} + this.Push(MML.mstyle(math).With({mathcolor: color})); + }, + + // + // Define the \definecolor macro + // + DefineColor: function (name) { + var cname = this.GetArgument(name), + model = this.GetArgument(name), + def = this.GetArgument(name); + COLOR.colors[cname] = COLOR.getColor(model,def); + }, + + // + // Produce a text box with a colored background + // + ColorBox: function (name) { + var cname = this.GetArgument(name), + arg = this.InternalMath(this.GetArgument(name)); + this.Push(MML.mpadded.apply(MML,arg).With({ + mathbackground:COLOR.getColor("named",cname) + }).With(COLOR.padding())); + }, + + // + // Procude a framed text box with a colored background + // + fColorBox: function (name) { + var fname = this.GetArgument(name), + cname = this.GetArgument(name), + arg = this.InternalMath(this.GetArgument(name)); + this.Push(MML.mpadded.apply(MML,arg).With({ + mathbackground: COLOR.getColor("named",cname), + style: "border: "+COLOR.config.border+" solid "+COLOR.getColor("named",fname) + }).With(COLOR.padding())); + } + + }); + + MathJax.Hub.Startup.signal.Post("TeX color Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/color.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/enclose.js b/js/mathjax/extensions/TeX/enclose.js new file mode 100644 index 0000000..0976984 --- /dev/null +++ b/js/mathjax/extensions/TeX/enclose.js @@ -0,0 +1,93 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/enclose.js + * + * Implements the \enclose macros, which give access from TeX to the + * tag in the MathML that underlies MathJax's internal format. + * + * Usage: + * + * \enclose{notation}{math} % enclose math using given notation + * \enclose{notation,notation,...}{math} % enclose with several notations + * \enclose{notation}[attributes]{math} % enclose with attributes + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/enclose"] = { + version: "2.7.9", + + // + // The attributes allowed in \enclose{notation}[attributes]{math} + // + ALLOWED: { + arrow: 1, + color: 1, mathcolor: 1, + background: 1, mathbackground: 1, + padding: 1, + thickness: 1 + } +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX, + MML = MathJax.ElementJax.mml, + ALLOW = MathJax.Extension["TeX/enclose"].ALLOWED; + + // + // Set up macro + // + TEX.Definitions.Add({macros: {enclose: 'Enclose'}},null,true); + + TEX.Parse.Augment({ + // + // Implement \enclose{notation}[attr]{math} + // (create math) + // + Enclose: function(name) { + var notation = this.GetArgument(name), + attr = this.GetBrackets(name), + math = this.ParseArg(name); + var def = {notation: notation.replace(/,/g," ")}; + if (attr) { + attr = attr.replace(/ /g,"").split(/,/); + for (var i = 0, m = attr.length; i < m; i++) { + var keyvalue = attr[i].split(/[:=]/); + if (ALLOW[keyvalue[0]]) { + keyvalue[1] = keyvalue[1].replace(/^"(.*)"$/,"$1"); + if (keyvalue[1] === "true") {keyvalue[1] = true} + if (keyvalue[1] === "false") {keyvalue[1] = false} + if (keyvalue[0] === "arrow" && keyvalue[1]) + {def.notation = def.notation + " updiagonalarrow"} else + {def[keyvalue[0]] = keyvalue[1]} + } + } + } + this.Push(MML.menclose(math).With(def)); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX enclose Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/enclose.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/extpfeil.js b/js/mathjax/extensions/TeX/extpfeil.js new file mode 100644 index 0000000..f07adac --- /dev/null +++ b/js/mathjax/extensions/TeX/extpfeil.js @@ -0,0 +1,104 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/extpfeil.js + * + * Implements additional stretchy arrow macros. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/extpfeil"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX, + TEXDEF = TEX.Definitions; + + // + // Define the arrows to load the AMSmath extension + // (since they need its xArrow method) + // + TEXDEF.Add({ + macros: { + xtwoheadrightarrow: ['Extension','AMSmath'], + xtwoheadleftarrow: ['Extension','AMSmath'], + xmapsto: ['Extension','AMSmath'], + xlongequal: ['Extension','AMSmath'], + xtofrom: ['Extension','AMSmath'], + Newextarrow: ['Extension','AMSmath'] + } + },null,true); + + // + // Redefine the macros when AMSmath is loaded + // + MathJax.Hub.Register.StartupHook("TeX AMSmath Ready",function () { + MathJax.Hub.Insert(TEXDEF,{ + macros: { + xtwoheadrightarrow: ['xArrow',0x21A0,12,16], + xtwoheadleftarrow: ['xArrow',0x219E,17,13], + xmapsto: ['xArrow',0x21A6,6,7], + xlongequal: ['xArrow',0x003D,7,7], + xtofrom: ['xArrow',0x21C4,12,12], + Newextarrow: 'NewExtArrow' + } + }); + }); + + // + // Implements \Newextarrow to define a new arrow (not compatible with \newextarrow, but + // the equivalent for MathJax) + // + TEX.Parse.Augment({ + NewExtArrow: function (name) { + var cs = this.GetArgument(name), + space = this.GetArgument(name), + chr = this.GetArgument(name); + if (!cs.match(/^\\([a-z]+|.)$/i)) { + TEX.Error(["NewextarrowArg1", + "First argument to %1 must be a control sequence name",name]); + } + if (!space.match(/^(\d+),(\d+)$/)) { + TEX.Error( + ["NewextarrowArg2", + "Second argument to %1 must be two integers separated by a comma", + name] + ); + } + if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) { + TEX.Error( + ["NewextarrowArg3", + "Third argument to %1 must be a unicode character number", + name] + ); + } + cs = cs.substr(1); space = space.split(","); chr = parseInt(chr); + this.setDef(cs, ['xArrow', chr, parseInt(space[0]), parseInt(space[1])]); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX extpfeil Ready"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/extpfeil.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/mathchoice.js b/js/mathjax/extensions/TeX/mathchoice.js new file mode 100644 index 0000000..7042395 --- /dev/null +++ b/js/mathjax/extensions/TeX/mathchoice.js @@ -0,0 +1,109 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/mathchoice.js + * + * Implements the \mathchoice macro (rarely used) + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var VERSION = "2.7.9"; + + var MML = MathJax.ElementJax.mml; + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + TEXDEF.Add({macros: {mathchoice: 'MathChoice'}},null,true); + + TEX.Parse.Augment({ + MathChoice: function (name) { + var D = this.ParseArg(name), + T = this.ParseArg(name), + S = this.ParseArg(name), + SS = this.ParseArg(name); + this.Push(MML.TeXmathchoice(D,T,S,SS)); + } + }); + + MML.TeXmathchoice = MML.mbase.Subclass({ + type: "TeXmathchoice", notParent: true, + choice: function () { + if (this.selection != null) return this.selection; + if (this.choosing) return 2; // prevent infinite loops: see issue #1151 + this.choosing = true; + var selection = 0, values = this.getValues("displaystyle","scriptlevel"); + if (values.scriptlevel > 0) {selection = Math.min(3,values.scriptlevel+1)} + else {selection = (values.displaystyle ? 0 : 1)} + // only cache the result if we are actually in place in a tag. + var node = this.inherit; while (node && node.type !== "math") node = node.inherit; + if (node) this.selection = selection; + this.choosing = false; + return selection; + }, + selected: function () {return this.data[this.choice()]}, + setTeXclass: function (prev) {return this.selected().setTeXclass(prev)}, + isSpacelike: function () {return this.selected().isSpacelike()}, + isEmbellished: function () {return this.selected().isEmbellished()}, + Core: function () {return this.selected()}, + CoreMO: function () {return this.selected().CoreMO()}, + toHTML: function (span) { + span = this.HTMLcreateSpan(span); + span.bbox = this.Core().toHTML(span).bbox; + // Firefox doesn't correctly handle a span with a negatively sized content, + // so move marginLeft to main span (this is a hack to get \iiiint to work). + // FIXME: This is a symptom of a more general problem with Firefox, and + // there probably needs to be a more general solution (e.g., modifying + // HTMLhandleSpace() to get the width and adjust the right margin to + // compensate for negative-width contents) + if (span.firstChild && span.firstChild.style.marginLeft) { + span.style.marginLeft = span.firstChild.style.marginLeft; + span.firstChild.style.marginLeft = ""; + } + return span; + }, + toSVG: function () { + var svg = this.Core().toSVG(); + this.SVGsaveData(svg); + return svg; + }, + toCommonHTML: function (node) { + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleColor(node); + this.CHTMLaddChild(node,this.choice(),{}); + return node; + }, + toPreviewHTML: function(span) { + span = this.PHTMLcreateSpan(span); + this.PHTMLhandleStyle(span); + this.PHTMLhandleColor(span); + this.PHTMLaddChild(span,this.choice(),{}); + return span; + } + }); + + MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/mediawiki-texvc.js b/js/mathjax/extensions/TeX/mediawiki-texvc.js new file mode 100644 index 0000000..ab1ed42 --- /dev/null +++ b/js/mathjax/extensions/TeX/mediawiki-texvc.js @@ -0,0 +1,138 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/extensions/TeX/mediawiki-texvc.js + * + * Implements macros used by mediawiki with their texvc preprocessor. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/mediawiki-texvc"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () { + MathJax.InputJax.TeX.Definitions.Add({ + macros: { + AA: ["Macro", "\u00c5"], + alef: ["Macro", "\\aleph"], + alefsym: ["Macro", "\\aleph"], + Alpha: ["Macro", "\\mathrm{A}"], + and: ["Macro", "\\land"], + ang: ["Macro", "\\angle"], + Bbb: ["Macro", "\\mathbb"], + Beta: ["Macro", "\\mathrm{B}"], + bold: ["Macro", "\\mathbf"], + bull: ["Macro", "\\bullet"], + C: ["Macro", "\\mathbb{C}"], + Chi: ["Macro", "\\mathrm{X}"], + clubs: ["Macro", "\\clubsuit"], + cnums: ["Macro", "\\mathbb{C}"], + Complex: ["Macro", "\\mathbb{C}"], + coppa: ["Macro", "\u03D9"], + Coppa: ["Macro", "\u03D8"], + Dagger: ["Macro", "\\ddagger"], + Digamma: ["Macro", "\u03DC"], + darr: ["Macro", "\\downarrow"], + dArr: ["Macro", "\\Downarrow"], + Darr: ["Macro", "\\Downarrow"], + dashint: ["Macro", "\\unicodeInt{x2A0D}"], + ddashint: ["Macro", "\\unicodeInt{x2A0E}"], + diamonds: ["Macro", "\\diamondsuit"], + empty: ["Macro", "\\emptyset"], + Epsilon: ["Macro", "\\mathrm{E}"], + Eta: ["Macro", "\\mathrm{H}"], + euro: ["Macro", "\u20AC"], + exist: ["Macro", "\\exists"], + geneuro: ["Macro", "\u20AC"], + geneuronarrow: ["Macro", "\u20AC"], + geneurowide: ["Macro", "\u20AC"], + H: ["Macro", "\\mathbb{H}"], + hAar: ["Macro", "\\Leftrightarrow"], + harr: ["Macro", "\\leftrightarrow"], + Harr: ["Macro", "\\Leftrightarrow"], + hearts: ["Macro", "\\heartsuit"], + image: ["Macro", "\\Im"], + infin: ["Macro", "\\infty"], + Iota: ["Macro", "\\mathrm{I}"], + isin: ["Macro", "\\in"], + Kappa: ["Macro", "\\mathrm{K}"], + koppa: ["Macro", "\u03DF"], + Koppa: ["Macro", "\u03DE"], + lang: ["Macro", "\\langle"], + larr: ["Macro", "\\leftarrow"], + Larr: ["Macro", "\\Leftarrow"], + lArr: ["Macro", "\\Leftarrow"], + lrarr: ["Macro", "\\leftrightarrow"], + Lrarr: ["Macro", "\\Leftrightarrow"], + lrArr: ["Macro", "\\Leftrightarrow"], + Mu: ["Macro", "\\mathrm{M}"], + N: ["Macro", "\\mathbb{N}"], + natnums: ["Macro", "\\mathbb{N}"], + Nu: ["Macro", "\\mathrm{N}"], + O: ["Macro", "\\emptyset"], + oiint: ["Macro", "\\unicodeInt{x222F}"], + oiiint: ["Macro", "\\unicodeInt{x2230}"], + ointctrclockwise: ["Macro", "\\unicodeInt{x2233}"], + officialeuro: ["Macro", "\u20AC"], + Omicron: ["Macro", "\\mathrm{O}"], + or: ["Macro", "\\lor"], + P: ["Macro", "\u00B6"], + pagecolor: ['Macro','',1], // ignore \pagecolor{} + part: ["Macro", "\\partial"], + plusmn: ["Macro", "\\pm"], + Q: ["Macro", "\\mathbb{Q}"], + R: ["Macro", "\\mathbb{R}"], + rang: ["Macro", "\\rangle"], + rarr: ["Macro", "\\rightarrow"], + Rarr: ["Macro", "\\Rightarrow"], + rArr: ["Macro", "\\Rightarrow"], + real: ["Macro", "\\Re"], + reals: ["Macro", "\\mathbb{R}"], + Reals: ["Macro", "\\mathbb{R}"], + Rho: ["Macro", "\\mathrm{P}"], + sdot: ["Macro", "\\cdot"], + sampi: ["Macro", "\u03E1"], + Sampi: ["Macro", "\u03E0"], + sect: ["Macro", "\\S"], + spades: ["Macro", "\\spadesuit"], + stigma: ["Macro", "\u03DB"], + Stigma: ["Macro", "\u03DA"], + sub: ["Macro", "\\subset"], + sube: ["Macro", "\\subseteq"], + supe: ["Macro", "\\supseteq"], + Tau: ["Macro", "\\mathrm{T}"], + textvisiblespace: ["Macro", "\u2423"], + thetasym: ["Macro", "\\vartheta"], + uarr: ["Macro", "\\uparrow"], + uArr: ["Macro", "\\Uparrow"], + Uarr: ["Macro", "\\Uparrow"], + unicodeInt: ["Macro", "\\mathop{\\vcenter{\\mathchoice{\\huge\\unicode{#1}\\,}{\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}}\\,}\\nolimits", 1], + varcoppa: ["Macro", "\u03D9"], + varstigma: ["Macro", "\u03DB"], + varointclockwise: ["Macro", "\\unicodeInt{x2232}"], + vline: ['Macro','\\smash{\\large\\lvert}',0], + weierp: ["Macro", "\\wp"], + Z: ["Macro", "\\mathbb{Z}"], + Zeta: ["Macro", "\\mathrm{Z}"] + } + }); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mediawiki-texvc.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/mhchem.js b/js/mathjax/extensions/TeX/mhchem.js new file mode 100644 index 0000000..9d15876 --- /dev/null +++ b/js/mathjax/extensions/TeX/mhchem.js @@ -0,0 +1,522 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/mhchem.js + * + * Implements the \ce command for handling chemical formulas + * from the mhchem LaTeX package. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// +// Don't replace [Contrib]/mhchem if it is already loaded +// +if (MathJax.Extension["TeX/mhchem"]) { + MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mhchem.js"); +} else { + +MathJax.Extension["TeX/mhchem"] = { + version: "2.7.9", + config: MathJax.Hub.CombineConfig("TeX.mhchem",{ + legacy: true + }) +}; + +// +// Load [mhchem]/mhchem.js if not configured for legacy vesion +// +if (!MathJax.Extension["TeX/mhchem"].config.legacy) { + if (!MathJax.Ajax.config.path.mhchem) { + MathJax.Ajax.config.path.mhchem = MathJax.Hub.config.root + "/extensions/TeX/mhchem3"; + } + MathJax.Callback.Queue( + ["Require",MathJax.Ajax,"[mhchem]/mhchem.js"], + ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/mhchem.js"] + ); +} else { + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX; + + /* + * This is the main class for handing the \ce and related commands. + * Its main method is Parse() which takes the argument to \ce and + * returns the corresponding TeX string. + */ + + var CE = MathJax.Object.Subclass({ + string: "", // the \ce string being parsed + i: 0, // the current position in the string + tex: "", // the partially processed TeX result + TEX: "", // the full TeX result + atom: false, // last processed token is an atom + sup: "", // pending superscript + sub: "", // pending subscript + presup: "", // pending pre-superscript + presub: "", // pending pre-subscript + + // + // Store the string when a CE object is created + // + Init: function (string) {this.string = string}, + + // + // These are the special characters and the methods that + // handle them. All others are passed through verbatim. + // + ParseTable: { + '-': "Minus", + '+': "Plus", + '(': "Open", + ')': "Close", + '[': "Open", + ']': "Close", + '<': "Less", + '^': "Superscript", + '_': "Subscript", + '*': "Dot", + '.': "Dot", + '=': "Equal", + '#': "Pound", + '$': "Math", + '\\': "Macro", + ' ': "Space" + }, + // + // Basic arrow names for reactions + // + Arrows: { + '->': "rightarrow", + '<-': "leftarrow", + '<->': "leftrightarrow", + '<=>': "rightleftharpoons", + '<=>>': "Rightleftharpoons", + '<<=>': "Leftrightharpoons", + '^': "uparrow", + 'v': "downarrow" + }, + + // + // Implementations for the various bonds + // (the ~ ones are hacks that don't work well in NativeMML) + // + Bonds: { + '-': "-", + '=': "=", + '#': "\\equiv", + '~': "\\tripledash", + '~-': "\\begin{CEstack}{}\\tripledash\\\\-\\end{CEstack}", + '~=': "\\raise2mu{\\begin{CEstack}{}\\tripledash\\\\-\\\\-\\end{CEstack}}", + '~--': "\\raise2mu{\\begin{CEstack}{}\\tripledash\\\\-\\\\-\\end{CEstack}}", + '-~-': "\\raise2mu{\\begin{CEstack}{}-\\\\\\tripledash\\\\-\\end{CEstack}}", + '...': "{\\cdot}{\\cdot}{\\cdot}", + '....': "{\\cdot}{\\cdot}{\\cdot}{\\cdot}", + '->': "\\rightarrow", + '<-': "\\leftarrow", + '??': "\\text{??}" // unknown bond + }, + + // + // This converts the CE string to a TeX string. + // It loops through the string and calls the proper + // method depending on the ccurrent character. + // + Parse: function () { + this.tex = ""; this.atom = false; + while (this.i < this.string.length) { + var c = this.string.charAt(this.i); + if (c.match(/[a-z]/i)) {this.ParseLetter()} + else if (c.match(/[0-9]/)) {this.ParseNumber()} + else {this["Parse"+(this.ParseTable[c]||"Other")](c)} + } + this.FinishAtom(true); + return this.TEX; + }, + + // + // Make an atom name or a down arrow + // + ParseLetter: function () { + this.FinishAtom(); + if (this.Match(/^v( |$)/)) { + this.tex += "{\\"+this.Arrows["v"]+"}"; + } else { + this.tex += "\\text{"+this.Match(/^[a-z]+/i)+"}"; + this.atom = true; + } + }, + + // + // Make a number or fraction preceding an atom, + // or a subscript for an atom. + // + ParseNumber: function () { + var n = this.Match(/^\d+/); + if (this.atom && !this.sub) { + this.sub = n; + } else { + this.FinishAtom(); + var match = this.Match(/^\/\d+/); + if (match) { + var frac = "\\frac{"+n+"}{"+match.substr(1)+"}"; + this.tex += "\\mathchoice{\\textstyle"+frac+"}{"+frac+"}{"+frac+"}{"+frac+"}"; + } else { + this.tex += n; + if (this.i < this.string.length) {this.tex += "\\,"} + } + } + }, + + // + // Make a superscript minus, or an arrow, or a single bond. + // + ParseMinus: function (c) { + if (this.atom && (this.i === this.string.length-1 || this.string.charAt(this.i+1) === " ")) { + this.sup += c; + } else { + this.FinishAtom(); + if (this.string.substr(this.i,2) === "->") {this.i += 2; this.AddArrow("->"); return} + else {this.tex += "{-}"} + } + this.i++; + }, + + // + // Make a superscript plus, or pass it through + // + ParsePlus: function (c) { + if (this.atom) {this.sup += c} else {this.FinishAtom(); this.tex += c} + this.i++; + }, + + // + // Handle dots and double or triple bonds + // + ParseDot: function (c) {this.FinishAtom(); this.tex += "\\cdot "; this.i++}, + ParseEqual: function (c) {this.FinishAtom(); this.tex += "{=}"; this.i++}, + ParsePound: function (c) {this.FinishAtom(); this.tex += "{\\equiv}"; this.i++}, + + // + // Look for (v) or (^), or pass it through + // + ParseOpen: function (c) { + this.FinishAtom(); + var match = this.Match(/^\([v^]\)/); + if (match) {this.tex += "{\\"+this.Arrows[match.charAt(1)]+"}"} + else {this.tex += "{"+c; this.i++} + }, + // + // Allow ) and ] to get super- and subscripts + // + ParseClose: function (c) {this.FinishAtom(); this.atom = true; this.tex += c+"}"; this.i++}, + + // + // Make the proper arrow + // + ParseLess: function (c) { + this.FinishAtom(); + var arrow = this.Match(/^(<->?|<=>>?|<<=>)/); + if (!arrow) {this.tex += c; this.i++} else {this.AddArrow(arrow)} + }, + + // + // Look for a superscript, or an up arrow + // + ParseSuperscript: function (c) { + c = this.string.charAt(++this.i); + if (c === "{") { + this.i++; var m = this.Find("}"); + if (m === "-.") {this.sup += "{-}{\\cdot}"} + else if (m) {this.sup += CE(m).Parse().replace(/^\{-\}/,"-")} + } else if (c === " " || c === "") { + this.tex += "{\\"+this.Arrows["^"]+"}"; this.i++; + } else { + var n = this.Match(/^(\d+|-\.)/); + if (n) {this.sup += n} + } + }, + // + // Look for subscripts + // + ParseSubscript: function (c) { + if (this.string.charAt(++this.i) == "{") { + this.i++; this.sub += CE(this.Find("}")).Parse().replace(/^\{-\}/,"-"); + } else { + var n = this.Match(/^\d+/); + if (n) {this.sub += n} + } + }, + + // + // Look for raw TeX code to include + // + ParseMath: function (c) { + this.FinishAtom(); + this.i++; this.tex += this.Find(c); + }, + + // + // Look for specific macros for bonds + // and allow \} to have subscripts + // + ParseMacro: function (c) { + this.FinishAtom(); + this.i++; var match = this.Match(/^([a-z]+|.)/i)||" "; + if (match === "sbond") {this.tex += "{-}"} + else if (match === "dbond") {this.tex += "{=}"} + else if (match === "tbond") {this.tex += "{\\equiv}"} + else if (match === "bond") { + var bond = (this.Match(/^\{.*?\}/)||""); + bond = bond.substr(1,bond.length-2); + this.tex += "{"+(this.Bonds[bond]||"\\text{??}")+"}"; + } + else if (match === "{") {this.tex += "{\\{"} + else if (match === "}") {this.tex += "\\}}"; this.atom = true} + else {this.tex += c+match} + }, + + // + // Ignore spaces + // + ParseSpace: function (c) {this.FinishAtom(); this.i++}, + + // + // Pass anything else on verbatim + // + ParseOther: function (c) {this.FinishAtom(); this.tex += c; this.i++}, + + // + // Process an arrow (looking for brackets for above and below) + // + AddArrow: function (arrow) { + var c = this.Match(/^[CT]\[/); + if (c) {this.i--; c = c.charAt(0)} + var above = this.GetBracket(c), below = this.GetBracket(c); + arrow = this.Arrows[arrow]; + if (above || below) { + if (below) {arrow += "["+below+"]"} + arrow += "{"+above+"}"; + arrow = "\\mathrel{\\x"+arrow+"}"; + } else { + arrow = "\\long"+arrow+" "; + } + this.tex += arrow; + }, + + // + // Handle the super and subscripts for an atom + // + FinishAtom: function (force) { + if (this.sup || this.sub || this.presup || this.presub) { + if (!force && !this.atom) { + if (this.tex === "" && !this.sup && !this.sub) return; + if (!this.presup && !this.presub && + (this.tex === "" || this.tex === "{" || + (this.tex === "}" && this.TEX.substr(-1) === "{"))) { + this.presup = this.sup, this.presub = this.sub; // save for later + this.sub = this.sup = ""; + this.TEX += this.tex; this.tex = ""; + return; + } + } + if (this.sub && !this.sup) {this.sup = "\\Space{0pt}{0pt}{.2em}"} // forces subscripts to align properly + if ((this.presup || this.presub) && this.tex !== "{") { + if (!this.presup && !this.sup) {this.presup = "\\Space{0pt}{0pt}{.2em}"} + this.tex = "\\CEprescripts{"+(this.presub||"\\CEnone")+"}{"+(this.presup||"\\CEnone")+"}" + + "{"+(this.tex !== "}" ? this.tex : "")+"}" + + "{"+(this.sub||"\\CEnone")+"}{"+(this.sup||"\\CEnone")+"}" + + (this.tex === "}" ? "}" : ""); + this.presub = this.presup = ""; + } else { + if (this.sup) this.tex += "^{"+this.sup+"}"; + if (this.sub) this.tex += "_{"+this.sub+"}"; + } + this.sup = this.sub = ""; + } + this.TEX += this.tex; this.tex = ""; + this.atom = false; + }, + + // + // Find a bracket group and handle C and T prefixes + // + GetBracket: function (c) { + if (this.string.charAt(this.i) !== "[") {return ""} + this.i++; var bracket = this.Find("]"); + if (c === "C") {bracket = "\\ce{"+bracket+"}"} else + if (c === "T") { + if (!bracket.match(/^\{.*\}$/)) {bracket = "{"+bracket+"}"} + bracket = "\\text"+bracket; + }; + return bracket; + }, + + // + // Check if the string matches a regular expression + // and move past it if so, returning the match + // + Match: function (regex) { + var match = regex.exec(this.string.substr(this.i)); + if (match) {match = match[0]; this.i += match.length} + return match; + }, + + // + // Find a particular character, skipping over braced groups + // + Find: function (c) { + var m = this.string.length, i = this.i, braces = 0; + while (this.i < m) { + var C = this.string.charAt(this.i++); + if (C === c && braces === 0) {return this.string.substr(i,this.i-i-1)} + if (C === "{") {braces++} else + if (C === "}") { + if (braces) {braces--} + else { + TEX.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"]) + } + } + } + if (braces) {TEX.Error(["MissingCloseBrace","Missing close brace"])} + TEX.Error(["NoClosingChar","Can't find closing %1",c]); + } + + }); + + MathJax.Extension["TeX/mhchem"].CE = CE; + + /***************************************************************************/ + + TEX.Definitions.Add({ + macros: { + // + // Set up the macros for chemistry + // + ce: 'CE', + cf: 'CE', + cee: 'CE', + + // + // Make these load AMSmath package (redefined below when loaded) + // + xleftrightarrow: ['Extension','AMSmath'], + xrightleftharpoons: ['Extension','AMSmath'], + xRightleftharpoons: ['Extension','AMSmath'], + xLeftrightharpoons: ['Extension','AMSmath'], + + // FIXME: These don't work well in FF NativeMML mode + longrightleftharpoons: ["Macro","\\stackrel{\\textstyle{{-}\\!\\!{\\rightharpoonup}}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"], + longRightleftharpoons: ["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\small\\smash\\leftharpoondown}"], + longLeftrightharpoons: ["Macro","\\stackrel{\\rightharpoonup}{{{\\leftharpoondown}\\!\\!\\textstyle{-}}}"], + + // + // Add \hyphen used in some mhchem examples + // + hyphen: ["Macro","\\text{-}"], + + // + // Handle prescripts and none + // + CEprescripts: "CEprescripts", + CEnone: "CEnone", + + // + // Needed for \bond for the ~ forms + // + tripledash: ["Macro","\\raise3mu{\\tiny\\text{-}\\kern2mu\\text{-}\\kern2mu\\text{-}}"] + }, + + // + // Needed for \bond for the ~ forms + // + environment: { + CEstack: ['Array',null,null,null,'r',null,"0.001em",'T',1] + } + },null,true); + + if (!MathJax.Extension["TeX/AMSmath"]) { + TEX.Definitions.Add({ + macros: { + xrightarrow: ['Extension','AMSmath'], + xleftarrow: ['Extension','AMSmath'] + } + },null,true); + } + + // + // These arrows need to wait until AMSmath is loaded + // + MathJax.Hub.Register.StartupHook("TeX AMSmath Ready",function () { + TEX.Definitions.Add({ + macros: { + // + // Some of these are hacks for now + // + xleftrightarrow: ['xArrow',0x2194,6,6], + xrightleftharpoons: ['xArrow',0x21CC,5,7], // FIXME: doesn't stretch in HTML-CSS output + xRightleftharpoons: ['xArrow',0x21CC,5,7], // FIXME: how should this be handled? + xLeftrightharpoons: ['xArrow',0x21CC,5,7] + } + },null,true); + }); + + TEX.Parse.Augment({ + + // + // Implements \ce and friends + // + CE: function (name) { + var arg = this.GetArgument(name); + var tex = CE(arg).Parse(); + this.string = tex + this.string.substr(this.i); this.i = 0; + }, + + // + // Implements \CEprescripts{presub}{presup}{base}{sub}{sup} + // + CEprescripts: function (name) { + var presub = this.ParseArg(name), + presup = this.ParseArg(name), + base = this.ParseArg(name), + sub = this.ParseArg(name), + sup = this.ParseArg(name); + var MML = MathJax.ElementJax.mml; + this.Push(MML.mmultiscripts(base,sub,sup,MML.mprescripts(),presub,presup)); + }, + CEnone: function (name) { + this.Push(MathJax.ElementJax.mml.none()); + } + + }); + + // + // Indicate that the extension is ready + // + MathJax.Hub.Startup.signal.Post("TeX mhchem Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mhchem.js"); + +}} +// @license-end diff --git a/js/mathjax/extensions/TeX/mhchem3/mhchem.js b/js/mathjax/extensions/TeX/mhchem3/mhchem.js new file mode 100644 index 0000000..2caa810 --- /dev/null +++ b/js/mathjax/extensions/TeX/mhchem3/mhchem.js @@ -0,0 +1,1776 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/mhchem.js + * + * Implements the \ce command for handling chemical formulas + * from the mhchem LaTeX package. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2011-2015 The MathJax Consortium + * Copyright (c) 2015-2019 Martin Hensel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// Coding Style +// - use '' for identifiers that can by minified/uglified +// - use "" for strings that need to stay untouched + + +MathJax.Extension["TeX/mhchem"] = { + version: "3.3.2" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () { + + var TEX = MathJax.InputJax.TeX; + + // + // This is the main class for handing the \ce and related commands. + // Its main method is Parse() which takes the argument to \ce and + // returns the corresponding TeX string. + // + + var CE = MathJax.Object.Subclass({ + string: "", // the \ce string being parsed + + // + // Store the string when a CE object is created + // + Init: function (string) { this.string = string; }, + + // + // This converts the CE string to a TeX string. + // + Parse: function (stateMachine) { + try { + return texify.go(mhchemParser.go(this.string, stateMachine)); + } catch (ex) { + TEX.Error(ex); + } + } + }); + + // + // Core parser for mhchem syntax (recursive) + // + /** @type {MhchemParser} */ + var mhchemParser = { + // + // Parses mchem \ce syntax + // + // Call like + // go("H2O"); + // + go: function (input, stateMachine) { + if (!input) { return []; } + if (stateMachine === undefined) { stateMachine = 'ce'; } + var state = '0'; + + // + // String buffers for parsing: + // + // buffer.a == amount + // buffer.o == element + // buffer.b == left-side superscript + // buffer.p == left-side subscript + // buffer.q == right-side subscript + // buffer.d == right-side superscript + // + // buffer.r == arrow + // buffer.rdt == arrow, script above, type + // buffer.rd == arrow, script above, content + // buffer.rqt == arrow, script below, type + // buffer.rq == arrow, script below, content + // + // buffer.text_ + // buffer.rm + // etc. + // + // buffer.parenthesisLevel == int, starting at 0 + // buffer.sb == bool, space before + // buffer.beginsWithBond == bool + // + // These letters are also used as state names. + // + // Other states: + // 0 == begin of main part (arrow/operator unlikely) + // 1 == next entity + // 2 == next entity (arrow/operator unlikely) + // 3 == next atom + // c == macro + // + /** @type {Buffer} */ + var buffer = {}; + buffer['parenthesisLevel'] = 0; + + input = input.replace(/\n/g, " "); + input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-"); + input = input.replace(/[\u2026]/g, "..."); + + // + // Looks through mhchemParser.transitions, to execute a matching action + // (recursive) + // + var lastInput; + var watchdog = 10; + /** @type {ParserOutput[]} */ + var output = []; + while (true) { + if (lastInput !== input) { + watchdog = 10; + lastInput = input; + } else { + watchdog--; + } + // + // Find actions in transition table + // + var machine = mhchemParser.stateMachines[stateMachine]; + var t = machine.transitions[state] || machine.transitions['*']; + iterateTransitions: + for (var i=0; i 0) { + if (!task.revisit) { + input = matches.remainder; + } + if (!task.toContinue) { + break iterateTransitions; + } + } else { + return output; + } + } + } + // + // Prevent infinite loop + // + if (watchdog <= 0) { + throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character + } + } + }, + concatArray: function (a, b) { + if (b) { + if (Object.prototype.toString.call(b) === "[object Array]") { // Array.isArray(b) + for (var iB=0; iB': /^[=<>]/, + '#': /^[#\u2261]/, + '+': /^\+/, + '-$': /^-(?=[\s_},;\]/]|$|\([a-z]+\))/, // -space -, -; -] -/ -$ -state-of-aggregation + '-9': /^-(?=[0-9])/, + '- orbital overlap': /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/, + '-': /^-/, + 'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/, + 'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/, + 'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/, + '\\bond{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}"); }, + '->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/, + 'CMT': /^[CMT](?=\[)/, + '[(...)]': function (input) { return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]"); }, + '1st-level escape': /^(&|\\\\|\\hline)\s*/, + '\\,': /^(?:\\[,\ ;:])/, // \\x - but output no space before + '\\x{}{}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true); }, + '\\x{}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", ""); }, + '\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/, + '\\x': /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/, + 'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/, // only those with numbers in front, because the others will be formatted correctly anyway + 'others': /^[\/~|]/, + '\\frac{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}"); }, + '\\overset{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}"); }, + '\\underset{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}"); }, + '\\underbrace{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}"); }, + '\\color{(...)}0': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}"); }, + '\\color{(...)}{(...)}1': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}"); }, + '\\color(...){(...)}2': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}"); }, + '\\ce{(...)}': function (input) { return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}"); }, + 'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, + 'd-oxidation$': /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, // 0 could be oxidation or charge + 'roman numeral': /^[IVX]+/, + '1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/, + 'amount': function (input) { + var match; + // e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing + match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/); + if (match) { + return { match_: match[0], remainder: input.substr(match[0].length) }; + } + var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", ""); + if (a) { // e.g. $2n-1$, $-$ + match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/); + if (match) { + return { match_: match[0], remainder: input.substr(match[0].length) }; + } + } + return null; + }, + 'amount2': function (input) { return this['amount'](input); }, + '(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/, + 'formula$': function (input) { + if (input.match(/^\([a-z]+\)$/)) { return null; } // state of aggregation = no formula + var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/); + if (match) { + return { match_: match[0], remainder: input.substr(match[0].length) }; + } + return null; + }, + 'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/, + '/': /^\s*(\/)\s*/, + '//': /^\s*(\/\/)\s*/, + '*': /^\s*[*.]\s*/ + }, + findObserveGroups: function (input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) { + /** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */ + var _match = function (input, pattern) { + if (typeof pattern === "string") { + if (input.indexOf(pattern) !== 0) { return null; } + return pattern; + } else { + var match = input.match(pattern); + if (!match) { return null; } + return match[0]; + } + }; + /** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */ + var _findObserveGroups = function (input, i, endChars) { + var braces = 0; + while (i < input.length) { + var a = input.charAt(i); + var match = _match(input.substr(i), endChars); + if (match !== null && braces === 0) { + return { endMatchBegin: i, endMatchEnd: i + match.length }; + } else if (a === "{") { + braces++; + } else if (a === "}") { + if (braces === 0) { + throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"]; + } else { + braces--; + } + } + i++; + } + if (braces > 0) { + return null; + } + return null; + }; + var match = _match(input, begExcl); + if (match === null) { return null; } + input = input.substr(match.length); + match = _match(input, begIncl); + if (match === null) { return null; } + var e = _findObserveGroups(input, match.length, endIncl || endExcl); + if (e === null) { return null; } + var match1 = input.substring(0, (endIncl ? e.endMatchEnd : e.endMatchBegin)); + if (!(beg2Excl || beg2Incl)) { + return { + match_: match1, + remainder: input.substr(e.endMatchEnd) + }; + } else { + var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl); + if (group2 === null) { return null; } + /** @type {string[]} */ + var matchRet = [match1, group2.match_]; + return { + match_: (combine ? matchRet.join("") : matchRet), + remainder: group2.remainder + }; + } + }, + + // + // Matching function + // e.g. match("a", input) will look for the regexp called "a" and see if it matches + // returns null or {match_:"a", remainder:"bc"} + // + match_: function (m, input) { + var pattern = mhchemParser.patterns.patterns[m]; + if (pattern === undefined) { + throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern + } else if (typeof pattern === "function") { + return mhchemParser.patterns.patterns[m](input); // cannot use cached var pattern here, because some pattern functions need this===mhchemParser + } else { // RegExp + var match = input.match(pattern); + if (match) { + var mm; + if (match[2]) { + mm = [ match[1], match[2] ]; + } else if (match[1]) { + mm = match[1]; + } else { + mm = match[0]; + } + return { match_: mm, remainder: input.substr(match[0].length) }; + } + return null; + } + } + }, + + // + // Generic state machine actions + // + actions: { + 'a=': function (buffer, m) { buffer.a = (buffer.a || "") + m; }, + 'b=': function (buffer, m) { buffer.b = (buffer.b || "") + m; }, + 'p=': function (buffer, m) { buffer.p = (buffer.p || "") + m; }, + 'o=': function (buffer, m) { buffer.o = (buffer.o || "") + m; }, + 'q=': function (buffer, m) { buffer.q = (buffer.q || "") + m; }, + 'd=': function (buffer, m) { buffer.d = (buffer.d || "") + m; }, + 'rm=': function (buffer, m) { buffer.rm = (buffer.rm || "") + m; }, + 'text=': function (buffer, m) { buffer.text_ = (buffer.text_ || "") + m; }, + 'insert': function (buffer, m, a) { return { type_: a }; }, + 'insert+p1': function (buffer, m, a) { return { type_: a, p1: m }; }, + 'insert+p1+p2': function (buffer, m, a) { return { type_: a, p1: m[0], p2: m[1] }; }, + 'copy': function (buffer, m) { return m; }, + 'rm': function (buffer, m) { return { type_: 'rm', p1: m || ""}; }, + 'text': function (buffer, m) { return mhchemParser.go(m, 'text'); }, + '{text}': function (buffer, m) { + var ret = [ "{" ]; + mhchemParser.concatArray(ret, mhchemParser.go(m, 'text')); + ret.push("}"); + return ret; + }, + 'tex-math': function (buffer, m) { return mhchemParser.go(m, 'tex-math'); }, + 'tex-math tight': function (buffer, m) { return mhchemParser.go(m, 'tex-math tight'); }, + 'bond': function (buffer, m, k) { return { type_: 'bond', kind_: k || m }; }, + 'color0-output': function (buffer, m) { return { type_: 'color0', color: m[0] }; }, + 'ce': function (buffer, m) { return mhchemParser.go(m); }, + '1/2': function (buffer, m) { + /** @type {ParserOutput[]} */ + var ret = []; + if (m.match(/^[+\-]/)) { + ret.push(m.substr(0, 1)); + m = m.substr(1); + } + var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/); + n[1] = n[1].replace(/\$/g, ""); + ret.push({ type_: 'frac', p1: n[1], p2: n[2] }); + if (n[3]) { + n[3] = n[3].replace(/\$/g, ""); + ret.push({ type_: 'tex-math', p1: n[3] }); + } + return ret; + }, + '9,9': function (buffer, m) { return mhchemParser.go(m, '9,9'); } + }, + // + // createTransitions + // convert { 'letter': { 'state': { action_: 'output' } } } to { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] } + // with expansion of 'a|b' to 'a' and 'b' (at 2 places) + // + createTransitions: function (o) { + var pattern, state; + /** @type {string[]} */ + var stateArray; + var i; + // + // 1. Collect all states + // + /** @type {Transitions} */ + var transitions = {}; + for (pattern in o) { + for (state in o[pattern]) { + stateArray = state.split("|"); + o[pattern][state].stateArray = stateArray; + for (i=0; i': { + '0|1|2|3': { action_: 'r=', nextState: 'r' }, + 'a|as': { action_: [ 'output', 'r=' ], nextState: 'r' }, + '*': { action_: [ 'output', 'r=' ], nextState: 'r' } }, + '+': { + 'o': { action_: 'd= kv', nextState: 'd' }, + 'd|D': { action_: 'd=', nextState: 'd' }, + 'q': { action_: 'd=', nextState: 'qd' }, + 'qd|qD': { action_: 'd=', nextState: 'qd' }, + 'dq': { action_: [ 'output', 'd=' ], nextState: 'd' }, + '3': { action_: [ 'sb=false', 'output', 'operator' ], nextState: '0' } }, + 'amount': { + '0|2': { action_: 'a=', nextState: 'a' } }, + 'pm-operator': { + '0|1|2|a|as': { action_: [ 'sb=false', 'output', { type_: 'operator', option: '\\pm' } ], nextState: '0' } }, + 'operator': { + '0|1|2|a|as': { action_: [ 'sb=false', 'output', 'operator' ], nextState: '0' } }, + '-$': { + 'o|q': { action_: [ 'charge or bond', 'output' ], nextState: 'qd' }, + 'd': { action_: 'd=', nextState: 'd' }, + 'D': { action_: [ 'output', { type_: 'bond', option: "-" } ], nextState: '3' }, + 'q': { action_: 'd=', nextState: 'qd' }, + 'qd': { action_: 'd=', nextState: 'qd' }, + 'qD|dq': { action_: [ 'output', { type_: 'bond', option: "-" } ], nextState: '3' } }, + '-9': { + '3|o': { action_: [ 'output', { type_: 'insert', option: 'hyphen' } ], nextState: '3' } }, + '- orbital overlap': { + 'o': { action_: [ 'output', { type_: 'insert', option: 'hyphen' } ], nextState: '2' }, + 'd': { action_: [ 'output', { type_: 'insert', option: 'hyphen' } ], nextState: '2' } }, + '-': { + '0|1|2': { action_: [ { type_: 'output', option: 1 }, 'beginsWithBond=true', { type_: 'bond', option: "-" } ], nextState: '3' }, + '3': { action_: { type_: 'bond', option: "-" } }, + 'a': { action_: [ 'output', { type_: 'insert', option: 'hyphen' } ], nextState: '2' }, + 'as': { action_: [ { type_: 'output', option: 2 }, { type_: 'bond', option: "-" } ], nextState: '3' }, + 'b': { action_: 'b=' }, + 'o': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, + 'q': { action_: { type_: '- after o/d', option: false }, nextState: '2' }, + 'd|qd|dq': { action_: { type_: '- after o/d', option: true }, nextState: '2' }, + 'D|qD|p': { action_: [ 'output', { type_: 'bond', option: "-" } ], nextState: '3' } }, + 'amount2': { + '1|3': { action_: 'a=', nextState: 'a' } }, + 'letters': { + '0|1|2|3|a|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, + 'q|dq': { action_: ['output', 'o='], nextState: 'o' }, + 'd|D|qd|qD': { action_: 'o after d', nextState: 'o' } }, + 'digits': { + 'o': { action_: 'q=', nextState: 'q' }, + 'd|D': { action_: 'q=', nextState: 'dq' }, + 'q': { action_: [ 'output', 'o=' ], nextState: 'o' }, + 'a': { action_: 'o=', nextState: 'o' } }, + 'space A': { + 'b|p|bp': {} }, + 'space': { + 'a': { nextState: 'as' }, + '0': { action_: 'sb=false' }, + '1|2': { action_: 'sb=true' }, + 'r|rt|rd|rdt|rdq': { action_: 'output', nextState: '0' }, + '*': { action_: [ 'output', 'sb=true' ], nextState: '1'} }, + '1st-level escape': { + '1|2': { action_: [ 'output', { type_: 'insert+p1', option: '1st-level escape' } ] }, + '*': { action_: [ 'output', { type_: 'insert+p1', option: '1st-level escape' } ], nextState: '0' } }, + '[(...)]': { + 'r|rt': { action_: 'rd=', nextState: 'rd' }, + 'rd|rdt': { action_: 'rq=', nextState: 'rdq' } }, + '...': { + 'o|d|D|dq|qd|qD': { action_: [ 'output', { type_: 'bond', option: "..." } ], nextState: '3' }, + '*': { action_: [ { type_: 'output', option: 1 }, { type_: 'insert', option: 'ellipsis' } ], nextState: '1' } }, + '. |* ': { + '*': { action_: [ 'output', { type_: 'insert', option: 'addition compound' } ], nextState: '1' } }, + 'state of aggregation $': { + '*': { action_: [ 'output', 'state of aggregation' ], nextState: '1' } }, + '{[(': { + 'a|as|o': { action_: [ 'o=', 'output', 'parenthesisLevel++' ], nextState: '2' }, + '0|1|2|3': { action_: [ 'o=', 'output', 'parenthesisLevel++' ], nextState: '2' }, + '*': { action_: [ 'output', 'o=', 'output', 'parenthesisLevel++' ], nextState: '2' } }, + ')]}': { + '0|1|2|3|b|p|bp|o': { action_: [ 'o=', 'parenthesisLevel--' ], nextState: 'o' }, + 'a|as|d|D|q|qd|qD|dq': { action_: [ 'output', 'o=', 'parenthesisLevel--' ], nextState: 'o' } }, + ', ': { + '*': { action_: [ 'output', 'comma' ], nextState: '0' } }, + '^_': { // ^ and _ without a sensible argument + '*': { } }, + '^{(...)}|^($...$)': { + '0|1|2|as': { action_: 'b=', nextState: 'b' }, + 'p': { action_: 'b=', nextState: 'bp' }, + '3|o': { action_: 'd= kv', nextState: 'D' }, + 'q': { action_: 'd=', nextState: 'qD' }, + 'd|D|qd|qD|dq': { action_: [ 'output', 'd=' ], nextState: 'D' } }, + '^a|^\\x{}{}|^\\x{}|^\\x|\'': { + '0|1|2|as': { action_: 'b=', nextState: 'b' }, + 'p': { action_: 'b=', nextState: 'bp' }, + '3|o': { action_: 'd= kv', nextState: 'd' }, + 'q': { action_: 'd=', nextState: 'qd' }, + 'd|qd|D|qD': { action_: 'd=' }, + 'dq': { action_: [ 'output', 'd=' ], nextState: 'd' } }, + '_{(state of aggregation)}$': { + 'd|D|q|qd|qD|dq': { action_: [ 'output', 'q=' ], nextState: 'q' } }, + '_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x': { + '0|1|2|as': { action_: 'p=', nextState: 'p' }, + 'b': { action_: 'p=', nextState: 'bp' }, + '3|o': { action_: 'q=', nextState: 'q' }, + 'd|D': { action_: 'q=', nextState: 'dq' }, + 'q|qd|qD|dq': { action_: [ 'output', 'q=' ], nextState: 'q' } }, + '=<>': { + '0|1|2|3|a|as|o|q|d|D|qd|qD|dq': { action_: [ { type_: 'output', option: 2 }, 'bond' ], nextState: '3' } }, + '#': { + '0|1|2|3|a|as|o': { action_: [ { type_: 'output', option: 2 }, { type_: 'bond', option: "#" } ], nextState: '3' } }, + '{}': { + '*': { action_: { type_: 'output', option: 1 }, nextState: '1' } }, + '{...}': { + '0|1|2|3|a|as|b|p|bp': { action_: 'o=', nextState: 'o' }, + 'o|d|D|q|qd|qD|dq': { action_: [ 'output', 'o=' ], nextState: 'o' } }, + '$...$': { + 'a': { action_: 'a=' }, // 2$n$ + '0|1|2|3|as|b|p|bp|o': { action_: 'o=', nextState: 'o' }, // not 'amount' + 'as|o': { action_: 'o=' }, + 'q|d|D|qd|qD|dq': { action_: [ 'output', 'o=' ], nextState: 'o' } }, + '\\bond{(...)}': { + '*': { action_: [ { type_: 'output', option: 2 }, 'bond' ], nextState: "3" } }, + '\\frac{(...)}': { + '*': { action_: [ { type_: 'output', option: 1 }, 'frac-output' ], nextState: '3' } }, + '\\overset{(...)}': { + '*': { action_: [ { type_: 'output', option: 2 }, 'overset-output' ], nextState: '3' } }, + '\\underset{(...)}': { + '*': { action_: [ { type_: 'output', option: 2 }, 'underset-output' ], nextState: '3' } }, + '\\underbrace{(...)}': { + '*': { action_: [ { type_: 'output', option: 2 }, 'underbrace-output' ], nextState: '3' } }, + '\\color{(...)}{(...)}1|\\color(...){(...)}2': { + '*': { action_: [ { type_: 'output', option: 2 }, 'color-output' ], nextState: '3' } }, + '\\color{(...)}0': { + '*': { action_: [ { type_: 'output', option: 2 }, 'color0-output' ] } }, + '\\ce{(...)}': { + '*': { action_: [ { type_: 'output', option: 2 }, 'ce' ], nextState: '3' } }, + '\\,': { + '*': { action_: [ { type_: 'output', option: 1 }, 'copy' ], nextState: '1' } }, + '\\x{}{}|\\x{}|\\x': { + '0|1|2|3|a|as|b|p|bp|o|c0': { action_: [ 'o=', 'output' ], nextState: '3' }, + '*': { action_: ['output', 'o=', 'output' ], nextState: '3' } }, + 'others': { + '*': { action_: [ { type_: 'output', option: 1 }, 'copy' ], nextState: '3' } }, + 'else2': { + 'a': { action_: 'a to o', nextState: 'o', revisit: true }, + 'as': { action_: [ 'output', 'sb=true' ], nextState: '1', revisit: true }, + 'r|rt|rd|rdt|rdq': { action_: [ 'output' ], nextState: '0', revisit: true }, + '*': { action_: [ 'output', 'copy' ], nextState: '3' } } + }), + actions: { + 'o after d': function (buffer, m) { + var ret; + if ((buffer.d || "").match(/^[0-9]+$/)) { + var tmp = buffer.d; + buffer.d = undefined; + ret = this['output'](buffer); + buffer.b = tmp; + } else { + ret = this['output'](buffer); + } + mhchemParser.actions['o='](buffer, m); + return ret; + }, + 'd= kv': function (buffer, m) { + buffer.d = m; + buffer.dType = 'kv'; + }, + 'charge or bond': function (buffer, m) { + if (buffer['beginsWithBond']) { + /** @type {ParserOutput[]} */ + var ret = []; + mhchemParser.concatArray(ret, this['output'](buffer)); + mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); + return ret; + } else { + buffer.d = m; + } + }, + '- after o/d': function (buffer, m, isAfterD) { + var c1 = mhchemParser.patterns.match_('orbital', buffer.o || ""); + var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || ""); + var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || ""); + var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || ""); + var hyphenFollows = m==="-" && ( c1 && c1.remainder==="" || c2 || c3 || c4 ); + if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) { + buffer.o = '$' + buffer.o + '$'; + } + /** @type {ParserOutput[]} */ + var ret = []; + if (hyphenFollows) { + mhchemParser.concatArray(ret, this['output'](buffer)); + ret.push({ type_: 'hyphen' }); + } else { + c1 = mhchemParser.patterns.match_('digits', buffer.d || ""); + if (isAfterD && c1 && c1.remainder==='') { + mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m)); + mhchemParser.concatArray(ret, this['output'](buffer)); + } else { + mhchemParser.concatArray(ret, this['output'](buffer)); + mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-")); + } + } + return ret; + }, + 'a to o': function (buffer) { + buffer.o = buffer.a; + buffer.a = undefined; + }, + 'sb=true': function (buffer) { buffer.sb = true; }, + 'sb=false': function (buffer) { buffer.sb = false; }, + 'beginsWithBond=true': function (buffer) { buffer['beginsWithBond'] = true; }, + 'beginsWithBond=false': function (buffer) { buffer['beginsWithBond'] = false; }, + 'parenthesisLevel++': function (buffer) { buffer['parenthesisLevel']++; }, + 'parenthesisLevel--': function (buffer) { buffer['parenthesisLevel']--; }, + 'state of aggregation': function (buffer, m) { + return { type_: 'state of aggregation', p1: mhchemParser.go(m, 'o') }; + }, + 'comma': function (buffer, m) { + var a = m.replace(/\s*$/, ''); + var withSpace = (a !== m); + if (withSpace && buffer['parenthesisLevel'] === 0) { + return { type_: 'comma enumeration L', p1: a }; + } else { + return { type_: 'comma enumeration M', p1: a }; + } + }, + 'output': function (buffer, m, entityFollows) { + // entityFollows: + // undefined = if we have nothing else to output, also ignore the just read space (buffer.sb) + // 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1) + // 2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as) + /** @type {ParserOutput | ParserOutput[]} */ + var ret; + if (!buffer.r) { + ret = []; + if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) { + //ret = []; + } else { + if (buffer.sb) { + ret.push({ type_: 'entitySkip' }); + } + if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows!==2) { + buffer.o = buffer.a; + buffer.a = undefined; + } else if (!buffer.o && !buffer.q && !buffer.d && (buffer.b || buffer.p)) { + buffer.o = buffer.a; + buffer.d = buffer.b; + buffer.q = buffer.p; + buffer.a = buffer.b = buffer.p = undefined; + } else { + if (buffer.o && buffer.dType==='kv' && mhchemParser.patterns.match_('d-oxidation$', buffer.d || "")) { + buffer.dType = 'oxidation'; + } else if (buffer.o && buffer.dType==='kv' && !buffer.q) { + buffer.dType = undefined; + } + } + ret.push({ + type_: 'chemfive', + a: mhchemParser.go(buffer.a, 'a'), + b: mhchemParser.go(buffer.b, 'bd'), + p: mhchemParser.go(buffer.p, 'pq'), + o: mhchemParser.go(buffer.o, 'o'), + q: mhchemParser.go(buffer.q, 'pq'), + d: mhchemParser.go(buffer.d, (buffer.dType === 'oxidation' ? 'oxidation' : 'bd')), + dType: buffer.dType + }); + } + } else { // r + /** @type {ParserOutput[]} */ + var rd; + if (buffer.rdt === 'M') { + rd = mhchemParser.go(buffer.rd, 'tex-math'); + } else if (buffer.rdt === 'T') { + rd = [ { type_: 'text', p1: buffer.rd || "" } ]; + } else { + rd = mhchemParser.go(buffer.rd); + } + /** @type {ParserOutput[]} */ + var rq; + if (buffer.rqt === 'M') { + rq = mhchemParser.go(buffer.rq, 'tex-math'); + } else if (buffer.rqt === 'T') { + rq = [ { type_: 'text', p1: buffer.rq || ""} ]; + } else { + rq = mhchemParser.go(buffer.rq); + } + ret = { + type_: 'arrow', + r: buffer.r, + rd: rd, + rq: rq + }; + } + for (var p in buffer) { + if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') { + delete buffer[p]; + } + } + return ret; + }, + 'oxidation-output': function (buffer, m) { + var ret = [ "{" ]; + mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation')); + ret.push("}"); + return ret; + }, + 'frac-output': function (buffer, m) { + return { type_: 'frac-ce', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; + }, + 'overset-output': function (buffer, m) { + return { type_: 'overset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; + }, + 'underset-output': function (buffer, m) { + return { type_: 'underset', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; + }, + 'underbrace-output': function (buffer, m) { + return { type_: 'underbrace', p1: mhchemParser.go(m[0]), p2: mhchemParser.go(m[1]) }; + }, + 'color-output': function (buffer, m) { + return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1]) }; + }, + 'r=': function (buffer, m) { buffer.r = m; }, + 'rdt=': function (buffer, m) { buffer.rdt = m; }, + 'rd=': function (buffer, m) { buffer.rd = m; }, + 'rqt=': function (buffer, m) { buffer.rqt = m; }, + 'rq=': function (buffer, m) { buffer.rq = m; }, + 'operator': function (buffer, m, p1) { return { type_: 'operator', kind_: (p1 || m) }; } + } + }, + 'a': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + '1/2$': { + '0': { action_: '1/2' } }, + 'else': { + '0': { nextState: '1', revisit: true } }, + '$(...)$': { + '*': { action_: 'tex-math tight', nextState: '1' } }, + ',': { + '*': { action_: { type_: 'insert', option: 'commaDecimal' } } }, + 'else2': { + '*': { action_: 'copy' } } + }), + actions: {} + }, + 'o': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + '1/2$': { + '0': { action_: '1/2' } }, + 'else': { + '0': { nextState: '1', revisit: true } }, + 'letters': { + '*': { action_: 'rm' } }, + '\\ca': { + '*': { action_: { type_: 'insert', option: 'circa' } } }, + '\\x{}{}|\\x{}|\\x': { + '*': { action_: 'copy' } }, + '${(...)}$|$(...)$': { + '*': { action_: 'tex-math' } }, + '{(...)}': { + '*': { action_: '{text}' } }, + 'else2': { + '*': { action_: 'copy' } } + }), + actions: {} + }, + 'text': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': { action_: 'output' } }, + '{...}': { + '*': { action_: 'text=' } }, + '${(...)}$|$(...)$': { + '*': { action_: 'tex-math' } }, + '\\greek': { + '*': { action_: [ 'output', 'rm' ] } }, + '\\,|\\x{}{}|\\x{}|\\x': { + '*': { action_: [ 'output', 'copy' ] } }, + 'else': { + '*': { action_: 'text=' } } + }), + actions: { + 'output': function (buffer) { + if (buffer.text_) { + /** @type {ParserOutput} */ + var ret = { type_: 'text', p1: buffer.text_ }; + for (var p in buffer) { delete buffer[p]; } + return ret; + } + } + } + }, + 'pq': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + 'state of aggregation $': { + '*': { action_: 'state of aggregation' } }, + 'i$': { + '0': { nextState: '!f', revisit: true } }, + '(KV letters),': { + '0': { action_: 'rm', nextState: '0' } }, + 'formula$': { + '0': { nextState: 'f', revisit: true } }, + '1/2$': { + '0': { action_: '1/2' } }, + 'else': { + '0': { nextState: '!f', revisit: true } }, + '${(...)}$|$(...)$': { + '*': { action_: 'tex-math' } }, + '{(...)}': { + '*': { action_: 'text' } }, + 'a-z': { + 'f': { action_: 'tex-math' } }, + 'letters': { + '*': { action_: 'rm' } }, + '-9.,9': { + '*': { action_: '9,9' } }, + ',': { + '*': { action_: { type_: 'insert+p1', option: 'comma enumeration S' } } }, + '\\color{(...)}{(...)}1|\\color(...){(...)}2': { + '*': { action_: 'color-output' } }, + '\\color{(...)}0': { + '*': { action_: 'color0-output' } }, + '\\ce{(...)}': { + '*': { action_: 'ce' } }, + '\\,|\\x{}{}|\\x{}|\\x': { + '*': { action_: 'copy' } }, + 'else2': { + '*': { action_: 'copy' } } + }), + actions: { + 'state of aggregation': function (buffer, m) { + return { type_: 'state of aggregation subscript', p1: mhchemParser.go(m, 'o') }; + }, + 'color-output': function (buffer, m) { + return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'pq') }; + } + } + }, + 'bd': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + 'x$': { + '0': { nextState: '!f', revisit: true } }, + 'formula$': { + '0': { nextState: 'f', revisit: true } }, + 'else': { + '0': { nextState: '!f', revisit: true } }, + '-9.,9 no missing 0': { + '*': { action_: '9,9' } }, + '.': { + '*': { action_: { type_: 'insert', option: 'electron dot' } } }, + 'a-z': { + 'f': { action_: 'tex-math' } }, + 'x': { + '*': { action_: { type_: 'insert', option: 'KV x' } } }, + 'letters': { + '*': { action_: 'rm' } }, + '\'': { + '*': { action_: { type_: 'insert', option: 'prime' } } }, + '${(...)}$|$(...)$': { + '*': { action_: 'tex-math' } }, + '{(...)}': { + '*': { action_: 'text' } }, + '\\color{(...)}{(...)}1|\\color(...){(...)}2': { + '*': { action_: 'color-output' } }, + '\\color{(...)}0': { + '*': { action_: 'color0-output' } }, + '\\ce{(...)}': { + '*': { action_: 'ce' } }, + '\\,|\\x{}{}|\\x{}|\\x': { + '*': { action_: 'copy' } }, + 'else2': { + '*': { action_: 'copy' } } + }), + actions: { + 'color-output': function (buffer, m) { + return { type_: 'color', color1: m[0], color2: mhchemParser.go(m[1], 'bd') }; + } + } + }, + 'oxidation': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + 'roman numeral': { + '*': { action_: 'roman-numeral' } }, + '${(...)}$|$(...)$': { + '*': { action_: 'tex-math' } }, + 'else': { + '*': { action_: 'copy' } } + }), + actions: { + 'roman-numeral': function (buffer, m) { return { type_: 'roman numeral', p1: m || "" }; } + } + }, + 'tex-math': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': { action_: 'output' } }, + '\\ce{(...)}': { + '*': { action_: [ 'output', 'ce' ] } }, + '{...}|\\,|\\x{}{}|\\x{}|\\x': { + '*': { action_: 'o=' } }, + 'else': { + '*': { action_: 'o=' } } + }), + actions: { + 'output': function (buffer) { + if (buffer.o) { + /** @type {ParserOutput} */ + var ret = { type_: 'tex-math', p1: buffer.o }; + for (var p in buffer) { delete buffer[p]; } + return ret; + } + } + } + }, + 'tex-math tight': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': { action_: 'output' } }, + '\\ce{(...)}': { + '*': { action_: [ 'output', 'ce' ] } }, + '{...}|\\,|\\x{}{}|\\x{}|\\x': { + '*': { action_: 'o=' } }, + '-|+': { + '*': { action_: 'tight operator' } }, + 'else': { + '*': { action_: 'o=' } } + }), + actions: { + 'tight operator': function (buffer, m) { buffer.o = (buffer.o || "") + "{"+m+"}"; }, + 'output': function (buffer) { + if (buffer.o) { + /** @type {ParserOutput} */ + var ret = { type_: 'tex-math', p1: buffer.o }; + for (var p in buffer) { delete buffer[p]; } + return ret; + } + } + } + }, + '9,9': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': {} }, + ',': { + '*': { action_: 'comma' } }, + 'else': { + '*': { action_: 'copy' } } + }), + actions: { + 'comma': function () { return { type_: 'commaDecimal' }; } + } + }, + //#endregion + // + // \pu state machines + // + //#region pu + 'pu': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': { action_: 'output' } }, + 'space$': { + '*': { action_: [ 'output', 'space' ] } }, + '{[(|)]}': { + '0|a': { action_: 'copy' } }, + '(-)(9)^(-9)': { + '0': { action_: 'number^', nextState: 'a' } }, + '(-)(9.,9)(e)(99)': { + '0': { action_: 'enumber', nextState: 'a' } }, + 'space': { + '0|a': {} }, + 'pm-operator': { + '0|a': { action_: { type_: 'operator', option: '\\pm' }, nextState: '0' } }, + 'operator': { + '0|a': { action_: 'copy', nextState: '0' } }, + '//': { + 'd': { action_: 'o=', nextState: '/' } }, + '/': { + 'd': { action_: 'o=', nextState: '/' } }, + '{...}|else': { + '0|d': { action_: 'd=', nextState: 'd' }, + 'a': { action_: [ 'space', 'd=' ], nextState: 'd' }, + '/|q': { action_: 'q=', nextState: 'q' } } + }), + actions: { + 'enumber': function (buffer, m) { + /** @type {ParserOutput[]} */ + var ret = []; + if (m[0] === "+-" || m[0] === "+/-") { + ret.push("\\pm "); + } else if (m[0]) { + ret.push(m[0]); + } + if (m[1]) { // 1.2 + mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); + if (m[2]) { + if (m[2].match(/[,.]/)) { // 1.23456(0.01111) + mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9')); + } else { // 1.23456(1111) - without spacings + ret.push(m[2]); + } + } + if (m[3] || m[4]) { // 1.2e7 1.2x10^7 + if (m[3] === "e" || m[4] === "*") { + ret.push({ type_: 'cdot' }); + } else { + ret.push({ type_: 'times' }); + } + } + } + if (m[5]) { // 10^7 + ret.push("10^{"+m[5]+"}"); + } + return ret; + }, + 'number^': function (buffer, m) { + /** @type {ParserOutput[]} */ + var ret = []; + if (m[0] === "+-" || m[0] === "+/-") { + ret.push("\\pm "); + } else if (m[0]) { + ret.push(m[0]); + } + mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9')); + ret.push("^{"+m[2]+"}"); + return ret; + }, + 'operator': function (buffer, m, p1) { return { type_: 'operator', kind_: (p1 || m) }; }, + 'space': function () { return { type_: 'pu-space-1' }; }, + 'output': function (buffer) { + /** @type {ParserOutput | ParserOutput[]} */ + var ret; + var md = mhchemParser.patterns.match_('{(...)}', buffer.d || ""); + if (md && md.remainder === '') { buffer.d = md.match_; } + var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || ""); + if (mq && mq.remainder === '') { buffer.q = mq.match_; } + if (buffer.d) { + buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); + buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); + } + if (buffer.q) { // fraction + buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"); + buffer.q = buffer.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"); + var b5 = { + d: mhchemParser.go(buffer.d, 'pu'), + q: mhchemParser.go(buffer.q, 'pu') + }; + if (buffer.o === '//') { + ret = { type_: 'pu-frac', p1: b5.d, p2: b5.q }; + } else { + ret = b5.d; + if (b5.d.length > 1 || b5.q.length > 1) { + ret.push({ type_: ' / ' }); + } else { + ret.push({ type_: '/' }); + } + mhchemParser.concatArray(ret, b5.q); + } + } else { // no fraction + ret = mhchemParser.go(buffer.d, 'pu-2'); + } + for (var p in buffer) { delete buffer[p]; } + return ret; + } + } + }, + 'pu-2': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '*': { action_: 'output' } }, + '*': { + '*': { action_: [ 'output', 'cdot' ], nextState: '0' } }, + '\\x': { + '*': { action_: 'rm=' } }, + 'space': { + '*': { action_: [ 'output', 'space' ], nextState: '0' } }, + '^{(...)}|^(-1)': { + '1': { action_: '^(-1)' } }, + '-9.,9': { + '0': { action_: 'rm=', nextState: '0' }, + '1': { action_: '^(-1)', nextState: '0' } }, + '{...}|else': { + '*': { action_: 'rm=', nextState: '1' } } + }), + actions: { + 'cdot': function () { return { type_: 'tight cdot' }; }, + '^(-1)': function (buffer, m) { buffer.rm += "^{"+m+"}"; }, + 'space': function () { return { type_: 'pu-space-2' }; }, + 'output': function (buffer) { + /** @type {ParserOutput | ParserOutput[]} */ + var ret = []; + if (buffer.rm) { + var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || ""); + if (mrm && mrm.remainder === '') { + ret = mhchemParser.go(mrm.match_, 'pu'); + } else { + ret = { type_: 'rm', p1: buffer.rm }; + } + } + for (var p in buffer) { delete buffer[p]; } + return ret; + } + } + }, + 'pu-9,9': { + transitions: mhchemParser.createTransitions({ + 'empty': { + '0': { action_: 'output-0' }, + 'o': { action_: 'output-o' } }, + ',': { + '0': { action_: [ 'output-0', 'comma' ], nextState: 'o' } }, + '.': { + '0': { action_: [ 'output-0', 'copy' ], nextState: 'o' } }, + 'else': { + '*': { action_: 'text=' } } + }), + actions: { + 'comma': function () { return { type_: 'commaDecimal' }; }, + 'output-0': function (buffer) { + /** @type {ParserOutput[]} */ + var ret = []; + buffer.text_ = buffer.text_ || ""; + if (buffer.text_.length > 4) { + var a = buffer.text_.length % 3; + if (a === 0) { a = 3; } + for (var i=buffer.text_.length-3; i>0; i-=3) { + ret.push(buffer.text_.substr(i, 3)); + ret.push({ type_: '1000 separator' }); + } + ret.push(buffer.text_.substr(0, a)); + ret.reverse(); + } else { + ret.push(buffer.text_); + } + for (var p in buffer) { delete buffer[p]; } + return ret; + }, + 'output-o': function (buffer) { + /** @type {ParserOutput[]} */ + var ret = []; + buffer.text_ = buffer.text_ || ""; + if (buffer.text_.length > 4) { + var a = buffer.text_.length - 3; + for (var i=0; i" || buf.r === "<=>>" || buf.r === "<<=>" || buf.r === "<-->") { + // arrows that cannot stretch correctly yet, https://github.com/mathjax/MathJax/issues/1491 + arrow = "\\long"+arrow; + if (b6.rd) { arrow = "\\overset{"+b6.rd+"}{"+arrow+"}"; } + if (b6.rq) { + if (buf.r === "<-->") { + arrow = "\\underset{\\lower2mu{"+b6.rq+"}}{"+arrow+"}"; + } else { + arrow = "\\underset{\\lower6mu{"+b6.rq+"}}{"+arrow+"}"; // align with ->[][under] + } + } + arrow = " {}\\mathrel{"+arrow+"}{} "; + } else { + if (b6.rq) { arrow += "[{"+b6.rq+"}]"; } + arrow += "{"+b6.rd+"}"; + arrow = " {}\\mathrel{\\x"+arrow+"}{} "; + } + } else { + arrow = " {}\\mathrel{\\long"+arrow+"}{} "; + } + res = arrow; + break; + case 'operator': + res = texify._getOperator(buf.kind_); + break; + case '1st-level escape': + res = buf.p1+" "; // &, \\\\, \\hlin + break; + case 'space': + res = " "; + break; + case 'entitySkip': + res = "~"; + break; + case 'pu-space-1': + res = "~"; + break; + case 'pu-space-2': + res = "\\mkern3mu "; + break; + case '1000 separator': + res = "\\mkern2mu "; + break; + case 'commaDecimal': + res = "{,}"; + break; + case 'comma enumeration L': + res = "{"+buf.p1+"}\\mkern6mu "; + break; + case 'comma enumeration M': + res = "{"+buf.p1+"}\\mkern3mu "; + break; + case 'comma enumeration S': + res = "{"+buf.p1+"}\\mkern1mu "; + break; + case 'hyphen': + res = "\\text{-}"; + break; + case 'addition compound': + res = "\\,{\\cdot}\\,"; + break; + case 'electron dot': + res = "\\mkern1mu \\bullet\\mkern1mu "; + break; + case 'KV x': + res = "{\\times}"; + break; + case 'prime': + res = "\\prime "; + break; + case 'cdot': + res = "\\cdot "; + break; + case 'tight cdot': + res = "\\mkern1mu{\\cdot}\\mkern1mu "; + break; + case 'times': + res = "\\times "; + break; + case 'circa': + res = "{\\sim}"; + break; + case '^': + res = "uparrow"; + break; + case 'v': + res = "downarrow"; + break; + case 'ellipsis': + res = "\\ldots "; + break; + case '/': + res = "/"; + break; + case ' / ': + res = "\\,/\\,"; + break; + default: + assertNever(buf); + throw ["MhchemBugT", "mhchem bug T. Please report."]; // Missing texify rule or unknown MhchemParser output + } + assertString(res); + return res; + }, + _getArrow: function (a) { + switch (a) { + case "->": return "rightarrow"; + case "\u2192": return "rightarrow"; + case "\u27F6": return "rightarrow"; + case "<-": return "leftarrow"; + case "<->": return "leftrightarrow"; + case "<-->": return "leftrightarrows"; + case "<=>": return "rightleftharpoons"; + case "\u21CC": return "rightleftharpoons"; + case "<=>>": return "Rightleftharpoons"; + case "<<=>": return "Leftrightharpoons"; + default: + assertNever(a); + throw ["MhchemBugT", "mhchem bug T. Please report."]; + } + }, + _getBond: function (a) { + switch (a) { + case "-": return "{-}"; + case "1": return "{-}"; + case "=": return "{=}"; + case "2": return "{=}"; + case "#": return "{\\equiv}"; + case "3": return "{\\equiv}"; + case "~": return "{\\tripledash}"; + case "~-": return "{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}"; + case "~=": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}"; + case "~--": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}"; + case "-~-": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}"; + case "...": return "{{\\cdot}{\\cdot}{\\cdot}}"; + case "....": return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}"; + case "->": return "{\\rightarrow}"; + case "<-": return "{\\leftarrow}"; + case "<": return "{<}"; + case ">": return "{>}"; + default: + assertNever(a); + throw ["MhchemBugT", "mhchem bug T. Please report."]; + } + }, + _getOperator: function (a) { + switch (a) { + case "+": return " {}+{} "; + case "-": return " {}-{} "; + case "=": return " {}={} "; + case "<": return " {}<{} "; + case ">": return " {}>{} "; + case "<<": return " {}\\ll{} "; + case ">>": return " {}\\gg{} "; + case "\\pm": return " {}\\pm{} "; + case "\\approx": return " {}\\approx{} "; + case "$\\approx$": return " {}\\approx{} "; + case "v": return " \\downarrow{} "; + case "(v)": return " \\downarrow{} "; + case "^": return " \\uparrow{} "; + case "(^)": return " \\uparrow{} "; + default: + assertNever(a); + throw ["MhchemBugT", "mhchem bug T. Please report."]; + } + } + }; + + // + // Helpers for code anaylsis + // Will show type error at calling position + // + /** @param {number} a */ + function assertNever(a) {} + /** @param {string} a */ + function assertString(a) {} + + // + // MathJax definitions + // + MathJax.Extension["TeX/mhchem"].CE = CE; + + /***************************************************************************/ + + TEX.Definitions.Add({ + macros: { + // + // Set up the macros for chemistry + // + ce: "CE", + pu: "PU", + + // + // Make these load AMSmath package (redefined below when loaded) + // + xleftrightarrow: ["Extension", "AMSmath"], + xrightleftharpoons: ["Extension", "AMSmath"], + xRightleftharpoons: ["Extension", "AMSmath"], + xLeftrightharpoons: ["Extension", "AMSmath"], + + // FIXME: These don't work well in FF NativeMML mode + longrightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"], + longRightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"], + longLeftrightharpoons: ["Macro", "\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"], + longleftrightarrows: ["Macro", "\\raise-3mu{\\stackrel{\\longrightarrow}{\\raise2mu{\\smash{\\longleftarrow}}}}"], + + // + // Needed for \bond for the ~ forms + // Not perfectly aligned when zoomed in, but on 100% + // + tripledash: ["Macro", "\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"] + } + }, null, true); + + if (!MathJax.Extension["TeX/AMSmath"]) { + TEX.Definitions.Add({ + macros: { + xrightarrow: ["Extension", "AMSmath"], + xleftarrow: ["Extension", "AMSmath"] + } + }, null, true); + } + + // + // These arrows need to wait until AMSmath is loaded + // + MathJax.Hub.Register.StartupHook("TeX AMSmath Ready", function () { + TEX.Definitions.Add({ + macros: { + // + // Some of these are hacks for now + // + xleftrightarrow: ["xArrow", 0x2194, 6, 6], + xrightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: doesn't stretch in HTML-CSS output + xRightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: how should this be handled? + xLeftrightharpoons: ["xArrow", 0x21CC, 5, 7] + } + }, null, true); + }); + + TEX.Parse.Augment({ + + // + // Implements \ce and friends + // + CE: function (name) { + var arg = this.GetArgument(name); + var tex = CE(arg).Parse(); + this.string = tex + this.string.substr(this.i); this.i = 0; + }, + + PU: function (name) { + var arg = this.GetArgument(name); + var tex = CE(arg).Parse('pu'); + this.string = tex + this.string.substr(this.i); this.i = 0; + } + + }); + + // + // Indicate that the extension is ready + // + MathJax.Hub.Startup.signal.Post("TeX mhchem Ready"); + +}); + +MathJax.Ajax.loadComplete("[mhchem]/mhchem.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/newcommand.js b/js/mathjax/extensions/TeX/newcommand.js new file mode 100644 index 0000000..d106811 --- /dev/null +++ b/js/mathjax/extensions/TeX/newcommand.js @@ -0,0 +1,272 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/newcommand.js + * + * Implements the \newcommand, \newenvironment and \def + * macros, and is loaded automatically when needed. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/newcommand"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + TEXDEF.Add({ + macros: { + newcommand: 'NewCommand', + renewcommand: 'NewCommand', + newenvironment: 'NewEnvironment', + renewenvironment: 'NewEnvironment', + def: 'MacroDef', + 'let': 'Let' + } + },null,true); + + TEX.Parse.Augment({ + + /* + * Implement \newcommand{\name}[n][default]{...} + */ + NewCommand: function (name) { + var cs = this.trimSpaces(this.GetArgument(name)), + n = this.GetBrackets(name), + opt = this.GetBrackets(name), + def = this.GetArgument(name); + if (cs.charAt(0) === "\\") {cs = cs.substr(1)} + if (!cs.match(/^(.|[a-z]+)$/i)) { + TEX.Error(["IllegalControlSequenceName", + "Illegal control sequence name for %1",name]); + } + if (n) { + n = this.trimSpaces(n); + if (!n.match(/^[0-9]+$/)) { + TEX.Error(["IllegalParamNumber", + "Illegal number of parameters specified in %1",name]); + } + } + this.setDef(cs,['Macro',def,n,opt]); + }, + + /* + * Implement \newenvironment{name}[n][default]{begincmd}{endcmd} + */ + NewEnvironment: function (name) { + var env = this.trimSpaces(this.GetArgument(name)), + n = this.GetBrackets(name), + opt = this.GetBrackets(name), + bdef = this.GetArgument(name), + edef = this.GetArgument(name); + if (n) { + n = this.trimSpaces(n); + if (!n.match(/^[0-9]+$/)) { + TEX.Error(["IllegalParamNumber", + "Illegal number of parameters specified in %1",name]); + } + } + this.setEnv(env,['BeginEnv',[null,'EndEnv'],bdef,edef,n,opt]); + }, + + /* + * Implement \def command + */ + MacroDef: function (name) { + var cs = this.GetCSname(name), + params = this.GetTemplate(name,"\\"+cs), + def = this.GetArgument(name); + if (!(params instanceof Array)) {this.setDef(cs,['Macro',def,params])} + else {this.setDef(cs,['MacroWithTemplate',def].concat(params))} + }, + + /* + * Implements the \let command + */ + Let: function (name) { + var cs = this.GetCSname(name), macro; + var c = this.GetNext(); if (c === "=") {this.i++; c = this.GetNext()} + // + // All \let commands create entries in the macros array, but we + // have to look in the various mathchar and delimiter arrays if + // the source isn't a macro already, and attach the data to a + // macro with the proper routine to process it. + // + // A command of the form \let\cs=char produces a macro equivalent + // to \def\cs{char}, which is as close as MathJax can get for this. + // So \let\bgroup={ is possible, but doesn't work as it does in TeX. + // + if (c === "\\") { + name = this.GetCSname(name); + macro = this.csFindMacro(name); + if (!macro) { + if (TEXDEF.mathchar0mi.hasOwnProperty(name)) {macro = ["csMathchar0mi",TEXDEF.mathchar0mi[name]]} else + if (TEXDEF.mathchar0mo.hasOwnProperty(name)) {macro = ["csMathchar0mo",TEXDEF.mathchar0mo[name]]} else + if (TEXDEF.mathchar7.hasOwnProperty(name)) {macro = ["csMathchar7",TEXDEF.mathchar7[name]]} else + if (TEXDEF.delimiter.hasOwnProperty("\\"+name)) {macro = ["csDelimiter",TEXDEF.delimiter["\\"+name]]} else + return; + } + } else {macro = ["Macro",c]; this.i++} + this.setDef(cs,macro); + }, + + /* + * Get a CS name or give an error + */ + GetCSname: function (cmd) { + var c = this.GetNext(); + if (c !== "\\") { + TEX.Error(["MissingCS", + "%1 must be followed by a control sequence", cmd]) + } + var cs = this.trimSpaces(this.GetArgument(cmd)); + return cs.substr(1); + }, + + /* + * Get a \def parameter template + */ + GetTemplate: function (cmd,cs) { + var c, params = [], n = 0; + c = this.GetNext(); var i = this.i; + while (this.i < this.string.length) { + c = this.GetNext(); + if (c === '#') { + if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} + c = this.string.charAt(++this.i); + if (!c.match(/^[1-9]$/)) { + TEX.Error(["CantUseHash2", + "Illegal use of # in template for %1",cs]); + } + if (parseInt(c) != ++n) { + TEX.Error(["SequentialParam", + "Parameters for %1 must be numbered sequentially",cs]); + } + i = this.i+1; + } else if (c === '{') { + if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} + if (params.length > 0) {return [n,params]} else {return n} + } + this.i++; + } + TEX.Error(["MissingReplacementString", + "Missing replacement string for definition of %1",cmd]); + }, + + /* + * Process a macro with a parameter template + */ + MacroWithTemplate: function (name,text,n,params) { + if (n) { + var args = []; this.GetNext(); + if (params[0] && !this.MatchParam(params[0])) { + TEX.Error(["MismatchUseDef", + "Use of %1 doesn't match its definition",name]); + } + for (var i = 0; i < n; i++) {args.push(this.GetParameter(name,params[i+1]))} + text = this.SubstituteArgs(args,text); + } + this.string = this.AddArgs(text,this.string.slice(this.i)); + this.i = 0; + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error(["MaxMacroSub1", + "MathJax maximum macro substitution count exceeded; " + + "is there a recursive macro call?"]); + } + }, + + /* + * Process a user-defined environment + */ + BeginEnv: function (begin,bdef,edef,n,def) { + if (n) { + var args = []; + if (def != null) { + var optional = this.GetBrackets("\\begin{"+name+"}"); + args.push(optional == null ? def : optional); + } + for (var i = args.length; i < n; i++) {args.push(this.GetArgument("\\begin{"+name+"}"))} + bdef = this.SubstituteArgs(args,bdef); + edef = this.SubstituteArgs([],edef); // no args, but get errors for #n in edef + } + this.string = this.AddArgs(bdef,this.string.slice(this.i)); this.i = 0; + return begin; + }, + EndEnv: function (begin,bdef,edef,n) { + var end = "\\end{\\end\\"+begin.name+"}"; // special version of \end for after edef + this.string = this.AddArgs(edef,end+this.string.slice(this.i)); this.i = 0; + return null; + }, + + /* + * Find a single parameter delimited by a trailing template + */ + GetParameter: function (name,param) { + if (param == null) {return this.GetArgument(name)} + var i = this.i, j = 0, hasBraces = 0; + while (this.i < this.string.length) { + var c = this.string.charAt(this.i); + if (c === '{') { + if (this.i === i) {hasBraces = 1} + this.GetArgument(name); j = this.i - i; + } else if (this.MatchParam(param)) { + if (hasBraces) {i++; j -= 2} + return this.string.substr(i,j); + } else if (c === "\\") { + this.i++; j++; hasBraces = 0; + var match = this.string.substr(this.i).match(/[a-z]+|./i); + if (match) {this.i += match[0].length; j = this.i - i} + } else { + this.i++; j++; hasBraces = 0; + } + } + TEX.Error(["RunawayArgument","Runaway argument for %1?",name]); + }, + + /* + * Check if a template is at the current location. + * (The match must be exact, with no spacing differences. TeX is + * a little more forgiving than this about spaces after macro names) + */ + MatchParam: function (param) { + if (this.string.substr(this.i,param.length) !== param) {return 0} + if (param.match(/\\[a-z]+$/i) && + this.string.charAt(this.i+param.length).match(/[a-z]/i)) {return 0} + this.i += param.length; + return 1; + } + + }); + + TEX.Environment = function (name) { + TEXDEF.environment[name] = ['BeginEnv',[null,'EndEnv']].concat([].slice.call(arguments,1)); + TEXDEF.environment[name].isUser = true; + } + + MathJax.Hub.Startup.signal.Post("TeX newcommand Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/newcommand.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/noErrors.js b/js/mathjax/extensions/TeX/noErrors.js new file mode 100644 index 0000000..ae3f7f0 --- /dev/null +++ b/js/mathjax/extensions/TeX/noErrors.js @@ -0,0 +1,407 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/noErrors.js + * + * Prevents the TeX error messages from being displayed and shows the + * original TeX code instead. You can configure whether the dollar signs + * are shown or not for in-line math, and whether to put all the TeX on + * one line or use multiple-lines. + * + * To configure this extension, use + * + * MathJax.Hub.Config({ + * TeX: { + * noErrors: { + * inlineDelimiters: ["",""], // or ["$","$"] or ["\\(","\\)"] + * multiLine: true, // false for TeX on all one line + * style: { + * "font-size": "90%", + * "text-align": "left", + * "color": "black", + * "padding": "1px 3px", + * "border": "1px solid" + * // add any additional CSS styles that you want + * // (be sure there is no extra comma at the end of the last item) + * } + * } + * } + * }); + * + * Display-style math is always shown in multi-line format, and without + * delimiters, as it will already be set off in its own centered + * paragraph, like standard display mathematics. + * + * The default settings place the invalid TeX in a multi-line box with a + * black border. If you want it to look as though the TeX is just part of + * the paragraph, use + * + * MathJax.Hub.Config({ + * TeX: { + * noErrors: { + * inlineDelimiters: ["$","$"], // or ["",""] or ["\\(","\\)"] + * multiLine: false, + * style: { + * "font-size": "normal", + * "border": "" + * } + * } + * } + * }); + * + * You may also wish to set the font family, as the default is "serif" + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML) { + var VERSION = "2.7.9"; + + var CONFIG = HUB.CombineConfig("TeX.noErrors",{ + disabled: false, // set to true to return to original error messages + multiLine: true, + inlineDelimiters: ["",""], // or use ["$","$"] or ["\\(","\\)"] + style: { + "font-size": "90%", + "text-align": "left", + "color": "black", + "padding": "1px 3px", + "border": "1px solid" + } + }); + + var NBSP = "\u00A0"; + + // + // The configuration defaults, augmented by the user settings + // + MathJax.Extension["TeX/noErrors"] = { + version: VERSION, + config: CONFIG + }; + + HUB.Register.StartupHook("TeX Jax Ready",function () { + var FORMAT = MathJax.InputJax.TeX.formatError; + + MathJax.InputJax.TeX.Augment({ + // + // Make error messages be the original TeX code + // Mark them as errors and multi-line or not, and for + // multi-line TeX, make spaces non-breakable (to get formatting right) + // + formatError: function (err,math,displaystyle,script) { + if (CONFIG.disabled) {return FORMAT.apply(this,arguments)} + var message = err.message.replace(/\n.*/,""); + HUB.signal.Post(["TeX Jax - parse error",message,math,displaystyle,script]); + var delim = CONFIG.inlineDelimiters; + var multiLine = (displaystyle || CONFIG.multiLine); + if (!displaystyle) {math = delim[0] + math + delim[1]} + if (multiLine) {math = math.replace(/ /g,NBSP)} else {math = math.replace(/\n/g," ")} + return MathJax.ElementJax.mml.merror(math).With({isError:true, multiLine: multiLine}); + } + }); + }); + + /******************************************************************* + * + * Fix HTML-CSS output + */ + + HUB.Register.StartupHook("HTML-CSS Jax Config",function () { + HUB.Config({ + "HTML-CSS": { + styles: { + ".MathJax .noError": HUB.Insert({ + "vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "") + },CONFIG.style) + } + } + }); + }); + + HUB.Register.StartupHook("HTML-CSS Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var HTMLCSS = MathJax.OutputJax["HTML-CSS"]; + + var MATH = MML.math.prototype.toHTML, + MERROR = MML.merror.prototype.toHTML; + + // + // Override math toHTML routine so that error messages + // don't have the clipping and other unneeded overhead + // + MML.math.Augment({ + toHTML: function (span,node) { + var data = this.data[0]; + if (data && data.data[0] && data.data[0].isError) { + span.style.fontSize = ""; + span = this.HTMLcreateSpan(span); + span.bbox = data.data[0].toHTML(span).bbox; + } else { + span = MATH.apply(this,arguments); + } + return span; + } + }); + + // + // Override merror toHTML routine so that it puts out the + // TeX code in an inline-block with line breaks as in the original + // + MML.merror.Augment({ + toHTML: function (span) { + if (!this.isError) {return MERROR.apply(this,arguments)} + span = this.HTMLcreateSpan(span); span.className = "noError" + if (this.multiLine) {span.style.display = "inline-block"} + var text = this.data[0].data[0].data.join("").split(/\n/); + for (var i = 0, m = text.length; i < m; i++) { + HTMLCSS.addText(span,text[i]); + if (i !== m-1) {HTMLCSS.addElement(span,"br",{isMathJax:true})} + } + var HD = HTMLCSS.getHD(span.parentNode), W = HTMLCSS.getW(span.parentNode); + if (m > 1) { + var H = (HD.h + HD.d)/2, x = HTMLCSS.TeX.x_height/2; + span.parentNode.style.verticalAlign = HTMLCSS.Em(HD.d+(x-H)); + HD.h = x + H; HD.d = H - x; + } + span.bbox = {h: HD.h, d: HD.d, w: W, lw: 0, rw: W}; + return span; + } + }); + + }); + + /******************************************************************* + * + * Fix SVG output + */ + + HUB.Register.StartupHook("SVG Jax Config",function () { + HUB.Config({ + "SVG": { + styles: { + ".MathJax_SVG .noError": HUB.Insert({ + "vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "") + },CONFIG.style) + } + } + }); + }); + + HUB.Register.StartupHook("SVG Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + + var MATH = MML.math.prototype.toSVG, + MERROR = MML.merror.prototype.toSVG; + + // + // Override math toSVG routine so that error messages + // don't have the clipping and other unneeded overhead + // + MML.math.Augment({ + toSVG: function (span,node) { + var data = this.data[0]; + if (data && data.data[0] && data.data[0].isError) + {span = data.data[0].toSVG(span)} else {span = MATH.apply(this,arguments)} + return span; + } + }); + + // + // Override merror toSVG routine so that it puts out the + // TeX code in an inline-block with line breaks as in the original + // + MML.merror.Augment({ + toSVG: function (span) { + if (!this.isError || this.Parent().type !== "math") {return MERROR.apply(this,arguments)} + span = HTML.addElement(span,"span",{className: "noError", isMathJax:true}); + if (this.multiLine) {span.style.display = "inline-block"} + var text = this.data[0].data[0].data.join("").split(/\n/); + for (var i = 0, m = text.length; i < m; i++) { + HTML.addText(span,text[i]); + if (i !== m-1) {HTML.addElement(span,"br",{isMathJax:true})} + } + if (m > 1) { + var H = span.offsetHeight/2; + span.style.verticalAlign = (-H+(H/m))+"px"; + } + return span; + } + }); + + }); + + /******************************************************************* + * + * Fix NativeMML output + */ + + HUB.Register.StartupHook("NativeMML Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var CONFIG = MathJax.Extension["TeX/noErrors"].config; + + var MATH = MML.math.prototype.toNativeMML, + MERROR = MML.merror.prototype.toNativeMML; + + // + // Override math toNativeMML routine so that error messages + // don't get placed inside math tags. + // + MML.math.Augment({ + toNativeMML: function (span) { + var data = this.data[0]; + if (data && data.data[0] && data.data[0].isError) + {span = data.data[0].toNativeMML(span)} else {span = MATH.apply(this,arguments)} + return span; + } + }); + + // + // Override merror toNativeMML routine so that it puts out the + // TeX code in an inline-block with line breaks as in the original + // + MML.merror.Augment({ + toNativeMML: function (span) { + if (!this.isError) {return MERROR.apply(this,arguments)} + span = span.appendChild(document.createElement("span")); + var text = this.data[0].data[0].data.join("").split(/\n/); + for (var i = 0, m = text.length; i < m; i++) { + span.appendChild(document.createTextNode(text[i])); + if (i !== m-1) {span.appendChild(document.createElement("br"))} + } + if (this.multiLine) { + span.style.display = "inline-block"; + if (m > 1) {span.style.verticalAlign = "middle"} + } + for (var id in CONFIG.style) {if (CONFIG.style.hasOwnProperty(id)) { + var ID = id.replace(/-./g,function (c) {return c.charAt(1).toUpperCase()}); + span.style[ID] = CONFIG.style[id]; + }} + return span; + } + }); + + }); + + /******************************************************************* + * + * Fix PreviewHTML output + */ + + HUB.Register.StartupHook("PreviewHTML Jax Config",function () { + HUB.Config({ + PreviewHTML: { + styles: { + ".MathJax_PHTML .noError": HUB.Insert({ + "vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "") + },CONFIG.style) + } + } + }); + }); + + HUB.Register.StartupHook("PreviewHTML Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var HTML = MathJax.HTML; + + var MERROR = MML.merror.prototype.toPreviewHTML; + + // + // Override merror toPreviewHTML routine so that it puts out the + // TeX code in an inline-block with line breaks as in the original + // + MML.merror.Augment({ + toPreviewHTML: function (span) { + if (!this.isError) return MERROR.apply(this,arguments); + span = this.PHTMLcreateSpan(span); span.className = "noError" + if (this.multiLine) span.style.display = "inline-block"; + var text = this.data[0].data[0].data.join("").split(/\n/); + for (var i = 0, m = text.length; i < m; i++) { + HTML.addText(span,text[i]); + if (i !== m-1) {HTML.addElement(span,"br",{isMathJax:true})} + } + return span; + } + }); + + }); + + /******************************************************************* + * + * Fix CommonHTML output + */ + + HUB.Register.StartupHook("CommonHTML Jax Config",function () { + HUB.Config({ + CommonHTML: { + styles: { + ".mjx-chtml .mjx-noError": HUB.Insert({ + "line-height": 1.2, + "vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "") + },CONFIG.style) + } + } + }); + }); + + HUB.Register.StartupHook("CommonHTML Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var CHTML = MathJax.OutputJax.CommonHTML; + var HTML = MathJax.HTML; + + var MERROR = MML.merror.prototype.toCommonHTML; + + // + // Override merror toCommonHTML routine so that it puts out the + // TeX code in an inline-block with line breaks as in the original + // + MML.merror.Augment({ + toCommonHTML: function (node) { + if (!this.isError) return MERROR.apply(this,arguments); + node = CHTML.addElement(node,"mjx-noError"); + var text = this.data[0].data[0].data.join("").split(/\n/); + for (var i = 0, m = text.length; i < m; i++) { + HTML.addText(node,text[i]); + if (i !== m-1) {CHTML.addElement(node,"br",{isMathJax:true})} + } + var bbox = this.CHTML = CHTML.BBOX.zero(); + bbox.w = (node.offsetWidth)/CHTML.em; + if (m > 1) { + var H2 = 1.2*m/2; + bbox.h = H2+.25; bbox.d = H2-.25; + node.style.verticalAlign = CHTML.Em(.45-H2); + } else { + bbox.h = 1; bbox.d = .2 + 2/CHTML.em; + } + return node; + } + }); + + }); + + /*******************************************************************/ + + HUB.Startup.signal.Post("TeX noErrors Ready"); + +})(MathJax.Hub,MathJax.HTML); + + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/noUndefined.js b/js/mathjax/extensions/TeX/noUndefined.js new file mode 100644 index 0000000..463a446 --- /dev/null +++ b/js/mathjax/extensions/TeX/noUndefined.js @@ -0,0 +1,74 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/noUndefined.js + * + * This causes undefined control sequences to be shown as their macro + * names rather than producing an error message. So $X_{\xxx}$ would + * display as an X with a subscript consiting of the text "\xxx". + * + * To configure this extension, use for example + * + * MathJax.Hub.Config({ + * TeX: { + * noUndefined: { + * attributes: { + * mathcolor: "red", + * mathbackground: "#FFEEEE", + * mathsize: "90%" + * } + * } + * } + * }); + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// The configuration defaults, augmented by the user settings +// +MathJax.Extension["TeX/noUndefined"] = { + version: "2.7.9", + config: MathJax.Hub.CombineConfig("TeX.noUndefined",{ + disabled: false, // set to true to return to original error messages + attributes: { + mathcolor: "red" + } + }) +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var CONFIG = MathJax.Extension["TeX/noUndefined"].config; + var MML = MathJax.ElementJax.mml; + var UNDEFINED = MathJax.InputJax.TeX.Parse.prototype.csUndefined; + + MathJax.InputJax.TeX.Parse.Augment({ + csUndefined: function (name) { + if (CONFIG.disabled) {return UNDEFINED.apply(this,arguments)} + MathJax.Hub.signal.Post(["TeX Jax - undefined control sequence",name]); + this.Push(MML.mtext(name).With(CONFIG.attributes)); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX noUndefined Ready"); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noUndefined.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/text-macros.js b/js/mathjax/extensions/TeX/text-macros.js new file mode 100644 index 0000000..447a853 --- /dev/null +++ b/js/mathjax/extensions/TeX/text-macros.js @@ -0,0 +1,489 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/extensions/TeX/text-macros.js + * + * Implements the processing of some text-mode macros inside + * \text{} and other text boxes. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2018-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/text-macros"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () { + var MML = MathJax.ElementJax.mml; + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + TEX.Parse.Augment({ + // + // Replace InternalMath with parser that handles some text macros + // + InternalMath: function(text,level) { + var mml = TextParser(text, {}).Parse(); + if (level != null) { + mml = [MML.mstyle.apply(MML,mml).With({displaystyle:false, scriptlevel:level})]; + } else if (mml.length > 1) { + mml = [MML.mrow.apply(MML,mml)]; + } + return mml; + }, + + // + // Correctly skip newline as well as comment + // + Comment: function (c) { + while (this.i < this.string.length && this.string.charAt(this.i) != "\n") {this.i++} + this.i++; + }, + + // + // Correctly skip trailing space as well + // + GetCS: function () { + var CS = this.string.slice(this.i).match(/^([a-z]+|.) ?/i); + if (CS) {this.i += CS[0].length; return CS[1]} else {this.i++; return " "} + } + + }); + + // + // The text parser is a subclass of the math parser, so we can use + // some of the existing methods (like GetArgument()), and some of the + // control sequence implementations (like Macro, Spacer, etc.) + // + var TextParser = TEX.TextParser = TEX.Parse.Subclass({ + + Init: function (text, env) { + this.env = MathJax.Hub.Insert({},env); + this.stack = {env: this.env}; + this.string = text; + this.i = 0; + this.mml = []; // the accumulated MathML elements + this.text = ''; // the accumulated text so far + }, + + // + // These are the special characters in text mode + // + textSpecial: { + '\\': 'ControlSequence', + '$': 'Math', + '%': 'Comment', + '^': 'MathModeOnly', + '_': 'MathModeOnly', + '&': 'Misplaced', + '#': 'Misplaced', + '~': 'Tilde', + ' ': 'Space', + '\t': 'Space', + '\r': 'Space', + '\n': 'Space', + '\u00A0': 'Tilde', + '{': 'OpenBrace', + '}': 'CloseBrace', + '`': 'OpenQuote', + "'": 'CloseQuote' + }, + + // + // These are text-mode macros we support + // + textMacros: { + '(': 'Math', + + '$': 'SelfQuote', + '_': 'SelfQuote', + '%': 'SelfQuote', + '{': 'SelfQuote', + '}': 'SelfQuote', + ' ': 'SelfQuote', + '&': 'SelfQuote', + '#': 'SelfQuote', + '\\': 'SelfQuote', + + "'": ['Accent', '\u00B4'], + '`': ['Accent', '\u0060'], + '^': ['Accent', '^'], + '"': ['Accent', '\u00A8'], + '~': ['Accent', '~'], + '=': ['Accent', '\u00AF'], + '.': ['Accent', '\u02D9'], + 'u': ['Accent', '\u02D8'], + 'v': ['Accent', '\u02C7'], + + emph: 'Emph', + rm: ['SetFont',MML.VARIANT.NORMAL], + mit: ['SetFont',MML.VARIANT.ITALIC], + oldstyle: ['SetFont',MML.VARIANT.OLDSTYLE], + cal: ['SetFont',MML.VARIANT.CALIGRAPHIC], + it: ['SetFont','-tex-mathit'], // needs special handling + bf: ['SetFont',MML.VARIANT.BOLD], + bbFont: ['SetFont',MML.VARIANT.DOUBLESTRUCK], + scr: ['SetFont',MML.VARIANT.SCRIPT], + frak: ['SetFont',MML.VARIANT.FRAKTUR], + sf: ['SetFont',MML.VARIANT.SANSSERIF], + tt: ['SetFont',MML.VARIANT.MONOSPACE], + + tiny: ['SetSize',0.5], + Tiny: ['SetSize',0.6], // non-standard + scriptsize: ['SetSize',0.7], + small: ['SetSize',0.85], + normalsize: ['SetSize',1.0], + large: ['SetSize',1.2], + Large: ['SetSize',1.44], + LARGE: ['SetSize',1.73], + huge: ['SetSize',2.07], + Huge: ['SetSize',2.49], + + mathcal: 'MathModeOnly', + mathscr: 'MathModeOnly', + mathrm: 'MathModeOnly', + mathbf: 'MathModeOnly', + mathbb: 'MathModeOnly', + mathit: 'MathModeOnly', + mathfrak: 'MathModeOnly', + mathsf: 'MathModeOnly', + mathtt: 'MathModeOnly', + Bbb: ['Macro','{\\bbFont #1}',1], + textrm: ['Macro','{\\rm #1}',1], + textit: ['Macro','{\\it #1}',1], + textbf: ['Macro','{\\bf #1}',1], + textsf: ['Macro','{\\sf #1}',1], + texttt: ['Macro','{\\tt #1}',1], + + dagger: ['Insert', '\u2020'], + ddagger: ['Insert', '\u2021'], + S: ['Insert', '\u00A7'] + }, + + // + // These are the original macros that are allowed in text mode + // + useMathMacros: { + ',': true, + ':': true, + '>': true, + ';': true, + '!': true, + enspace: true, + quad: true, + qquad: true, + thinspace: true, + negthinspace: true, + + hskip: true, + hspace: true, + kern: true, + mskip: true, + mspace: true, + mkern: true, + rule: true, + Rule: true, + Space: true, + + color: true, + href: true, + unicode: true, + + ref: true, + eqref: true + }, + + // + // Look through the text for special characters and process them. + // Save any accumulated text aat the end and return the MathML + // elements produced. + // + Parse: function () { + var c; + while ((c = this.string.charAt(this.i++))) { + if (this.textSpecial.hasOwnProperty(c)) { + this[this.textSpecial[c]](c); + } else { + this.text += c; + } + } + this.SaveText(); + return this.mml; + }, + + // + // Handle a control sequence name + // If it is a text-mode macro, use it. + // Otherwise look for it in the math-mode lists + // Report an error if it is not there + // Otherwise check if it is a macro or one of the allowed control sequences + // Run the macro (with arguments if given) + // + ControlSequence: function (c) { + var cs = this.GetCS(), name = c + cs, cmd; + if (this.textMacros.hasOwnProperty(cs)) { + cmd = this.textMacros[cs]; + } else { + cmd = this.LookupCS(cs); + if (!cmd) { + this.Error(["UndefinedControlSequence","Undefined control sequence %1",name]); + } + if ((!(cmd instanceof Array) || cmd[0] !== 'Macro') && + !this.useMathMacros.hasOwnProperty(cs)) { + this.Error(["MathMacro","'%1' is only supported in math mode",name]); + } + } + if (cmd instanceof Array) { + if (!this.hasOwnProperty[cmd[0]]) this.SaveText(); + this[cmd[0]].apply(this,[name].concat(cmd.slice(1))); + } else { + if (!this.hasOwnProperty[cmd]) this.SaveText(); + this[cmd].call(this,name); + } + }, + + // + // Lookup the CS as a math-mode macro + // + LookupCS: function(cs) { + if (TEXDEF.macros.hasOwnProperty(cs)) return TEXDEF.macros[cs]; + if (TEXDEF.mathchar0mi.hasOwnProperty(cs)) return TEXDEF.mathchar0mi[cs]; + if (TEXDEF.mathchar0mo.hasOwnProperty(cs)) return TEXDEF.mathchar0mo[cs]; + if (TEXDEF.mathchar7.hasOwnProperty(cs)) return TEXDEF.mathchar7[cs]; + if (TEXDEF.delimiter.hasOwnProperty('\\'+cs)) return TEXDEF.delimiter['\\'+cs]; + return null; + }, + + // + // Handle internal math mode + // Look for the close delimiter and process the contents + // + Math: function (open) { + this.SaveText(); + var i = this.i, j; + var braces = 0, c; + while ((c = this.GetNext())) { + j = this.i++; + switch(c) { + case '\\': + var cs = this.GetCS(); + if (cs === ')') c = '\\('; + case '$': + if (braces === 0 && open === c) { + this.Push(TEX.Parse(this.string.substr(i, j-i),this.env).mml()); + return; + } + break; + + case '{': + braces++; + break; + + case '}': + if (braces == 0) { + this.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"]); + } + braces--; + break; + } + } + this.Error(["MathNotTerminated","Math not terminated in text box"]); + }, + + // + // Character can only be used in math mode + // + MathModeOnly: function (c) { + this.Error(["MathModeOnly","'%1' allowed only in math mode",c]); + }, + + // + // Character is being used out of place + // + Misplaced: function (c) { + this.Error(["Misplaced","'%1' can not be used here",c]); + }, + + // + // Braces start new environments + // + OpenBrace: function (c) { + var env = this.env; + this.env = MathJax.Hub.Insert({}, env); + this.env.oldEnv = env; + }, + CloseBrace: function (c) { + if (this.env.oldEnv) { + this.SaveText(); + this.env = this.env.oldEnv; + } else { + this.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"]); + } + }, + + // + // Handle open and close quotes + // + OpenQuote: function (c) { + if (this.string.charAt(this.i) === c) { + this.text += "\u201C"; + this.i++; + } else { + this.text += "\u2018" + } + }, + CloseQuote: function (c) { + if (this.string.charAt(this.i) === c) { + this.text += "\u201D"; + this.i++; + } else { + this.text += "\u2019" + } + }, + + // + // Handle non-breaking and regular spaces + // + Tilde: function (c) { + this.text += '\u00A0'; + }, + Space: function (c) { + this.text += ' '; + while (this.GetNext().match(/\s/)) this.i++; + }, + + // + // Insert the escaped characer + // + SelfQuote: function (name) { + this.text += name.substr(1); + }, + + // + // Insert a given character + // + Insert: function (name, c) { + this.text += c; + }, + + // + // Create an accented character using mover + // + Accent: function (name, c) { + this.SaveText(); + var base = this.ParseArg(name); + var accent = MML.mo(MML.chars(c)); + if (this.env.mathvariant) accent.mathvariant = this.env.mathvariant; + this.Push(MML.mover(base,accent)); + }, + + // + // Switch to/from italics + // + Emph: function (name) { + this.UseFont(name, this.env.mathvariant === '-tex-mathit' ? 'normal' : '-tex-mathit'); + }, + + // + // Use a given font on its argument + // + UseFont: function (name, variant) { + this.SaveText(); + this.Push(this.ParseTextArg(name,{mathvariant: variant})); + }, + + // + // Set a font for the rest of the text + // + SetFont: function (name, variant) { + this.SaveText(); + this.env.mathvariant = variant; + }, + + // + // Set the size to use + // + SetSize: function (name, size) { + this.SaveText(); + this.env.mathsize = size; + }, + + // + // Process the argument as text with the given environment settings + // + ParseTextArg: function (name, env) { + var text = this.GetArgument(name); + env = MathJax.Hub.Insert(MathJax.Hub.Insert({}, this.env), env); + delete env.oldEnv; + return TextParser(text, env).Parse(); + }, + + // + // Process an argument as text (overrides the math-mode version) + // + ParseArg: function (name) { + var mml = TextParser(this.GetArgument(name), this.env).Parse(); + if (mml.length === 0) return mml[0]; + return MML.mrow.apply(MML.mrow, mml); + }, + + // + // Create an mtext element with the accumulated text, if any + // and set it variant + // + SaveText: function () { + if (this.text) { + var text = MML.mtext(MML.chars(this.text)); + if (this.env.mathvariant) text.mathvariant = this.env.mathvariant; + this.Push(text); + } + this.text = ""; + }, + + // + // Save a MathML element or array, setting its size and color, if any + // + Push: function (mml) { + if (mml instanceof Array) { + if (this.env.mathsize || this.env.mathcolor) { + mml = MML.mstyle.apply(MML,mml); + if (this.env.mathsize) mml.mathsize = this.env.mathsize; + if (this.env.mathcolor) mml.mathcolor = this.env.mathcolor; + } + this.mml.push.apply(this.mml,mml); + } else { + if (this.env.mathsize && !mml.mathsize) mml.mathsize = this.env.mathsize; + if (this.env.mathcolor && !mml.mathcolor) mml.mathcolor = this.env.mathcolor; + this.mml.push(mml); + } + }, + + // + // Throw an error + // + Error: function (message) { + TEX.Error(message); + } + + }); + + MathJax.Hub.Startup.signal.Post('TeX text-macros Ready'); + +}); + +MathJax.Ajax.loadComplete('[MathJax]/extensions/TeX/text-macros.js'); +// @license-end diff --git a/js/mathjax/extensions/TeX/unicode.js b/js/mathjax/extensions/TeX/unicode.js new file mode 100644 index 0000000..0c3e50a --- /dev/null +++ b/js/mathjax/extensions/TeX/unicode.js @@ -0,0 +1,172 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/unicode.js + * + * Implements the \unicode extension to TeX to allow arbitrary unicode + * code points to be entered into the TeX file. You can specify + * the height and depth of the character (the width is determined by + * the browser), and the default font from which to take the character. + * + * Examples: + * \unicode{65} % the character 'A' + * \unicode{x41} % the character 'A' + * \unicode[.55,0.05]{x22D6} % less-than with dot, with height .55 and depth 0.05 + * \unicode[.55,0.05][Geramond]{x22D6} % same taken from Geramond font + * \unicode[Garamond]{x22D6} % same, but with default height, depth of .8,.2 + * + * Once a size and font are provided for a given code point, they need + * not be specified again in subsequent \unicode calls for that character. + * Note that a font list can be given, but Internet Explorer has a buggy + * implementation of font-family where it only looks in the first + * available font and if the glyph is not in that, it does not look at + * later fonts, but goes directly to the default font as set in the + * Internet-Options/Font panel. For this reason, the default font list is + * "STIXGeneral,'Arial Unicode MS'", so if the user has STIX fonts, the + * symbol will be taken from that (almost all the symbols are in + * STIXGeneral), otherwise Arial Unicode MS is tried. + * + * To configure the default font list, use + * + * MathJax.Hub.Config({ + * TeX: { + * unicode: { + * fonts: "STIXGeneral,'Arial Unicode MS'" + * } + * } + * }); + * + * The result of \unicode will have TeX class ORD (i.e., it will act like a + * variable). Use \mathbin, \mathrel, etc, to specify a different class. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// +// The configuration defaults, augmented by the user settings +// +MathJax.Extension["TeX/unicode"] = { + version: "2.7.9", + unicode: {}, + config: MathJax.Hub.CombineConfig("TeX.unicode",{ + fonts: "STIXGeneral,'Arial Unicode MS'" + }) +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX; + var MML = MathJax.ElementJax.mml; + var UNICODE = MathJax.Extension["TeX/unicode"].unicode; + + // + // Add \unicode macro + // + TEX.Definitions.Add({macros: {unicode: 'Unicode'}},null,true); + // + // Implementation of \unicode in parser + // + TEX.Parse.Augment({ + Unicode: function(name) { + var HD = this.GetBrackets(name), font; + if (HD) { + if (HD.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)) + {HD = HD.replace(/ /g,"").split(/,/); font = this.GetBrackets(name)} + else {font = HD; HD = null} + } + var n = this.trimSpaces(this.GetArgument(name)).replace(/^0x/,"x"); + if (!n.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/)) { + TEX.Error(["BadUnicode","Argument to \\unicode must be a number"]); + } + var N = parseInt(n.match(/^x/) ? "0"+n : n); + if (!UNICODE[N]) {UNICODE[N] = [800,200,font,N]} + else if (!font) {font = UNICODE[N][2]} + if (HD) { + UNICODE[N][0] = Math.floor(HD[0]*1000); + UNICODE[N][1] = Math.floor(HD[1]*1000); + } + var variant = this.stack.env.font, def = {}; + if (font) { + UNICODE[N][2] = def.fontfamily = font.replace(/"/g,"'"); + if (variant) { + if (variant.match(/bold/)) {def.fontweight = "bold"} + if (variant.match(/italic|-mathit/)) {def.fontstyle = "italic"} + } + } else if (variant) {def.mathvariant = variant} + def.unicode = [].concat(UNICODE[N]); // make a copy + this.Push(MML.mtext(MML.entity("#"+n)).With(def)); + } + }); + + MathJax.Hub.Startup.signal.Post("TeX unicode Ready"); + +}); + +MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var FONTS = MathJax.Extension["TeX/unicode"].config.fonts; + + // + // Override getVariant to make one that includes the font and size + // + var GETVARIANT = MML.mbase.prototype.HTMLgetVariant; + MML.mbase.Augment({ + HTMLgetVariant: function () { + var variant = GETVARIANT.apply(this,arguments); + if (variant.unicode) {delete variant.unicode; delete variant.FONTS} // clear font cache in case of restart + if (!this.unicode) {return variant} + variant.unicode = true; + if (!variant.defaultFont) { + variant = MathJax.Hub.Insert({},variant); // make a copy + variant.defaultFont = {family:FONTS}; + } + var family = this.unicode[2]; if (family) {family += ","+FONTS} else {family = FONTS} + variant.defaultFont[this.unicode[3]] = [ + this.unicode[0],this.unicode[1],500,0,500, + {isUnknown:true, isUnicode:true, font:family} + ]; + return variant; + } + }); +}); + +MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { + var MML = MathJax.ElementJax.mml; + var FONTS = MathJax.Extension["TeX/unicode"].config.fonts; + + // + // Override getVariant to make one that includes the font and size + // + var GETVARIANT = MML.mbase.prototype.SVGgetVariant; + MML.mbase.Augment({ + SVGgetVariant: function () { + var variant = GETVARIANT.call(this); + if (variant.unicode) {delete variant.unicode; delete variant.FONTS} // clear font cache in case of restart + if (!this.unicode) {return variant} + variant.unicode = true; + if (!variant.forceFamily) {variant = MathJax.Hub.Insert({},variant)} // make a copy + variant.defaultFamily = FONTS; variant.noRemap = true; + variant.h = this.unicode[0]; variant.d = this.unicode[1]; + return variant; + } + }); +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js"); +// @license-end diff --git a/js/mathjax/extensions/TeX/verb.js b/js/mathjax/extensions/TeX/verb.js new file mode 100644 index 0000000..0f6f845 --- /dev/null +++ b/js/mathjax/extensions/TeX/verb.js @@ -0,0 +1,63 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/TeX/verb.js + * + * Implements the \verb|...| command for including text verbatim + * (with no processing of macros or special characters). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension["TeX/verb"] = { + version: "2.7.9" +}; + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + + var MML = MathJax.ElementJax.mml; + var TEX = MathJax.InputJax.TeX; + var TEXDEF = TEX.Definitions; + + TEXDEF.Add({macros: {verb: 'Verb'}},null,true); + + TEX.Parse.Augment({ + + /* + * Implement \verb|...| + */ + Verb: function (name) { + var c = this.GetNext(); var start = ++this.i; + if (c == "" ) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} + while (this.i < this.string.length && this.string.charAt(this.i) != c) {this.i++} + if (this.i == this.string.length) + {TEX.Error(["NoClosingDelim","Can't find closing delimiter for %1", name])} + var text = this.string.slice(start,this.i).replace(/ /g,"\u00A0"); this.i++; + this.Push(MML.mtext(text).With({mathvariant:MML.VARIANT.MONOSPACE})); + } + + }); + + MathJax.Hub.Startup.signal.Post("TeX verb Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/verb.js"); +// @license-end diff --git a/js/mathjax/extensions/a11y/accessibility-menu.js b/js/mathjax/extensions/a11y/accessibility-menu.js new file mode 100644 index 0000000..7262c22 --- /dev/null +++ b/js/mathjax/extensions/a11y/accessibility-menu.js @@ -0,0 +1,186 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * [Contrib]/a11y/accessibility-menu.js + * + * A thin extension to add opt-in menu items for the accessibility + * extensions in the a11y contributed directory. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2016-2017 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function(HUB,EXTENSIONS) { + var SETTINGS = HUB.config.menuSettings; + var ITEM, MENU; // filled in when MathMenu extension loads + + var BIND = (Function.prototype.bind ? function (f,t) {return f.bind(t)} : + function (f,t) {return function () {f.apply(t,arguments)}}); + var KEYS = Object.keys || function (obj) { + var keys = []; + for (var id in obj) {if (obj.hasOwnProperty(id)) keys.push(id)} + return keys; + }; + + // + // Set up the a11y path,if it isn't already in place + // + var PATH = MathJax.Ajax.config.path; + if (!PATH.a11y) PATH.a11y = HUB.config.root + "/extensions/a11y"; + + var Accessibility = EXTENSIONS["accessibility-menu"] = { + version: '1.6.0', + prefix: '', //'Accessibility-', + defaults: {}, + modules: [], + MakeOption: function(name) { + return Accessibility.prefix + name; + }, + GetOption: function(option) { + return SETTINGS[Accessibility.MakeOption(option)]; + }, + AddDefaults: function() { + var keys = KEYS(Accessibility.defaults); + for (var i = 0, key; key = keys[i]; i++) { + var option = Accessibility.MakeOption(key); + if (typeof(SETTINGS[option]) === 'undefined') { + SETTINGS[option] = Accessibility.defaults[key]; + } + } + }, + // Attaches the menu items; + AddMenu: function() { + var items = Array(this.modules.length); + for (var i = 0, module; module = this.modules[i]; i++) items[i] = module.placeHolder; + var menu = MENU.FindId('Accessibility'); + if (menu) { + items.unshift(ITEM.RULE()); + menu.submenu.items.push.apply(menu.submenu.items,items); + } else { + var renderer = (MENU.FindId("Settings","Renderer")||{}).submenu; + if (renderer) { + // move AssitiveMML and InTabOrder from Renderer to Accessibility menu + items.unshift(ITEM.RULE()); + items.unshift(renderer.items.pop()); + items.unshift(renderer.items.pop()); + } + items.unshift("Accessibility"); + var menu = ITEM.SUBMENU.apply(ITEM.SUBMENU,items); + var locale = MENU.IndexOfId('Locale'); + if (locale) { + MENU.items.splice(locale,0,menu); + } else { + MENU.items.push(ITEM.RULE(), menu); + } + } + }, + Register: function(module) { + Accessibility.defaults[module.option] = false; + Accessibility.modules.push(module); + }, + Startup: function() { + ITEM = MathJax.Menu.ITEM; + MENU = MathJax.Menu.menu; + for (var i = 0, module; module = this.modules[i]; i++) module.CreateMenu(); + this.AddMenu(); + }, + LoadExtensions: function () { + var extensions = []; + for (var i = 0, module; module = this.modules[i]; i++) { + if (SETTINGS[module.option]) extensions.push(module.module); + } + return (extensions.length ? HUB.Startup.loadArray(extensions) : null); + } + }; + + var ModuleLoader = MathJax.Extension.ModuleLoader = MathJax.Object.Subclass({ + option: '', + name: ['',''], + module: '', + placeHolder: null, + submenu: false, + extension: null, + Init: function(option, name, module, extension, submenu) { + this.option = option; + this.name = [name.replace(/ /g,''),name]; + this.module = module; + this.extension = extension; + this.submenu = (submenu || false); + }, + CreateMenu: function() { + var load = BIND(this.Load,this); + if (this.submenu) { + this.placeHolder = + ITEM.SUBMENU(this.name, + ITEM.CHECKBOX(["Activate","Activate"], + Accessibility.MakeOption(this.option), {action: load}), + ITEM.RULE(), + ITEM.COMMAND(["OptionsWhenActive","(Options when Active)"],null,{disabled:true}) + ); + } else { + this.placeHolder = ITEM.CHECKBOX( + this.name, Accessibility.MakeOption(this.option), {action: load} + ); + } + }, + Load: function() { + HUB.Queue(["Require",MathJax.Ajax,this.module,["Enable",this]]); + }, + Enable: function(menu) { + var extension = MathJax.Extension[this.extension]; + if (extension) { + extension.Enable(true,true); + MathJax.Menu.saveCookie(); + } + } + }); + + Accessibility.Register( + ModuleLoader( + 'collapsible', 'Collapsible Math', '[a11y]/collapsible.js', 'collapsible' + ) + ); + Accessibility.Register( + ModuleLoader( + 'autocollapse', 'Auto Collapse', '[a11y]/auto-collapse.js', 'auto-collapse' + ) + ); + Accessibility.Register( + ModuleLoader( + 'explorer', 'Explorer', '[a11y]/explorer.js', 'explorer', true + ) + ); + + Accessibility.AddDefaults(); + + HUB.Register.StartupHook('End Extensions', function () { + HUB.Register.StartupHook('MathMenu Ready', function () { + Accessibility.Startup(); + HUB.Startup.signal.Post('Accessibility Menu Ready'); + },5); // run before other extensions' menu hooks even if they are loaded first + },5); + + MathJax.Hub.Register.StartupHook("End Cookie", function () { + MathJax.Callback.Queue( + ["LoadExtensions",Accessibility], + ["loadComplete",MathJax.Ajax,"[a11y]/accessibility-menu.js"] + ); + }); + +})(MathJax.Hub,MathJax.Extension); + + +// @license-end diff --git a/js/mathjax/extensions/a11y/auto-collapse.js b/js/mathjax/extensions/a11y/auto-collapse.js new file mode 100644 index 0000000..d18eca9 --- /dev/null +++ b/js/mathjax/extensions/a11y/auto-collapse.js @@ -0,0 +1,500 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * [Contrib]/a11y/auto-collapse.js + * + * Implements the ability to have long expressions collapse + * automatically on screen size changes. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2016-2017 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB) { + var SETTINGS = HUB.config.menuSettings; + var COOKIE = {}; // replaced when menu is available + + // + // Set up the a11y path,if it isn't already in place + // + var PATH = MathJax.Ajax.config.path; + if (!PATH.a11y) PATH.a11y = HUB.config.root + "/extensions/a11y"; + + var Collapse = MathJax.Extension["auto-collapse"] = { + version: "1.6.0", + config: HUB.CombineConfig("auto-collapse",{ + disabled: false + }), + dependents: [], // the extensions that depend on this one + + /*****************************************************************/ + + Enable: function (update,menu) { + SETTINGS.autocollapse = true; + if (menu) COOKIE.autocollapse = true + this.config.disabled = false; + MathJax.Extension.collapsible.Enable(false,menu); + if (update) { + HUB.Queue( + ["Reprocess",HUB], + ["CollapseWideMath",this] + ); + } + }, + Disable: function (update,menu) { + SETTINGS.autocollapse = false; + if (menu) COOKIE.autocollapse = false; + this.config.disabled = true; + for (var i = this.dependents.length-1; i >= 0; i--) { + var dependent = this.dependents[i]; + if (dependent.Disable) dependent.Disable(false,menu); + } + if (update) HUB.Queue(["Rerender",HUB]); + }, + + // + // Register a dependent + // + Dependent: function (extension) { + this.dependents.push(extension); + }, + + Startup: function () { + // + // Inform collapsible extension that we are a dependent + // + var Collapsible = MathJax.Extension.collapsible; + if (Collapsible) Collapsible.Dependent(this); + // + // Add the filter into the post-input hooks (priority 150, so other + // hooks run first, in particular, the enrichment and complexity hooks). + // + HUB.postInputHooks.Add(["Filter",Collapse],150); + // + // Add the auto-collapsing + // + HUB.Queue(function () {return Collapse.CollapseWideMath()}); + // + // Add a resize handler to check for math that needs + // to be collapsed or expanded. + // + if (window.addEventListener) window.addEventListener("resize",Collapse.resizeHandler,false); + else if (window.attachEvent) window.attachEvent("onresize",Collapse.resizeHandler); + else window.onresize = Collapse.resizeHandler; + }, + + // + // If the math is block-level (or in an element "by itself"), then + // add the SRE actions for this element. + // + Filter: function (jax,id,script) { + if (!jax.enriched || this.config.disabled) return; + if (jax.root.Get("display") === "block" || + script.parentNode.childNodes.length <= 3) { + jax.root.SRE = {action: this.Actions(jax.root)}; + } + }, + // + // Produce an array of collapsible actions + // sorted by depth and complexity + // + Actions: function (node) { + var actions = []; + this.getActions(node,0,actions); + return this.sortActions(actions); + }, + getActions: function (node,depth,actions) { + if (node.isToken || !node.data) return; + depth++; + for (var i = 0, m = node.data.length; i < m; i++) { + if (node.data[i]) { + var child = node.data[i]; + if (child.collapsible) { + if (!actions[depth]) actions[depth] = []; + actions[depth].push(child); + this.getActions(child.data[1],depth,actions); + } else { + this.getActions(child,depth,actions); + } + } + } + }, + sortActions: function (actions) { + var ACTIONS = []; + for (var i = 0, m = actions.length; i < m; i++) { + if (actions[i]) ACTIONS = ACTIONS.concat(actions[i].sort(this.sortActionsBy)); + } + return ACTIONS; + }, + sortActionsBy: function (a,b) { + a = a.data[1].complexity; b = b.data[1].complexity; + return (a < b ? -1 : a > b ? 1 : 0); + }, + + /*****************************************************************/ + /* + * These routines implement the automatic collapsing of equations + * based on container widths. + */ + + // + // Find math that is too wide and collapse it. + // + CollapseWideMath: function (element) { + if (this.config.disabled) return; + this.GetContainerWidths(element); + var jax = HUB.getAllJax(element); + var state = {collapse: [], jax: jax, m: jax.length, i: 0, changed:false}; + return this.collapseState(state); + }, + collapseState: function (state) { + var collapse = state.collapse; + while (state.i < state.m) { + var jax = state.jax[state.i]; + var SRE = jax.root.SRE; state.changed = false; + if (SRE && SRE.action.length) { + if (SRE.cwidth < SRE.m || SRE.cwidth > SRE.M) { + var restart = this.getActionWidths(jax,state); if (restart) return restart; + this.collapseActions(SRE,state); + if (state.changed) collapse.push(jax.SourceElement()); + } + } + state.i++; + } + if (collapse.length === 0) return; + if (collapse.length === 1) collapse = collapse[0]; + return HUB.Rerender(collapse); + }, + + // + // Find the actions that need to be collapsed to acheive + // the correct width, and retain the sizes that would cause + // the equation to be expanded or collapsed further. + // + collapseActions: function (SRE,state) { + var w = SRE.width, m = w, M = 1000000; + for (var j = SRE.action.length-1; j >= 0; j--) { + var action = SRE.action[j], selection = action.selection; + if (w > SRE.cwidth) { + action.selection = 1; + m = action.SREwidth; M = w; + } else { + action.selection = 2; + } + w = action.SREwidth; + if (SRE.DOMupdate) { + document.getElementById(action.id).setAttribute("selection",action.selection); + } else if (action.selection !== selection) { + state.changed = true; + } + } + SRE.m = m; SRE.M = M; + }, + + // + // Get the widths of the different collapsings, + // trapping any restarts, and restarting the process + // when the event has occurred. + // + getActionWidths: function (jax,state) { + if (!jax.root.SRE.actionWidths) { + MathJax.OutputJax[jax.outputJax].getMetrics(jax); + try {this.computeActionWidths(jax)} catch (err) { + if (!err.restart) throw err; + return MathJax.Callback.After(["collapseState",this,state],err.restart); + } + state.changed = true; + } + return null; + }, + // + // Compute the action widths by collapsing each maction, + // and recording the width of the complete equation. + // + computeActionWidths: function (jax) { + var SRE = jax.root.SRE, actions = SRE.action, j, state = {}; + SRE.width = jax.sreGetRootWidth(state); + for (j = actions.length-1; j >= 0; j--) actions[j].selection = 2; + for (j = actions.length-1; j >= 0; j--) { + var action = actions[j]; + if (action.SREwidth == null) { + action.selection = 1; + action.SREwidth = jax.sreGetActionWidth(state,action); + } + } + SRE.actionWidths = true; + }, + + // + // Get the widths of the containers of tall the math elements + // that can be collapsed (so we can tell which ones NEED to be + // collapsed). Do this in a way that only causes two reflows. + // + GetContainerWidths: function (element) { + var JAX = HUB.getAllJax(element); + var i, m, script, span = MathJax.HTML.Element("span",{style:{display:"block"}}); + var math = [], jax, root; + for (i = 0, m = JAX.length; i < m; i++) { + jax = JAX[i], root = jax.root, SRE = root.SRE; + if (SRE && SRE.action.length) { + if (SRE.width == null) { + jax.sreGetMetrics(); + SRE.m = SRE.width; SRE.M = 1000000; + } + script = jax.SourceElement(); + script.previousSibling.style.display = "none"; + script.parentNode.insertBefore(span.cloneNode(false),script); + math.push([jax,script]); + } + } + for (i = 0, m = math.length; i < m; i++) { + jax = math[i][0], script = math[i][1]; + if (script.previousSibling.offsetWidth) + jax.root.SRE.cwidth = script.previousSibling.offsetWidth * jax.root.SRE.em; + } + for (i = 0, m = math.length; i < m; i++) { + jax = math[i][0], script = math[i][1]; + script.parentNode.removeChild(script.previousSibling); + script.previousSibling.style.display = ""; + } + }, + + /*****************************************************************/ + + // + // A resize handler that can be tied to the window resize event + // to collapse math automatically on resize. + // + + timer: null, + running: false, + retry: false, + saved_delay: 0, + + resizeHandler: function (event) { + if (Collapse.config.disabled) return; + if (Collapse.running) {Collapse.retry = true; return} + if (Collapse.timer) clearTimeout(Collapse.timer); + Collapse.timer = setTimeout(Collapse.resizeAction, 100); + }, + resizeAction: function () { + Collapse.timer = null; + Collapse.running = true; + HUB.Queue( + function () { + // + // Prevent flicker between input and output phases. + // + Collapse.saved_delay = HUB.processSectionDelay; + HUB.processSectionDelay = 0; + }, + ["CollapseWideMath",Collapse], + ["resizeCheck",Collapse] + ); + }, + resizeCheck: function () { + Collapse.running = false; + HUB.processSectionDelay = Collapse.saved_delay; + if (Collapse.retry) { + Collapse.retry = false; + setTimeout(Collapse.resizeHandler,0); + } + } + + }; + + HUB.Register.StartupHook("End Extensions", function () { + if (SETTINGS.autocollapse == null) { + SETTINGS.autocollapse = !Collapse.config.disabled; + } else { + Collapse.config.disabled = !SETTINGS.autocollapse; + } + HUB.Register.StartupHook("MathMenu Ready", function () { + COOKIE = MathJax.Menu.cookie; + var Switch = function(menu) { + Collapse[SETTINGS.autocollapse ? "Enable" : "Disable"](true,true); + MathJax.Menu.saveCookie(); + }; + var ITEM = MathJax.Menu.ITEM, + MENU = MathJax.Menu.menu; + var menu = ITEM.CHECKBOX( + ['AutoCollapse','Auto Collapse'], 'autocollapse', {action: Switch} + ); + var submenu = (MENU.FindId('Accessibility')||{}).submenu, index; + if (submenu) { + index = submenu.IndexOfId('AutoCollapse'); + if (index !== null) { + submenu.items[index] = menu; + } else { + index = submenu.IndexOfId('CollapsibleMath'); + submenu.items.splice(index+1,0,menu); + } + } else { + index = MENU.IndexOfId('CollapsibleMath'); + MENU.items.splice(index+1,0,menu); + } + var init = function () {Collapse[SETTINGS.autocollapse ? "Enable" : "Disable"]()}; + if (MathJax.Extension.collapse) init(); + else MathJax.Hub.Register.StartupHook("Auto Collapse Ready", init); + },25); // after Assistive-Explore + },25); + +})(MathJax.Hub); + + +/*****************************************************************/ +/* + * Add methods to the ElementJax and OutputJax to get the + * widths of the collapsed elements. + */ + +// +// Add SRE methods to ElementJax. +// +MathJax.ElementJax.Augment({ + sreGetMetrics: function () { + MathJax.OutputJax[this.outputJax].sreGetMetrics(this,this.root.SRE); + }, + sreGetRootWidth: function (state) { + return MathJax.OutputJax[this.outputJax].sreGetRootWidth(this,state); + }, + sreGetActionWidth: function (state,action) { + return MathJax.OutputJax[this.outputJax].sreGetActionWidth(this,state,action); + } +}); + +// +// Add default methods to base OutputJax class. +// +MathJax.OutputJax.Augment({ + getMetrics: function () {}, // make sure it is defined + sreGetMetrics: function (jax,SRE) {SRE.cwidth = 1000000; SRE.width = 0; SRE.em = 12}, + sreGetRootWidth: function (jax,state) {return 0}, + sreGetActionWidth: function (jax,state,action) {return 0} +}); + +// +// Specific implementations for HTML-CSS output. +// +MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { + MathJax.OutputJax["HTML-CSS"].Augment({ + sreGetMetrics: function (jax,SRE) { + SRE.width = jax.root.data[0].HTMLspanElement().parentNode.bbox.w; + SRE.em = 1 / jax.HTMLCSS.em / jax.HTMLCSS.scale; + }, + sreGetRootWidth: function (jax,state) { + var html = jax.root.data[0].HTMLspanElement(); + state.box = html.parentNode; + return state.box.bbox.w; + }, + sreGetActionWidth: function (jax,state,action) { + return jax.root.data[0].toHTML(state.box).bbox.w; + } + }); +}); + +// +// Specific implementations for SVG output. +// +MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { + MathJax.OutputJax.SVG.Augment({ + getMetrics: function (jax) { + this.em = MathJax.ElementJax.mml.mbase.prototype.em = jax.SVG.em; this.ex = jax.SVG.ex; + this.linebreakWidth = jax.SVG.lineWidth; this.cwidth = jax.SVG.cwidth; + }, + sreGetMetrics: function (jax,SRE) { + SRE.width = jax.root.SVGdata.w/1000; + SRE.em = 1/jax.SVG.em; + }, + sreGetRootWidth: function (jax,state) { + state.span = document.getElementById(jax.inputID+"-Frame"); + return jax.root.SVGdata.w/1000; + }, + sreGetActionWidth: function (jax,state,action) { + this.mathDiv = state.span; + state.span.appendChild(this.textSVG); + try {var svg = jax.root.data[0].toSVG()} catch(err) {var error = err} + state.span.removeChild(this.textSVG); + if (error) throw error; // can happen when a restart is needed + return jax.root.data[0].SVGdata.w/1000; + } + }); +}); + +// +// Specific implementations for CommonHTML output. +// +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + MathJax.OutputJax.CommonHTML.Augment({ + sreGetMetrics: function (jax,SRE) { + SRE.width = jax.root.CHTML.w; + SRE.em = 1 / jax.CHTML.em / jax.CHTML.scale; + }, + sreGetRootWidth: function (jax,state) { + state.span = document.getElementById(jax.inputID+"-Frame").firstChild; + state.tmp = document.createElement("span"); + state.tmp.className = state.span.className; + return jax.root.CHTML.w / jax.CHTML.scale; + }, + sreGetActionWidth: function (jax,state,action) { + state.span.parentNode.replaceChild(state.tmp,state.span); + MathJax.OutputJax.CommonHTML.CHTMLnode = state.tmp; + try {jax.root.data[0].toCommonHTML(state.tmp)} catch (err) {var error = err} + state.tmp.parentNode.replaceChild(state.span,state.tmp); + if (error) throw error; // can happen when a restart is needed + return jax.root.data[0].CHTML.w / jax.CHTML.scale; + } + }); +}); + +// +// Specific implementations for NativeMML output. +// +MathJax.Hub.Register.StartupHook("NativeMML Jax Ready",function () { + MathJax.OutputJax.NativeMML.Augment({ + sreGetMetrics: function (jax,SRE) { + var span = document.getElementById(jax.inputID+"-Frame"); + SRE.width = span.offsetWidth; + SRE.em = 1; SRE.DOMupdate = true; + }, + sreGetRootWidth: function (jax,state) { + state.span = document.getElementById(jax.inputID+"-Frame").firstChild; + return state.span.offsetWidth; + }, + sreGetActionWidth: function (jax,state,action) { + var maction = document.getElementById(action.id); + maction.setAttribute("selection",1); + var w = state.span.offsetWidth; + return w; + } + }); +}); + + +/*****************************************************************/ + +// +// Load the collapsible extension and +// signal the start up when that has loaded. +// +MathJax.Ajax.Require("[a11y]/collapsible.js"); +MathJax.Hub.Register.StartupHook("Collapsible Ready", function () { + MathJax.Extension["auto-collapse"].Startup(); // Initialize the collapsing process + MathJax.Hub.Startup.signal.Post("Auto Collapse Ready"); + MathJax.Ajax.loadComplete("[a11y]/auto-collapse.js"); +}); + +// @license-end diff --git a/js/mathjax/extensions/a11y/collapsible.js b/js/mathjax/extensions/a11y/collapsible.js new file mode 100644 index 0000000..cc396f6 --- /dev/null +++ b/js/mathjax/extensions/a11y/collapsible.js @@ -0,0 +1,743 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * [Contrib]/a11y/collapsible.js + * + * A filter to add maction elements to the enriched MathML for parts that + * can be collapsed. We determine this based on a "complexity" value and + * collapse those terms that exceed a given complexity. + * + * The parameters controlling the complexity measure still need work. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2016-2017 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB) { + var MML; + + var SETTINGS = HUB.config.menuSettings; + var COOKIE = {}; // replaced when menu is available + + var NOCOLLAPSE = 10000000; // really big complexity + var COMPLEXATTR = "data-semantic-complexity"; + + // + // Set up the a11y path,if it isn't already in place + // + var PATH = MathJax.Ajax.config.path; + if (!PATH.a11y) PATH.a11y = HUB.config.root + "/extensions/a11y"; + + var Collapsible = MathJax.Extension.collapsible = { + version: "1.6.0", + config: HUB.CombineConfig("collapsible",{ + disabled: false + }), + dependents: [], // the extensions that depend on this one + COMPLEXATTR: COMPLEXATTR, // attribute name for the complexity value + + /*****************************************************************/ + + // + // Complexity values to use for different structures + // + COMPLEXITY: { + TEXT: .5, // each character of a token element adds this to complexity + TOKEN: .5, // each toekn element gets this additional complexity + CHILD: 1, // child nodes add this to their parent node's complexity + + SCRIPT: .8, // script elements reduce their complexity by this factor + SQRT: 2, // sqrt adds this extra complexity + SUBSUP: 2, // sub-sup adds this extra complexity + UNDEROVER: 2, // under-over adds this extra complexity + FRACTION: 2, // fractions add this extra complexity + ACTION: 2, // maction adds this extra complexity + PHANTOM: 0, // mphantom makes complexity 0? + XML: 2, // Can't really measure complexity of annotation-xml, so punt + GLYPH: 2 // Can't really measure complexity of mglyph, to punt + }, + // + // These are the cut-off complexity values for when + // the structure should collapse + // + COLLAPSE: { + identifier: 3, + number: 3, + text: 10, + infixop: 15, + relseq: 15, + multirel: 15, + fenced: 18, + bigop: 20, + integral: 20, + fraction: 12, + sqrt: 9, + root: 12, + vector: 15, + matrix: 15, + cases: 15, + superscript: 9, + subscript: 9, + subsup: 9, + punctuated: { + endpunct: NOCOLLAPSE, + startpunct: NOCOLLAPSE, + value: 12 + } + }, + // + // These are the characters to use for the various collapsed elements + // (if an object, then semantic-role is used to get the character + // from the object) + // + MARKER: { + identifier: "x", + number: "#", + text: "...", + appl: { + "limit function": "lim", + value: "f()" + }, + fraction: "/", + sqrt: "\u221A", + root: "\u221A", + superscript: "\u25FD\u02D9", + subscript: "\u25FD.", + subsup:"\u25FD:", + vector: { + binomial: "(:)", + determinant: "|:|", + value: "\u27E8:\u27E9" + }, + matrix: { + squarematrix: "[::]", + rowvector: "\u27E8\u22EF\u27E9", + columnvector: "\u27E8\u22EE\u27E9", + determinant: "|::|", + value: "(::)" + }, + cases: "{:", + infixop: { + addition: "+", + subtraction: "\u2212", + multiplication: "\u22C5", + implicit: "\u22C5", + value: "+" + }, + punctuated: { + text: "...", + value: "," + } + }, + + /*****************************************************************/ + + Enable: function (update,menu) { + SETTINGS.collapsible = true; + if (menu) COOKIE.collapsible = true; + this.config.disabled = false; + MathJax.Extension["semantic-enrich"].Enable(false,menu); + if (update) HUB.Queue(["Reprocess",HUB]); + }, + Disable: function (update,menu) { + SETTINGS.collapsible = false; + if (menu) COOKIE.collapsible = false; + this.config.disabled = true; + for (var i = this.dependents.length-1; i >= 0; i--) { + var dependent = this.dependents[i]; + if (dependent.Disable) dependent.Disable(false,menu); + } + if (update) HUB.Queue(["Reprocess",HUB]); + }, + + // + // Register a dependent + // + Dependent: function (extension) { + this.dependents.push(extension); + }, + + Startup: function () { + MML = MathJax.ElementJax.mml; + // + // Inform semantic-enrich extension that we are a dependent + // + var Enrich = MathJax.Extension["semantic-enrich"]; + if (Enrich) Enrich.Dependent(this); + // + // Add the filter into the post-input hooks (priority 100, so other + // hooks run first, in particular, the enrichment hook). + // + HUB.postInputHooks.Add(["Filter",Collapsible],100); + }, + + // + // The main filter: add mactions for collapsing the math. + // + Filter: function (jax,id,script) { + if (!jax.enriched || this.config.disabled) return; + jax.root = jax.root.Collapse(); + jax.root.inputID = script.id; + }, + + /*****************************************************************/ + + // + // Create a marker from a given string of characters + // (several possibilities are commented out) + // +// Marker: function (c) {return MML.mtext("\u25C3"+c+"\u25B9").With({mathcolor:"blue",attr:{},attrNames:[]})}, +// Marker: function (c) {return MML.mtext("\u25B9"+c+"\u25C3").With({mathcolor:"blue",attr:{},attrNames:[]})}, + Marker: function (c) {return MML.mtext("\u25C2"+c+"\u25B8").With({mathcolor:"blue",attr:{},attrNames:[]})}, +// Marker: function (c) {return MML.mtext("\u25B8"+c+"\u25C2").With({mathcolor:"blue",attr:{},attrNames:[]})}, +// Marker: function (c) {return MML.mtext("\u27EA"+c+"\u27EB").With({mathcolor:"blue",attr:{},attrNames:[]})}, + + + + /*****************************************************************/ + + // + // Make a collapsible element using maction that contains + // an appropriate marker, and the expanded MathML. + // If the MathML is a node, make an mrow to use instead, + // and move the semantic data to it (I guess it would have been + // easier to have had that done initially, oh well). + // + MakeAction: function (collapse,mml) { + var maction = MML.maction(collapse).With({ + id:this.getActionID(), actiontype:"toggle", + complexity:collapse.getComplexity(), collapsible:true, + attrNames:["id","actiontype","selection",COMPLEXATTR], attr:{}, selection:2 + }); + maction.attr[COMPLEXATTR] = maction.complexity; + if (mml.type === "math") { + var mrow = MML.mrow().With({ + complexity: mml.complexity, + attrNames: [], attr: {} + }); + mrow.Append.apply(mrow,mml.data[0].data); mml.data[0].data = []; + for (var i = mml.attrNames.length-1, name; name = mml.attrNames[i]; i--) { + if (name.substr(0,14) === "data-semantic-") { + mrow.attr[name] = mml.attr[name]; + mrow.attrNames.push(name); + delete mml.attr[name]; + mml.attrNames.splice(i,1); + } + } + mrow.complexity = mml.complexity; + maction.Append(mrow); mml.Append(maction); + mml.complexity = maction.complexity; maction = mml; + } else { + maction.Append(mml); + } + return maction; + }, + + actionID: 1, + getActionID: function () {return "MJX-Collapse-"+this.actionID++}, + + /*****************************************************************/ + + // + // If there is a specific routine for the type, do that, otherwise + // check if there is a complexity cut-off and marker for this type. + // If so, check if the complexity exceeds the cut off, and + // collapse using the appropriate marker for the type + // Return the (possibly modified) MathML + // + Collapse: function (mml) { + mml.getComplexity(); + var type = (mml.attr||{})["data-semantic-type"]; + if (type) { + if (this["Collapse_"+type]) mml = (this["Collapse_"+type])(mml); + else if (this.COLLAPSE[type] && this.MARKER[type]) { + var role = mml.attr["data-semantic-role"]; + var complexity = this.COLLAPSE[type]; + if (typeof(complexity) !== "number") complexity = complexity[role] || complexity.value; + if (mml.complexity > complexity) { + var marker = this.MARKER[type]; + if (typeof(marker) !== "string") marker = marker[role] || marker.value; + mml = this.MakeAction(this.Marker(marker),mml); + } + } + } + return mml; + }, + + // + // If a parent is going to be collapsible, if can call this + // to put back a collapsed child (rather than have too many + // nested collapsings) + // + UncollapseChild: function (mml,n,m) { + if (m == null) m = 1; + if (this.SplitAttribute(mml,"children").length === m) { + var child = (mml.data.length === 1 && mml.data[0].inferred ? mml.data[0] : mml); + if (child && child.data[n] && child.data[n].collapsible) { + child.SetData(n,child.data[n].data[1]); + mml.complexity = child.complexity = null; mml.getComplexity(); + return 1; + } + } + return 0; + }, + + // + // Locate child node and return its text + // + FindChildText: function (mml,id) { + var child = this.FindChild(mml,id); + return (child ? (child.CoreMO()||child).data.join("") : "?"); + }, + FindChild: function (mml,id) { + if (mml) { + if (mml.attr && mml.attr["data-semantic-id"] === id) return mml; + if (!mml.isToken) { + for (var i = 0, m = mml.data.length; i < m; i++) { + var child = this.FindChild(mml.data[i],id); + if (child) return child; + } + } + } + return null; + }, + + // + // Split a data attribute at commas + // + SplitAttribute: function (mml,id) { + return (mml.attr["data-semantic-"+id]||"").split(/,/); + }, + + /*****************************************************************/ + /* + * These routines implement the collapsing of the various semantic types + */ + + // + // For fenced elements, if the contents are collapsed, + // collapse the fence instead. + // + Collapse_fenced: function (mml) { + this.UncollapseChild(mml,1); + if (mml.complexity > this.COLLAPSE.fenced) { + if (mml.attr["data-semantic-role"] === "leftright") { + var marker = mml.data[0].data.join("") + mml.data[mml.data.length-1].data.join(""); + mml = this.MakeAction(this.Marker(marker),mml); + } + } + return mml; + }, + + // + // Collapse function applications if the argument is collapsed + // (Handle role="limit function" a bit better?) + // + Collapse_appl: function (mml) { + if (this.UncollapseChild(mml,2,2)) { + var marker = this.MARKER.appl; + marker = marker[mml.attr["data-semantic-role"]] || marker.value; + mml = this.MakeAction(this.Marker(marker),mml); + } + return mml; + }, + + // + // For sqrt elements, if the contents are collapsed, + // collapse the sqrt instead. + // + Collapse_sqrt: function (mml) { + this.UncollapseChild(mml,0); + if (mml.complexity > this.COLLAPSE.sqrt) + mml = this.MakeAction(this.Marker(this.MARKER.sqrt),mml); + return mml; + }, + Collapse_root: function (mml) { + this.UncollapseChild(mml,0); + if (mml.complexity > this.COLLAPSE.sqrt) + mml = this.MakeAction(this.Marker(this.MARKER.sqrt),mml); + return mml; + }, + + // + // For enclose, include enclosure in collapsed child, if any + // + Collapse_enclose: function (mml) { + if (this.SplitAttribute(mml,"children").length === 1) { + var child = (mml.data.length === 1 && mml.data[0].inferred ? mml.data[0] : mml); + if (child.data[0] && child.data[0].collapsible) { + // + // Move menclose into the maction element + // + var maction = child.data[0]; + child.SetData(0,maction.data[1]); + maction.SetData(1,mml); + mml = maction; + } + } + return mml; + }, + + // + // For bigops, get the character to use from the largeop at its core. + // + Collapse_bigop: function (mml) { + if (mml.complexity > this.COLLAPSE.bigop || mml.data[0].type !== "mo") { + var id = this.SplitAttribute(mml,"content").pop(); + var op = Collapsible.FindChildText(mml,id); + mml = this.MakeAction(this.Marker(op),mml); + } + return mml; + }, + Collapse_integral: function (mml) { + if (mml.complexity > this.COLLAPSE.integral || mml.data[0].type !== "mo") { + var id = this.SplitAttribute(mml,"content")[0]; + var op = Collapsible.FindChildText(mml,id); + mml = this.MakeAction(this.Marker(op),mml); + } + return mml; + }, + + // + // For multirel and relseq, use proper symbol + // + Collapse_relseq: function (mml) { + if (mml.complexity > this.COLLAPSE.relseq) { + var content = this.SplitAttribute(mml,"content"); + var marker = Collapsible.FindChildText(mml,content[0]); + if (content.length > 1) marker += "\u22EF"; + mml = this.MakeAction(this.Marker(marker),mml); + } + return mml; + }, + Collapse_multirel: function (mml) { + if (mml.complexity > this.COLLAPSE.multirel) { + var content = this.SplitAttribute(mml,"content"); + var marker = Collapsible.FindChildText(mml,content[0]) + "\u22EF"; + mml = this.MakeAction(this.Marker(marker),mml); + } + return mml; + }, + + // + // Include super- and subscripts into a collapsed base + // + Collapse_superscript: function (mml) { + this.UncollapseChild(mml,0,2); + if (mml.complexity > this.COLLAPSE.superscript) + mml = this.MakeAction(this.Marker(this.MARKER.superscript),mml); + return mml; + }, + Collapse_subscript: function (mml) { + this.UncollapseChild(mml,0,2); + if (mml.complexity > this.COLLAPSE.subscript) + mml = this.MakeAction(this.Marker(this.MARKER.subscript),mml); + return mml; + }, + Collapse_subsup: function (mml) { + this.UncollapseChild(mml,0,3); + if (mml.complexity > this.COLLAPSE.subsup) + mml = this.MakeAction(this.Marker(this.MARKER.subsup),mml); + return mml; + } + }; + + HUB.Register.StartupHook("End Extensions", function () { + if (SETTINGS.collapsible == null) { + SETTINGS.collapsible = !Collapsible.config.disabled; + } else { + Collapsible.config.disabled = !SETTINGS.collapsible; + } + HUB.Register.StartupHook("MathMenu Ready", function () { + COOKIE = MathJax.Menu.cookie; + var Switch = function(menu) { + Collapsible[SETTINGS.collapsible ? "Enable" : "Disable"](true,true); + MathJax.Menu.saveCookie(); + }; + var ITEM = MathJax.Menu.ITEM, + MENU = MathJax.Menu.menu; + var menu = ITEM.CHECKBOX( + ['CollapsibleMath','Collapsible Math'], 'collapsible', {action: Switch} + ); + var submenu = (MENU.FindId('Accessibility')||{}).submenu, index; + if (submenu) { + index = submenu.IndexOfId('CollapsibleMath'); + if (index !== null) { + submenu.items[index] = menu; + } else { + submenu.items.push(ITEM.RULE(),menu); + } + } else { + index = MENU.IndexOfId('About'); + MENU.items.splice(index,0,menu,ITEM.RULE()); + } + },15); // before explorer extension + },15); + +})(MathJax.Hub); + + +/*****************************************************************/ +/* + * Add Collapse() and getComplexity() methods to the internal + * MathML elements, and override these in the elements that need + * special handling. + */ + +MathJax.Ajax.Require("[a11y]/semantic-enrich.js"); +MathJax.Hub.Register.StartupHook("Semantic Enrich Ready", function () { + var MML = MathJax.ElementJax.mml, + Collapsible = MathJax.Extension.collapsible, + COMPLEXITY = Collapsible.COMPLEXITY, + COMPLEXATTR = Collapsible.COMPLEXATTR; + + Collapsible.Startup(); // Initialize the collapsing process + + MML.mbase.Augment({ + // + // Just call the Collapse() method from the extension by default + // (but can be overridden) + // + Collapse: function () {return Collapsible.Collapse(this)}, + // + // If we don't have a cached complexity value, + // For token elements, just use the data length, + // Otherwise + // Add up the complexities of the (collapsed) children + // and add the child complexity based on the number of children + // Cache the complexity result + // return the complexity + // + getComplexity: function () { + if (this.complexity == null) { + var complexity = 0; + if (this.isToken) { + complexity = COMPLEXITY.TEXT * this.data.join("").length + COMPLEXITY.TOKEN; + } else { + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) { + this.SetData(i,this.data[i].Collapse()); + complexity += this.data[i].complexity; + } + } + if (m > 1) complexity += m * COMPLEXITY.CHILD; + } + if (this.attrNames && !("complexity" in this)) this.attrNames.push(COMPLEXATTR); + if (this.attr) this.attr[COMPLEXATTR] = complexity; + this.complexity = complexity; + } + return this.complexity; + }, + reportComplexity: function () { + if (this.attr && this.attrNames && !(COMPLEXATTR in this.attr)) { + this.attrNames.push(COMPLEXATTR); + this.attr[COMPLEXATTR] = this.complexity; + } + } + }); + + // + // For fractions, scale the complexity of the parts, and add + // a complexity for fractions. + // + MML.mfrac.Augment({ + getComplexity: function () { + if (this.complexity == null) { + this.SUPER(arguments).getComplexity.call(this); + this.complexity *= COMPLEXITY.SCRIPT; + this.complexity += COMPLEXITY.FRACTION; + this.attr[COMPLEXATTR] = this.complexity; + } + return this.complexity; + } + }); + + // + // Square roots add extra complexity + // + MML.msqrt.Augment({ + getComplexity: function () { + if (this.complexity == null) { + this.SUPER(arguments).getComplexity.call(this); + this.complexity += COMPLEXITY.SQRT; + this.attr[COMPLEXATTR] = this.complexity; + } + return this.complexity; + } + }); + MML.mroot.Augment({ + getComplexity: function () { + if (this.complexity == null) { + this.SUPER(arguments).getComplexity.call(this); + this.complexity -= (1-COMPLEXITY.SCRIPT) * this.data[1].getComplexity(); + this.complexity += COMPLEXITY.SQRT; + this.attr[COMPLEXATTR] = this.complexity; + } + return this.complexity; + } + }); + + // + // For msubsup, use the script complexity factor, + // take the maximum of the scripts, + // and add the sub-sup complexity + // + MML.msubsup.Augment({ + getComplexity: function () { + if (this.complexity == null) { + var C = 0; + if (this.data[this.sub]) C = this.data[this.sub].getComplexity() + COMPLEXITY.CHILD; + if (this.data[this.sup]) C = Math.max(this.data[this.sup].getComplexity(),C); + C *= COMPLEXITY.SCRIPT; + if (this.data[this.sub]) C += COMPLEXITY.CHILD; + if (this.data[this.sup]) C += COMPLEXITY.CHILD; + if (this.data[this.base]) C += this.data[this.base].getComplexity() + COMPLEXITY.CHILD; + this.complexity = C + COMPLEXITY.SUBSUP; + this.reportComplexity(); + } + return this.complexity; + } + }); + + // + // For munderover, use the script complexity factor, + // take the maximum of the scripts and the base, + // and add the under-over complexity + // + MML.munderover.Augment({ + getComplexity: function () { + if (this.complexity == null) { + var C = 0; + if (this.data[this.sub]) C = this.data[this.sub].getComplexity() + COMPLEXITY.CHILD; + if (this.data[this.sup]) C = Math.max(this.data[this.sup].getComplexity(),C); + C *= COMPLEXITY.SCRIPT; + if (this.data[this.base]) C = Math.max(this.data[this.base].getComplexity(),C); + if (this.data[this.sub]) C += COMPLEXITY.CHILD; + if (this.data[this.sup]) C += COMPLEXITY.CHILD; + if (this.data[this.base]) C += COMPLEXITY.CHILD; + this.complexity = C + COMPLEXITY.UNDEROVER; + this.reportComplexity(); + } + return this.complexity; + } + }); + + // + // For mphantom, complexity is 0? + // + MML.mphantom.Augment({ + getComplexity: function () { + this.complexity = COMPLEXITY.PHANTOM; + this.reportComplexity(); + return this.complexity; + } + }); + + // + // For ms, add width of quotes. Don't cache the result, since + // mstyle above it could affect the result. + // + MML.ms.Augment({ + getComplexity: function () { + this.SUPER(arguments).getComplexity.call(this); + this.complexity += this.Get("lquote").length * COMPLEXITY.TEXT; + this.complexity += this.Get("rquote").length * COMPLEXITY.TEXT; + this.attr[COMPLEXATTR] = this.complexity; + return this.complexity; + } + }); + +// ### FIXME: getComplexity special cases: +// mtable, mfenced, mmultiscript + + // + // For menclose, complexity goes up by a fixed amount + // + MML.menclose.Augment({ + getComplexity: function () { + if (this.complexity == null) { + this.SUPER(arguments).getComplexity.call(this); + this.complexity += COMPLEXITY.ACTION; + this.attr[COMPLEXATTR] = this.complexity; + } + return this.complexity; + } + }); + + // + // For maction, complexity is complexity of selected element + // + MML.maction.Augment({ + getComplexity: function () { + // + // Don't cache it, since selection can change. + // + this.complexity = (this.collapsible ? this.data[0] : this.selected()).getComplexity(); + this.reportComplexity(); + return this.complexity; + } + }); + + // + // For semantics, complexity is complexity of first child + // + MML.semantics.Augment({ + getComplexity: function () { + if (this.complexity == null) { + this.complexity = (this.data[0] ? this.data[0].getComplexity() : 0); + this.reportComplexity(); + } + return this.complexity; + } + }); + + // + // Use fixed complexity, since we can't really measure it + // + MML["annotation-xml"].Augment({ + getComplexity: function () { + this.complexity = COMPLEXITY.XML; + this.reportComplexity(); + return this.complexity; + } + }); + MML.annotation.Augment({ + getComplexity: function () { + this.complexity = COMPLEXITY.XML; + this.reportComplexity(); + return this.complexity; + } + }); + + // + // Use fixed complexity, since we can't really measure it + // + MML.mglyph.Augment({ + getComplexity: function () { + this.complexity = COMPLEXITY.GLYPH; + this.reportComplexity(); + return this.complexity; + } + }); + + // + // Signal that we are ready + // + MathJax.Hub.Startup.signal.Post("Collapsible Ready"); + MathJax.Ajax.loadComplete("[a11y]/collapsible.js"); +}); + +// @license-end diff --git a/js/mathjax/extensions/a11y/explorer.js b/js/mathjax/extensions/a11y/explorer.js new file mode 100644 index 0000000..bba3edd --- /dev/null +++ b/js/mathjax/extensions/a11y/explorer.js @@ -0,0 +1,827 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * [Contrib]/a11y/explorer.js + * + * Implements expression exploration via the SRE explorer. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2016-2017 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook('Sre Ready', function() { + var FALSE, KEY; + var SETTINGS = MathJax.Hub.config.menuSettings; + var COOKIE = {}; // replaced when menu is available + + MathJax.Hub.Register.StartupHook('MathEvents Ready', function() { + FALSE = MathJax.Extension.MathEvents.Event.False; + KEY = MathJax.Extension.MathEvents.Event.KEY; + }); + + var Assistive = MathJax.Extension.explorer = { + version: '1.6.0', + dependents: [], // the extensions that depend on this one + // + // Default configurations. + // + defaults: { + walker: 'table', + highlight: 'none', + background: 'blue', + foreground: 'black', + speech: true, + generation: 'lazy', + subtitle: false, + ruleset: 'mathspeak-default' + }, + eagerComplexity: 80, + prefix: 'Assistive-', + hook: null, + locHook: null, + oldrules: null, + addMenuOption: function(key, value) { + SETTINGS[Assistive.prefix + key] = value; + }, + + addDefaults: function() { + var defaults = MathJax.Hub.CombineConfig('explorer', Assistive.defaults); + var keys = Object.keys(defaults); + for (var i = 0, key; key = keys[i]; i++) { + if (typeof(SETTINGS[Assistive.prefix + key]) === 'undefined') { + Assistive.addMenuOption(key, defaults[key]); + } + } + Assistive.setSpeechOption(); + Explorer.Reset(); + }, + + setOption: function(key, value) { + if (SETTINGS[Assistive.prefix + key] === value) return; + Assistive.addMenuOption(key, value); + Explorer.Reset(); + }, + + getOption: function(key) { + return SETTINGS[Assistive.prefix + key]; + }, + + speechOption: function(msg) { + if (Assistive.oldrules === msg.value) return; + Assistive.setSpeechOption(); + Explorer.Regenerate(); + }, + + setSpeechOption: function() { + var ruleset = SETTINGS[Assistive.prefix + 'ruleset']; + var cstr = ruleset.split('-'); + sre.System.getInstance().setupEngine({ + locale: MathJax.Localization.locale, + domain: Assistive.Domain(cstr[0]), + style: cstr[1] + }); + Assistive.oldrules = ruleset; + }, + + Domain: function(domain) { + switch (domain) { + case 'chromevox': + return 'default'; + case 'clearspeak': + return 'clearspeak'; + case 'mathspeak': + default: + return 'mathspeak'; + } + }, + + hook: null, + locHook: null, + Enable: function(update, menu) { + SETTINGS.explorer = true; + if (menu) COOKIE.explorer = true; + MathJax.Extension.collapsible.Enable(false, menu); + if (MathJax.Extension.AssistiveMML) { + MathJax.Extension.AssistiveMML.config.disabled = true; + SETTINGS.assistiveMML = false; + if (menu) COOKIE.assistiveMML = false; + } + this.DisableMenus(false); + if (!this.hook) { + this.hook = MathJax.Hub.Register.MessageHook( + 'New Math', ['Register', this.Explorer]); + } + if (!this.locHook) { + this.locHook = MathJax.Hub.Register.MessageHook( + 'Locale Reset', ['RemoveSpeech', this.Explorer]); + } + if (update) MathJax.Hub.Queue(['Reprocess', MathJax.Hub]); + }, + Disable: function(update, menu) { + SETTINGS.explorer = false; + if (menu) COOKIE.explorer = false; + this.DisableMenus(true); + if (this.hook) { + MathJax.Hub.UnRegister.MessageHook(this.hook); + this.hook = null; + } + for (var i = this.dependents.length - 1; i >= 0; i--) { + var dependent = this.dependents[i]; + if (dependent.Disable) dependent.Disable(false, menu); + } + // Reprocess on update? I don't think it is necessary + // (now that we check for being enabled in the event handlers) + }, + DisableMenus: function(state) { + if (MathJax.Menu) { + var menu = MathJax.Menu.menu.FindId('Accessibility', 'Explorer'); + if (menu) { + menu = menu.submenu; + var items = menu.items; + for (var i = 2, item; item = items[i]; i++) item.disabled = state; + if (!state && menu.FindId('SpeechOutput') && !SETTINGS[Assistive.prefix + 'speech']) { + menu.FindId('Subtitles').disabled = true; + } + } + } + }, + // + // Register a dependent + // + Dependent: function(extension) { + this.dependents.push(extension); + } + }; + + var LiveRegion = MathJax.Object.Subclass({ + div: null, + inner: null, + Init: function() { + this.div = LiveRegion.Create('assertive'); + this.inner = MathJax.HTML.addElement(this.div, 'div'); + }, + // + // Adds the speech div. + // + Add: function() { + if (LiveRegion.added) return; + document.body.appendChild(this.div); + LiveRegion.added = true; + }, + // + // Shows the live region as a subtitle of a node. + // + Show: function(node, highlighter) { + this.div.classList.add('MJX_LiveRegion_Show'); + var rect = node.getBoundingClientRect(); + var bot = rect.bottom + 10 + window.pageYOffset; + var left = rect.left + window.pageXOffset; + this.div.style.top = bot + 'px'; + this.div.style.left = left + 'px'; + var color = highlighter.colorString(); + this.inner.style.backgroundColor = color.background; + this.inner.style.color = color.foreground; + }, + // + // Takes the live region out of the page flow. + // + Hide: function(node) { + this.div.classList.remove('MJX_LiveRegion_Show'); + }, + // + // Clears the speech div. + // + Clear: function() { + this.Update(''); + this.inner.style.top = ''; + this.inner.style.backgroundColor = ''; + }, + // + // Speaks a string by poking it into the speech div. + // + Update: function(speech) { + if (Assistive.getOption('speech')) { + LiveRegion.Update(this.inner, speech); + } + } + }, { + ANNOUNCE: 'Navigatable Math in page. Explore with enter or shift space and arrow' + + ' keys. Expand or collapse elements hitting enter.', + announced: false, + added: false, + styles: {'.MJX_LiveRegion': + { + position: 'absolute', top: '0', height: '1px', width: '1px', + padding: '1px', overflow: 'hidden' + }, + '.MJX_LiveRegion_Show': + { + top: '0', position: 'absolute', width: 'auto', height: 'auto', + padding: '0px 0px', opacity: 1, 'z-index': '202', + left: 0, right: 0, 'margin': '0 auto', + 'background-color': 'white', 'box-shadow': '0px 10px 20px #888', + border: '2px solid #CCCCCC' + } + }, + // + // Creates a live region with a particular type. + // + Create: function(type) { + var element = MathJax.HTML.Element( + 'div', {className: 'MJX_LiveRegion'}); + element.setAttribute('aria-live', type); + return element; + }, + // + // Updates a live region's text content. + // + Update: MathJax.Hub.Browser.isPC ? + function(div, speech) { + div.textContent = ''; + setTimeout(function() {div.textContent = speech;}, 100); + } : function(div, speech) { + div.textContent = ''; + div.textContent = speech; + }, + // + // Speaks the announce string. + // + Announce: function() { + if (!Assistive.getOption('speech')) return; + LiveRegion.announced = true; + MathJax.Ajax.Styles(LiveRegion.styles); + var div = LiveRegion.Create('polite'); + document.body.appendChild(div); + LiveRegion.Update(div, LiveRegion.ANNOUNCE); + setTimeout(function() {document.body.removeChild(div);}, 1000); + } + }); + MathJax.Extension.explorer.LiveRegion = LiveRegion; + + var A11Y_PATH = MathJax.Ajax.fileURL(MathJax.Ajax.config.path.a11y); + + var Explorer = MathJax.Extension.explorer.Explorer = { + liveRegion: LiveRegion(), + walker: null, + highlighter: null, + hoverer: null, + flamer: null, + speechDiv: null, + earconFile: A11Y_PATH + '/invalid_keypress' + + (['Firefox', 'Chrome', 'Opera'].indexOf(MathJax.Hub.Browser.name) !== -1 ? + '.ogg' : '.mp3'), + expanded: false, + focusoutEvent: MathJax.Hub.Browser.isFirefox ? 'blur' : 'focusout', + focusinEvent: 'focus', + ignoreFocusOut: false, + jaxCache: {}, + messageID: null, + // + // Resets the explorer, rerunning methods not triggered by events. + // + Reset: function() { + Explorer.FlameEnriched(); + }, + // + // Registers new Maths and adds a key event if it is enriched. + // + Register: function(msg) { + if (!Assistive.hook) return; + var script = document.getElementById(msg[1]); + if (script && script.id) { + var jax = MathJax.Hub.getJaxFor(script.id); + if (jax && jax.enriched) { + Explorer.StateChange(script.id, jax); + Explorer.liveRegion.Add(); + Explorer.AddEvent(script); + } + } + }, + StateChange: function(id, jax) { + Explorer.GetHighlighter(.2); + var oldJax = Explorer.jaxCache[id]; + if (oldJax && oldJax === jax.root) return; + if (oldJax) { + sre.Walker.resetState(id + '-Frame'); + } + Explorer.jaxCache[id] = jax.root; + }, + // + // Adds Aria attributes. + // + AddAria: function(math) { + math.setAttribute('role', 'application'); + math.setAttribute('aria-label', 'Math'); + }, + // + // Add hook to run at End Math to restart walking on an expansion element. + // + AddHook: function(jax) { + Explorer.RemoveHook(); + Explorer.hook = MathJax.Hub.Register.MessageHook( + 'End Math', function(message) { + var newid = message[1].id + '-Frame'; + var math = document.getElementById(newid); + if (jax && newid === Explorer.expanded) { + Explorer.ActivateWalker(math, jax); + math.focus(); + Explorer.expanded = false; + } + }); + }, + // + // Remove and unregister the explorer hook. + // + RemoveHook: function() { + if (Explorer.hook) { + MathJax.Hub.UnRegister.MessageHook(Explorer.hook); + Explorer.hook = null; + } + }, + AddMessage: function() { + return MathJax.Message.Set('Generating Speech Output'); + }, + RemoveMessage: function(id) { + if (id) MathJax.Message.Clear(id); + }, + // + // Adds a key event to an enriched jax. + // + AddEvent: function(script) { + var id = script.id + '-Frame'; + var sibling = script.previousSibling; + if (!sibling) return; + var math = sibling.id !== id ? sibling.firstElementChild : sibling; + Explorer.AddAria(math); + Explorer.AddMouseEvents(math); + if (math.className === 'MathJax_MathML') { + math = math.firstElementChild; + } + if (!math) return; + math.onkeydown = Explorer.Keydown; + Explorer.Flame(math); + math.addEventListener( + Explorer.focusinEvent, + function(event) { + if (!Assistive.hook) return; + if (!LiveRegion.announced) LiveRegion.Announce(); + }); + math.addEventListener( + Explorer.focusoutEvent, + function(event) { + if (!Assistive.hook) return; + // A fix for Edge. + if (Explorer.ignoreFocusOut) { + Explorer.ignoreFocusOut = false; + if (Explorer.walker.moved === 'enter') { + event.target.focus(); + return; + } + } + if (Explorer.walker) Explorer.DeactivateWalker(); + }); + // + if (Assistive.getOption('speech')) { + Explorer.AddSpeech(math); + } + // + }, + // + // Add speech output. + // + AddSpeech: function(math) { + var id = math.id; + var jax = MathJax.Hub.getJaxFor(id); + var mathml = jax.root.toMathML(); + if (!math.getAttribute('haslabel')) { + Explorer.AddMathLabel(mathml, id); + } + if (math.getAttribute('hasspeech')) return; + switch (MathJax.Hub.config.explorer.generation) { + case 'eager': + Explorer.AddSpeechEager(mathml, id); + break; + case 'mixed': + var complexity = math.querySelectorAll('[data-semantic-complexity]'); + if (complexity.length >= Assistive.eagerComplexity) { + Explorer.AddSpeechEager(mathml, id); + } + break; + case 'lazy': + default: + break; + } + }, + AddSpeechLazy: function(math) { + var generator = new sre.TreeSpeechGenerator(); + generator.setRebuilt(Explorer.walker.getRebuilt()); + generator.getSpeech(Explorer.walker.rootNode, Explorer.walker.getXml()); + math.setAttribute('hasspeech', 'true'); + }, + // + // + // Adds speech strings to the node using a web worker. + // + AddSpeechEager: function(mathml, id) { + Explorer.MakeSpeechTask( + mathml, id, sre.TreeSpeechGenerator, + function(math, speech) {math.setAttribute('hasspeech', 'true');}, 5); + }, + // + // Attaches the Math expression as an aria label. + // + AddMathLabel: function(mathml, id) { + Explorer.MakeSpeechTask( + mathml, id, sre.SummarySpeechGenerator, + function(math, speech) { + math.setAttribute('haslabel', 'true'); + math.setAttribute('aria-label', speech);}, + 5); + }, + // + // The actual speech task generator. + // + MakeSpeechTask: function(mathml, id, constructor, onSpeech, time) { + var messageID = Explorer.AddMessage(); + setTimeout(function() { + var speechGenerator = new constructor(); + var math = document.getElementById(id); + var dummy = new sre.DummyWalker( + math, speechGenerator, Explorer.highlighter, mathml); + var speech = dummy.speech(); + if (speech) { + onSpeech(math, speech); + } + Explorer.RemoveMessage(messageID); + }, time); + }, + // + // Event execution on keydown. Subsumes the same method of MathEvents. + // + Keydown: function(event) { + var code = event.keyCode; + if (code === KEY.ESCAPE) { + if (!Explorer.walker) return; + Explorer.RemoveHook(); + Explorer.DeactivateWalker(); + FALSE(event); + return; + } + // If walker is active we redirect there. + if (Explorer.walker && Explorer.walker.isActive()) { + // Maps the return key to dash for SRE v3. + code = code === KEY.RETURN ? KEY.DASH : code; + if (typeof(Explorer.walker.modifier) !== 'undefined') { + Explorer.walker.modifier = event.shiftKey; + } + var move = Explorer.walker.move(code); + if (move === null) return; + if (move) { + if (Explorer.walker.moved === 'expand') { + Explorer.expanded = Explorer.walker.node.id; + // This sometimes blurs in Edge and sometimes it does not. + if (MathJax.Hub.Browser.isEdge) { + Explorer.ignoreFocusOut = true; + Explorer.DeactivateWalker(); + return; + } + // This does not blur in FF, IE. + if (MathJax.Hub.Browser.isFirefox || MathJax.Hub.Browser.isMSIE) { + Explorer.DeactivateWalker(); + return; + } + } + Explorer.liveRegion.Update(Explorer.walker.speech()); + Explorer.Highlight(); + } else { + Explorer.PlayEarcon(); + } + FALSE(event); + return; + } + var math = event.target; + if (code === KEY.SPACE && !event.shiftKey) { + MathJax.Extension.MathEvents.Event.ContextMenu(event, math); + FALSE(event); + return; + } + if (Assistive.hook && (code === KEY.RETURN || + (code === KEY.SPACE && event.shiftKey))) { + var jax = MathJax.Hub.getJaxFor(math); + Explorer.ActivateWalker(math, jax); + Explorer.AddHook(jax); + FALSE(event); + return; + } + }, + GetHighlighter: function(alpha) { + Explorer.highlighter = sre.HighlighterFactory.highlighter( + {color: Assistive.getOption('background'), alpha: alpha}, + {color: Assistive.getOption('foreground'), alpha: 1}, + {renderer: MathJax.Hub.outputJax['jax/mml'][0].id, + browser: MathJax.Hub.Browser.name} + ); + }, + // + // Adds mouse events to maction items in an enriched jax. + // + AddMouseEvents: function(node) { + sre.HighlighterFactory.addEvents( + node, + {'mouseover': Explorer.MouseOver, + 'mouseout': Explorer.MouseOut}, + {renderer: MathJax.Hub.outputJax['jax/mml'][0].id, + browser: MathJax.Hub.Browser.name} + ); + }, + MouseOver: function(event) { + if (Assistive.getOption('highlight') === 'none') return; + if (Assistive.getOption('highlight') === 'hover') { + var frame = event.currentTarget; + Explorer.GetHighlighter(.1); + Explorer.highlighter.highlight([frame]); + Explorer.hoverer = true; + } + FALSE(event); + }, + MouseOut: function(event) { + if (Explorer.hoverer) { + Explorer.highlighter.unhighlight(); + Explorer.hoverer = false; + } + return FALSE(event); + }, + // + // Activates Flaming + // + Flame: function(node) { + if (Assistive.getOption('highlight') === 'flame') { + Explorer.GetHighlighter(.05); + Explorer.highlighter.highlightAll(node); + Explorer.flamer = true; + return; + } + }, + UnFlame: function() { + if (Explorer.flamer) { + Explorer.highlighter.unhighlightAll(); + Explorer.flamer = null; + } + }, + FlameEnriched: function() { + Explorer.UnFlame(); + for (var i = 0, all = MathJax.Hub.getAllJax(), jax; jax = all[i]; i++) { + Explorer.Flame(jax.SourceElement().previousSibling); + } + }, + // + // Activates the walker. + // + Walkers: { + 'syntactic': sre.SyntaxWalker, + 'table': sre.TableWalker, + 'semantic': sre.SemanticWalker, + 'none': sre.DummyWalker + }, + ActivateWalker: function(math, jax) { + var speechOn = Assistive.getOption('speech'); + var constructor = Assistive.getOption('walker') ? + Explorer.Walkers[MathJax.Hub.config.explorer.walker] : + Explorer.Walkers['none']; + var speechGenerator = speechOn ? new sre.DirectSpeechGenerator() : + new sre.DummySpeechGenerator(); + var options = sre.System.getInstance().engineSetup(); + speechGenerator.setOptions({ + locale: options.locale, domain: options.domain, + style: options.style, modality: 'speech'}); + Explorer.GetHighlighter(.2); + Explorer.walker = new constructor( + math, speechGenerator, Explorer.highlighter, jax.root.toMathML()); + if (speechOn && !math.getAttribute('hasspeech')) { + Explorer.AddSpeechLazy(math); + } + Explorer.walker.activate(); + if (speechOn) { + if (Assistive.getOption('subtitle')) { + Explorer.liveRegion.Show(math, Explorer.highlighter); + } + Explorer.liveRegion.Update(Explorer.walker.speech()); + } + Explorer.Highlight(); + // A fix for Edge. + if (Explorer.ignoreFocusOut) { + setTimeout(function() {Explorer.ignoreFocusOut = false;}, 500); + } + }, + // + // Deactivates the walker. + // + DeactivateWalker: function() { + var setup = sre.System.getInstance().engineSetup(); + var domain = setup.domain; + var style = domain === 'clearspeak' ? 'default' : setup.style; + Assistive.setOption('ruleset', setup.domain + '-' + style); + Explorer.liveRegion.Clear(); + Explorer.liveRegion.Hide(); + Explorer.Unhighlight(); + Explorer.currentHighlight = null; + Explorer.walker.deactivate(); + Explorer.walker = null; + }, + // + // Highlights the focused nodes. + // + Highlight: function() { + Explorer.Unhighlight(); + Explorer.highlighter.highlight(Explorer.walker.getFocus().getNodes()); + }, + // + // Unhighlights the old nodes. + // + Unhighlight: function() { + Explorer.highlighter.unhighlight(); + }, + // + // Plays the earcon. + // + // Every time we make new Audio element, as some browsers do not allow to + // play audio elements more than once (e.g., Safari). + // + PlayEarcon: function() { + var audio = new Audio(Explorer.earconFile); + audio.play(); + }, + // + // Toggle speech output. + // + SpeechOutput: function() { + Explorer.Reset(); + var speechItems = ['Subtitles']; + speechItems.forEach( + function(x) { + var item = MathJax.Menu.menu.FindId('Accessibility', 'Explorer', x); + if (item) { + item.disabled = !item.disabled; + }}); + Explorer.Regenerate(); + }, + // + // Remove speech and resets SRE options. + // + RemoveSpeech: function() { + Assistive.setSpeechOption(); + for (var i = 0, all = MathJax.Hub.getAllJax(), jax; jax = all[i]; i++) { + var math = document.getElementById(jax.inputID + '-Frame'); + if (math) { + math.removeAttribute('hasspeech'); + math.removeAttribute('haslabel'); + } + } + }, + // + // Regenerates speech. + // + Regenerate: function() { + for (var i = 0, all = MathJax.Hub.getAllJax(), jax; jax = all[i]; i++) { + var math = document.getElementById(jax.inputID + '-Frame'); + if (math) { + math.removeAttribute('hasspeech'); + Explorer.AddSpeech(math); + } + } + }, + Startup: function() { + var Collapsible = MathJax.Extension.collapsible; + if (Collapsible) Collapsible.Dependent(Assistive); + Assistive.addDefaults(); + } + }; + + MathJax.Hub.Register.StartupHook('End Extensions', function() { + Assistive[SETTINGS.explorer === false ? 'Disable' : 'Enable'](); + MathJax.Hub.Startup.signal.Post('Explorer Ready'); + MathJax.Hub.Register.StartupHook('MathMenu Ready', function() { + COOKIE = MathJax.Menu.cookie; + var Switch = function(menu) { + Assistive[SETTINGS.explorer ? 'Enable' : 'Disable'](true, true); + MathJax.Menu.saveCookie(); + }; + var ITEM = MathJax.Menu.ITEM, + MENU = MathJax.Menu.menu; + var reset = {action: Explorer.Reset}; + var speech = {action: Assistive.speechOption}; + var explorerMenu = + ITEM.SUBMENU(['Explorer', 'Explorer'], + ITEM.CHECKBOX(['Active', 'Active'], 'explorer', {action: Switch}), + ITEM.RULE(), + ITEM.CHECKBOX(['Walker', 'Walker'], 'Assistive-walker'), + ITEM.SUBMENU(['Highlight', 'Highlight'], + ITEM.RADIO(['none', 'None'], 'Assistive-highlight', reset), + ITEM.RADIO(['hover', 'Hover'], 'Assistive-highlight', reset), + ITEM.RADIO(['flame', 'Flame'], 'Assistive-highlight', reset) + ), + ITEM.SUBMENU(['Background', 'Background'], + ITEM.RADIO(['blue', 'Blue'], 'Assistive-background', reset), + ITEM.RADIO(['red', 'Red'], 'Assistive-background', reset), + ITEM.RADIO(['green', 'Green'], 'Assistive-background', reset), + ITEM.RADIO(['yellow', 'Yellow'], 'Assistive-background', reset), + ITEM.RADIO(['cyan', 'Cyan'], 'Assistive-background', reset), + ITEM.RADIO(['magenta', 'Magenta'], 'Assistive-background', reset), + ITEM.RADIO(['white', 'White'], 'Assistive-background', reset), + ITEM.RADIO(['black', 'Black'], 'Assistive-background', reset) + ), + ITEM.SUBMENU(['Foreground', 'Foreground'], + ITEM.RADIO(['black', 'Black'], 'Assistive-foreground', reset), + ITEM.RADIO(['white', 'White'], 'Assistive-foreground', reset), + ITEM.RADIO(['magenta', 'Magenta'], 'Assistive-foreground', reset), + ITEM.RADIO(['cyan', 'Cyan'], 'Assistive-foreground', reset), + ITEM.RADIO(['yellow', 'Yellow'], 'Assistive-foreground', reset), + ITEM.RADIO(['green', 'Green'], 'Assistive-foreground', reset), + ITEM.RADIO(['red', 'Red'], 'Assistive-foreground', reset), + ITEM.RADIO(['blue', 'Blue'], 'Assistive-foreground', reset) + ), + ITEM.RULE(), + ITEM.CHECKBOX(['SpeechOutput', 'Speech Output'], + 'Assistive-speech', {action: Explorer.SpeechOutput}), + ITEM.CHECKBOX(['Subtitles', 'Subtitles'], 'Assistive-subtitle', + {disabled: !SETTINGS['Assistive-speech']}), + ITEM.RULE(), + ITEM.SUBMENU(['Mathspeak', 'Mathspeak Rules'], + ITEM.RADIO(['mathspeak-default', 'Verbose'], + 'Assistive-ruleset', speech), + ITEM.RADIO(['mathspeak-brief', 'Brief'], 'Assistive-ruleset', speech), + ITEM.RADIO(['mathspeak-sbrief', 'Superbrief'], + 'Assistive-ruleset', speech) + ), + ITEM.RADIO(['clearspeak-default', 'Clearspeak Rules'], + 'Assistive-ruleset', speech), + ITEM.SUBMENU(['Chromevox', 'ChromeVox Rules'], + ITEM.RADIO(['chromevox-default', 'Verbose'], + 'Assistive-ruleset', speech), + ITEM.RADIO(['chromevox-alternative', 'Alternative'], + 'Assistive-ruleset', speech) + ) + ); + var submenu = (MENU.FindId('Accessibility') || {}).submenu, index; + if (submenu) { + index = submenu.IndexOfId('Explorer'); + if (index !== null) { + submenu.items[index] = explorerMenu; + } else { + index = submenu.IndexOfId('CollapsibleMath'); + submenu.items.splice(index + 1, 0, explorerMenu); + } + } else { + index = MENU.IndexOfId('CollapsibleMath'); + MENU.items.splice(index + 1, 0, explorerMenu); + } + if (!SETTINGS.explorer) Assistive.DisableMenus(true); + },20); // Between collapsible and auto-collapse extensions + },20); + +}); + +// +// Patch problem with SVG getJaxForMath when used from explorer +// (can be removed after the next release of MathJax). +// +MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { + MathJax.Hub.Config({SVG: {addMMLclasses: true}}); + var SVG = MathJax.OutputJax.SVG; + if (parseFloat(SVG.version) < 2.7) { + var JAXFROMMATH = SVG.getJaxFromMath; + SVG.Augment({ + getJaxFromMath: function (math) { + if (math.parentNode.className.match(/MathJax_SVG_Display/)) math = math.parentNode; + return JAXFROMMATH.call(this,math); + } + }); + } +}); + +// +// Set up the a11y path,if it isn't already in place +// +if (!MathJax.Ajax.config.path.a11y) { + MathJax.Ajax.config.path.a11y = MathJax.Hub.config.root + "/extensions/a11y"; +} + +MathJax.Ajax.Require('[a11y]/collapsible.js'); +MathJax.Hub.Register.StartupHook('Collapsible Ready', function() { + MathJax.Extension.explorer.Explorer.Startup(); + MathJax.Ajax.loadComplete('[a11y]/explorer.js'); +}); +// @license-end diff --git a/js/mathjax/extensions/a11y/invalid_keypress.mp3 b/js/mathjax/extensions/a11y/invalid_keypress.mp3 new file mode 100644 index 0000000..cba44de Binary files /dev/null and b/js/mathjax/extensions/a11y/invalid_keypress.mp3 differ diff --git a/js/mathjax/extensions/a11y/invalid_keypress.ogg b/js/mathjax/extensions/a11y/invalid_keypress.ogg new file mode 100644 index 0000000..292cefd Binary files /dev/null and b/js/mathjax/extensions/a11y/invalid_keypress.ogg differ diff --git a/js/mathjax/extensions/a11y/mathjax-sre.js b/js/mathjax/extensions/a11y/mathjax-sre.js new file mode 100644 index 0000000..6984f72 --- /dev/null +++ b/js/mathjax/extensions/a11y/mathjax-sre.js @@ -0,0 +1,1633 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +// Copyright 2014-2019 Volker Sorge +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +/* + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/ +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return bb||1342177279>>=1)c+=c;return d}},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this||self; +goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}:c[d]=b}; +goog.define=function(a,b){if(!COMPILED){var c=goog.global.CLOSURE_UNCOMPILED_DEFINES,d=goog.global.CLOSURE_DEFINES;c&&void 0===c.nodeType&&Object.prototype.hasOwnProperty.call(c,a)?b=c[a]:d&&void 0===d.nodeType&&Object.prototype.hasOwnProperty.call(d,a)&&(b=d[a])}return b};goog.FEATURESET_YEAR=2012;goog.DEBUG=!0;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1; +goog.provide=function(a){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(".")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)}; +goog.getScriptNonce=function(a){if(a&&a!=goog.global)return goog.getScriptNonce_(a.document);null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document));return goog.cspNonce_};goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(a){return(a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(a)?a:""};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/; +goog.module=function(a){if("string"!==typeof a||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+a+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide."); +if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)}; +goog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a].exports;if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.ModuleType={ES6:"es6",GOOG:"goog"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG}; +goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var a=goog.global.$jscomp;return a?"function"!=typeof a.getCurrentModulePath?!1:!!a.getCurrentModulePath():!1}; +goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0}; +goog.declareModuleId=function(a){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(a in goog.loadedModules_)throw Error('Module with namespace "'+a+'" already exists.');}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=a;else{var b=goog.global.$jscomp;if(!b||"function"!=typeof b.getCurrentModulePath)throw Error('Module with namespace "'+ +a+'" has been loaded incorrectly.');b=b.require(b.getCurrentModulePath());goog.loadedModules_[a]={exports:b,type:goog.ModuleType.ES6,moduleId:a}}};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){};COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&null!=goog.getObjectByName(a)},goog.implicitNamespaces_={"goog.module":!0}); +goog.getObjectByName=function(a,b){a=a.split(".");b=b||goog.global;for(var c=0;c>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid; +goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if("function"===typeof a.clone)return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)}; +goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')}); +a("es7",function(){return b("2 ** 2 == 4")});a("es8",function(){return b("async () => 1, true")});a("es9",function(){return b("({...rest} = {}), true")});a("es_next",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_|| +c.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||"es6"!=b||"noModule"in goog.global.document.createElement("script")?!1:!0;throw Error("Unknown language mode: "+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={}; +this.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){b=[];for(var e=0;e\x3c/script>";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}else{var e=b.createElement("script");e.defer=goog.Dependency.defer_;e.async=!1;e.type="text/javascript";(d=goog.getScriptNonce())&&e.setAttribute("nonce",d);goog.DebugLoader_.IS_OLD_IE_? +(a.pause(),e.onreadystatechange=function(){if("loaded"==e.readyState||"complete"==e.readyState)a.loaded(),a.resume()}):e.onload=function(){e.onload=null;a.loaded()};e.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(e)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."), +a.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(l,m){l=m?'");return a};sre.ColorPicker=function(a,b){this.foreground=sre.ColorPicker.getChannelColor_(b,sre.ColorPicker.DEFAULT_FOREGROUND_);this.background=sre.ColorPicker.getChannelColor_(a,sre.ColorPicker.DEFAULT_BACKGROUND_)};sre.ColorPicker.DEFAULT_BACKGROUND_="blue";sre.ColorPicker.DEFAULT_FOREGROUND_="black"; +sre.ColorPicker.namedColors_={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};sre.ColorPicker.getChannelColor_=function(a,b){a=a||{color:b};var c=a.color?sre.ColorPicker.namedColors_[a.color]:a;c||(c=sre.ColorPicker.namedColors_[b]);c.alpha=a.hasOwnProperty("alpha")?a.alpha:1;return sre.ColorPicker.normalizeColor_(c)}; +sre.ColorPicker.normalizeColor_=function(a){var b=function(c){c=Math.max(c,0);c=Math.min(255,c);return Math.round(c)};a.red=b(a.red);a.green=b(a.green);a.blue=b(a.blue);a.alpha=Math.max(a.alpha,0);a.alpha=Math.min(1,a.alpha);return a};sre.ColorPicker.prototype.rgba=function(){var a=function(b){return"rgba("+b.red+","+b.green+","+b.blue+","+b.alpha+")"};return{background:a(this.background),foreground:a(this.foreground)}}; +sre.ColorPicker.prototype.rgb=function(){var a=function(b){return"rgb("+b.red+","+b.green+","+b.blue+")"};return{background:a(this.background),alphaback:this.background.alpha.toString(),foreground:a(this.foreground),alphafore:this.foreground.alpha.toString()}}; +sre.ColorPicker.prototype.hex=function(){var a=function(b){return"#"+sre.ColorPicker.toHex_(b.red)+sre.ColorPicker.toHex_(b.green)+sre.ColorPicker.toHex_(b.blue)};return{background:a(this.background),alphaback:this.background.alpha.toString(),foreground:a(this.foreground),alphafore:this.foreground.alpha.toString()}};sre.ColorPicker.toHex_=function(a){a=a.toString(16);return 1===a.length?"0"+a:a};sre.ContrastPicker=function(){this.hue=10;this.sat=100;this.incr=this.light=50}; +sre.ContrastPicker.prototype.generate=function(){return sre.ColorPicker.RGB2hex_(sre.ColorPicker.rgb2RGB_(sre.ColorPicker.hsl2rgb_(this.hue,this.sat,this.light)))};sre.ContrastPicker.prototype.increment=function(){this.hue=(this.hue+this.incr)%360}; +sre.ColorPicker.hsl2rgb_=function(a,b,c){c=1a?(a=$jscomp.makeIterator([d,e,0]),b=a.next().value,f=a.next().value,g=a.next().value):60<=a&&120>a?(a=$jscomp.makeIterator([e,d,0]),b=a.next().value,f=a.next().value,g=a.next().value):120<=a&&180>a?(a=$jscomp.makeIterator([0,d,e]),b=a.next().value,f=a.next().value,g=a.next().value):180<=a&&240>a?(a=$jscomp.makeIterator([0,e,d]),b=a.next().value,f= +a.next().value,g=a.next().value):240<=a&&300>a?(a=$jscomp.makeIterator([e,0,d]),b=a.next().value,f=a.next().value,g=a.next().value):300<=a&&360>a&&(a=$jscomp.makeIterator([d,0,e]),b=a.next().value,f=a.next().value,g=a.next().value);return{red:b+c,green:f+c,blue:g+c}};sre.ColorPicker.rgb2RGB_=function(a){return{red:Math.round(255*a.red),green:Math.round(255*a.green),blue:Math.round(255*a.blue)}};sre.ColorPicker.RGB2hex_=function(a){return"rgb("+a.red+","+a.green+","+a.blue+")"};sre.Highlighter=function(){};sre.Highlighter.prototype.highlight=function(a){};sre.Highlighter.prototype.unhighlight=function(){};sre.Highlighter.prototype.highlightAll=function(a){};sre.Highlighter.prototype.unhighlightAll=function(){};sre.Highlighter.prototype.setColor=function(a){};sre.Highlighter.prototype.addEvents=function(a,b){};sre.AbstractHighlighter=function(){this.currentHighlights_=[];this.color=null;this.mactionName=""};sre.AbstractHighlighter.ATTR="sre-highlight";sre.AbstractHighlighter.prototype.highlight=function(a){this.currentHighlights_.push(a.map(goog.bind(function(b){var c=this.highlightNode(b);this.setHighlighted(b);return c},this)))};sre.AbstractHighlighter.prototype.highlightNode=goog.abstractMethod;sre.AbstractHighlighter.prototype.highlightAll=function(a){a=this.getMactionNodes(a);for(var b=0,c;c=a[b];b++)this.highlight([c])}; +sre.AbstractHighlighter.prototype.unhighlight=function(){var a=this.currentHighlights_.pop();a&&a.forEach(goog.bind(function(b){this.isHighlighted(b.node)&&(this.unhighlightNode(b),this.unsetHighlighted(b.node))},this))};sre.AbstractHighlighter.prototype.unhighlightNode=goog.abstractMethod;sre.AbstractHighlighter.prototype.unhighlightAll=function(){for(;0=a.length)return a;for(var c=[],d=0,e;e=b[d],a.length;d++)e.close&&e.close.length&&e.close.forEach(function(f){var g=a.indexOf(f);-1!==g&&(c.unshift(f),a.splice(g,1))});return c};sre.AudioUtil.PersonalityRanges_={};sre.AudioUtil.LastOpen_=[]; +sre.AudioUtil.personalityMarkup=function(a){sre.AudioUtil.PersonalityRanges_={};sre.AudioUtil.LastOpen_=[];for(var b=[],c={},d=0,e;e=a[d];d++){var f=null,g=e.descriptionSpan(),h=e.personality;e=h[sre.Engine.personalityProps.JOIN];delete h[sre.Engine.personalityProps.JOIN];"undefined"!==typeof h[sre.Engine.personalityProps.PAUSE]&&(f={},f[sre.Engine.personalityProps.PAUSE]=h[sre.Engine.personalityProps.PAUSE],delete h[sre.Engine.personalityProps.PAUSE]);h=sre.AudioUtil.personalityDiff_(h,c);sre.AudioUtil.appendMarkup_(b, +g,h,e,f,!0)}b=b.concat(sre.AudioUtil.finaliseMarkup_());return b=sre.AudioUtil.simplifyMarkup_(b)}; +sre.AudioUtil.appendElement_=function(a,b){var c=a[a.length-1];if(c)if(sre.AudioUtil.isSpanElement(b)&&sre.AudioUtil.isSpanElement(c))if("undefined"===typeof c.join)c.span=c.span.concat(b.span);else{a=c.span.pop();var d=b.span.shift();c.span.push(a+c.join+d);c.span=c.span.concat(b.span);c.join=b.join}else sre.AudioUtil.isPauseElement(b)&&sre.AudioUtil.isPauseElement(c)?c.pause=sre.AudioUtil.mergePause_(c.pause,b.pause):a.push(b);else a.push(b)}; +sre.AudioUtil.simplifyMarkup_=function(a){for(var b={},c=[],d=0,e;e=a[d];d++)if(sre.AudioUtil.isMarkupElement(e))if(!e.close||1!==e.close.length||e.open.length)sre.AudioUtil.copyValues_(e,b),c.push(e);else{var f=a[d+1];if(!f||sre.AudioUtil.isSpanElement(f))sre.AudioUtil.copyValues_(e,b),c.push(e);else{var g=sre.AudioUtil.isPauseElement(f)?f:null;g&&(f=a[d+2]);f&&sre.AudioUtil.isMarkupElement(f)&&f.open[0]===e.close[0]&&!f.close.length&&f[f.open[0]]===b[f.open[0]]?g?(sre.AudioUtil.appendElement_(c, +g),d+=2):d+=1:(sre.AudioUtil.copyValues_(e,b),c.push(e))}}else sre.AudioUtil.appendElement_(c,e);return c};sre.AudioUtil.copyValues_=function(a,b){a.rate&&(b.rate=a.rate);a.pitch&&(b.pitch=a.pitch);a.volume&&(b.volume=a.volume)};sre.AudioUtil.finaliseMarkup_=function(){for(var a=[],b=sre.AudioUtil.LastOpen_.length-1;0<=b;b--){var c=sre.AudioUtil.LastOpen_[b];if(c.length){for(var d={open:[],close:[]},e=0;e=a?"short":500>=a?"medium":"long":a]||""};sre.XmlRenderer=function(){sre.MarkupRenderer.call(this)};goog.inherits(sre.XmlRenderer,sre.MarkupRenderer); +sre.XmlRenderer.prototype.markup=function(a){this.setScaleFunction(-2,2,-100,100,2);a=sre.AudioUtil.personalityMarkup(a);for(var b=[],c=[],d=0,e;e=a[d];d++)if(e.span)b.push(this.merge(e.span));else if(sre.AudioUtil.isPauseElement(e))b.push(this.pause(e));else{if(e.close.length)for(var f=0;f'+this.getSeparator()+a+this.getSeparator()+""};sre.SableRenderer.prototype.pause=function(a){return''}; +sre.SableRenderer.prototype.prosodyElement=function(a,b){b=this.applyScaleFunction(b);switch(a){case sre.Engine.personalityProps.PITCH:return'';case sre.Engine.personalityProps.RATE:return'';case sre.Engine.personalityProps.VOLUME:return'';default:return"<"+a.toUpperCase()+' VALUE="'+b+'">'}};sre.SableRenderer.prototype.closeTag=function(a){return""};sre.SsmlRenderer=function(){sre.XmlRenderer.call(this)};goog.inherits(sre.SsmlRenderer,sre.XmlRenderer);sre.SsmlRenderer.prototype.finalize=function(a){return''+this.getSeparator()+a+this.getSeparator()+""};sre.SsmlRenderer.prototype.pause=function(a){return''}; +sre.SsmlRenderer.prototype.prosodyElement=function(a,b){b=Math.floor(this.applyScaleFunction(b));b=0>b?b.toString():"+"+b.toString();return"":'%">')};sre.SsmlRenderer.prototype.closeTag=function(a){return""};sre.SsmlStepRenderer=function(){sre.SsmlRenderer.call(this)};goog.inherits(sre.SsmlStepRenderer,sre.SsmlRenderer);sre.SsmlStepRenderer.prototype.markup=function(a){sre.SsmlStepRenderer.MARKS={};return sre.SsmlStepRenderer.superClass_.markup.call(this,a)};sre.SsmlStepRenderer.CHARACTER_ATTR_="character";sre.SsmlStepRenderer.MARKS={}; +sre.SsmlStepRenderer.prototype.merge=function(a){for(var b=[],c=0;c'),sre.SsmlStepRenderer.MARKS[e]=!0);1===d.string.length&&d.string.match(/[a-zA-Z]/)?b.push(''+d.string+""):b.push(d.string)}return b.join(this.getSeparator())};sre.StringRenderer=function(){sre.AbstractAudioRenderer.call(this)};goog.inherits(sre.StringRenderer,sre.AbstractAudioRenderer);sre.StringRenderer.prototype.markup=function(a){var b="";a=a.filter(function(g){return g.descriptionString()});if(!a.length)return b;for(var c=0;c "+this.action.toString()};sre.SpeechRule.Type={NODE:"NODE",MULTI:"MULTI",TEXT:"TEXT",PERSONALITY:"PERSONALITY"}; +sre.SpeechRule.Type.fromString=function(a){switch(a){case "[n]":return sre.SpeechRule.Type.NODE;case "[m]":return sre.SpeechRule.Type.MULTI;case "[t]":return sre.SpeechRule.Type.TEXT;case "[p]":return sre.SpeechRule.Type.PERSONALITY;default:throw"Parse error: "+a;}}; +sre.SpeechRule.Type.toString=function(a){switch(a){case sre.SpeechRule.Type.NODE:return"[n]";case sre.SpeechRule.Type.MULTI:return"[m]";case sre.SpeechRule.Type.TEXT:return"[t]";case sre.SpeechRule.Type.PERSONALITY:return"[p]";default:throw"Unknown type error: "+a;}};sre.SpeechRule.Component=function(a){this.type=a.type;this.content=a.content;this.attributes=a.attributes;this.grammar=a.grammar}; +sre.SpeechRule.Component.fromString=function(a){var b={};b.type=sre.SpeechRule.Type.fromString(a.substring(0,3));a=a.slice(3).trim();if(!a)throw new sre.SpeechRule.OutputError("Missing content.");switch(b.type){case sre.SpeechRule.Type.TEXT:if('"'==a[0]){var c=sre.SpeechRule.splitString_(a,"\\(")[0].trim();if('"'!=c.slice(-1))throw new sre.SpeechRule.OutputError("Invalid string syntax.");b.content=c;a=a.slice(c.length).trim();-1==a.indexOf("(")&&(a="");break}case sre.SpeechRule.Type.NODE:case sre.SpeechRule.Type.MULTI:c= +a.indexOf(" ("),-1==c?(b.content=a.trim(),a=""):(b.content=a.substring(0,c).trim(),a=a.slice(c).trim())}a&&(a=sre.SpeechRule.Component.attributesFromString(a),a.grammar&&(b.grammar=a.grammar,delete a.grammar),Object.keys(a).length&&(b.attributes=a));return b=new sre.SpeechRule.Component(b)};sre.SpeechRule.Component.prototype.toString=function(){var a=""+sre.SpeechRule.Type.toString(this.type);a+=this.content?" "+this.content:"";var b=this.attributesToString();return a+(b?" "+b:"")}; +sre.SpeechRule.Component.grammarFromString=function(a){return sre.Grammar.parseInput(a)};sre.SpeechRule.Component.prototype.grammarToString=function(){return this.getGrammar().join(":")};sre.SpeechRule.Component.prototype.getGrammar=function(){var a=[],b;for(b in this.grammar)!0===this.grammar[b]?a.push(b):!1===this.grammar[b]?a.push("!"+b):a.push(b+"="+this.grammar[b]);return a}; +sre.SpeechRule.Component.attributesFromString=function(a){if("("!=a[0]||")"!=a.slice(-1))throw new sre.SpeechRule.OutputError("Invalid attribute expression: "+a);var b={};a=sre.SpeechRule.splitString_(a.slice(1,-1),",");for(var c=0,d=a.length;c "+this.getRule().action:this.constraint};sre.TrieNodeFactory={};sre.TrieNodeFactory.getNode=function(a,b,c){switch(a){case sre.TrieNode.Kind.ROOT:return new sre.RootTrieNode;case sre.TrieNode.Kind.DYNAMIC:return new sre.DynamicTrieNode(b);case sre.TrieNode.Kind.QUERY:return new sre.QueryTrieNode(b,c);case sre.TrieNode.Kind.BOOLEAN:return new sre.BooleanTrieNode(b,c);default:return null}};sre.RootTrieNode=function(){sre.AbstractTrieNode.call(this,"",function(){return!0});this.kind=sre.TrieNode.Kind.ROOT};goog.inherits(sre.RootTrieNode,sre.AbstractTrieNode); +sre.DynamicTrieNode=function(a){sre.AbstractTrieNode.call(this,a,function(b){return b===a});this.kind=sre.TrieNode.Kind.DYNAMIC};goog.inherits(sre.DynamicTrieNode,sre.AbstractTrieNode); +sre.TrieNodeFactory.constraintTest_=function(a){if(a.match(/^self::\*$/))return function(f){return!0};if(a.match(/^self::\w+$/)){var b=a.slice(6).toUpperCase();return function(f){return f.tagName&&sre.DomUtil.tagName(f)===b}}if(a.match(/^self::\w+:\w+$/)){a=a.split(":");var c=sre.XpathUtil.resolveNameSpace(a[2]);if(!c)return null;b=a[3].toUpperCase();return function(f){return f.localName&&f.localName.toUpperCase()===b&&f.namespaceURI===c}}if(a.match(/^@\w+$/)){var d=a.slice(1);return function(f){return f.hasAttribute&& +f.hasAttribute(d)}}if(a.match(/^@\w+="[\w\d ]+"$/)){a=a.split("=");d=a[0].slice(1);var e=a[1].slice(1,-1);return function(f){return f.hasAttribute&&f.hasAttribute(d)&&f.getAttribute(d)===e}}return a.match(/^@\w+!="[\w\d ]+"$/)?(a=a.split("!="),d=a[0].slice(1),e=a[1].slice(1,-1),function(f){return!f.hasAttribute||!f.hasAttribute(d)||f.getAttribute(d)!==e}):a.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)?(a=a.split('"'),e=a[1],function(f){return sre.Grammar.getInstance().getParameter(e)}): +a.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)?(a=a.split('"'),e=a[1],function(f){return!sre.Grammar.getInstance().getParameter(e)}):null};sre.QueryTrieNode=function(a,b){this.context_=b;sre.StaticTrieNode.call(this,a,sre.TrieNodeFactory.constraintTest_(a));this.kind=sre.TrieNode.Kind.QUERY};goog.inherits(sre.QueryTrieNode,sre.StaticTrieNode);sre.QueryTrieNode.prototype.applyTest=function(a){return this.test?this.test(a):this.context_.applyQuery(a,this.constraint)===a}; +sre.BooleanTrieNode=function(a,b){this.context_=b;sre.StaticTrieNode.call(this,a,sre.TrieNodeFactory.constraintTest_(a));this.kind=sre.TrieNode.Kind.BOOLEAN};goog.inherits(sre.BooleanTrieNode,sre.StaticTrieNode);sre.BooleanTrieNode.prototype.applyTest=function(a){return this.test?this.test(a):this.context_.applyConstraint(a,this.constraint)};sre.Trie=function(a){this.store=a;this.root=sre.TrieNodeFactory.getNode(sre.TrieNode.Kind.ROOT,"",this.store.context)};sre.Trie.prototype.addRule=function(a){for(var b=this.root,c=a.context,d=a.dynamicCstr.getValues(),e=0,f=d.length;e=c&&1=d&&1b?-1:aa)return String.fromCharCode(a);a-=65536;return String.fromCharCode((a>>10)+55296,(a&1023)+56320)};sre.MathMap=function(){this.store=sre.MathCompoundStore.getInstance();this.loaded_=[];this.addRules={functions:goog.bind(this.store.addFunctionRules,this.store),symbols:goog.bind(this.store.addSymbolRules,this.store),units:goog.bind(this.store.addUnitRules,this.store)}};goog.addSingletonGetter(sre.MathMap);sre.MathMap.oldInst_=sre.MathMap.getInstance;sre.MathMap.getInstance=function(){var a=sre.MathMap.oldInst_();a.loadLocale();return a}; +sre.MathMap.prototype.loadLocale=function(){var a=sre.Engine.getInstance().locale;if(-1===this.loaded_.indexOf(a)){var b=sre.Engine.getInstance().mode===sre.Engine.Mode.ASYNC;b&&(sre.Engine.getInstance().mode=sre.Engine.Mode.SYNC);this.loaded_.push(a);this.retrieveMaps(a);b&&(sre.Engine.getInstance().mode=sre.Engine.Mode.ASYNC)}};sre.MathMap.toFetch_=0;sre.Engine.registerTest(function(){return sre.MathMap.getInstance()&&!sre.MathMap.toFetch_}); +sre.MathMap.prototype.retrieveFiles=function(a){a=sre.BaseUtil.makePath(sre.SystemExternal.jsonPath)+a+".js";switch(sre.Engine.getInstance().mode){case sre.Engine.Mode.ASYNC:sre.MathMap.toFetch_++;var b=goog.bind(this.parseMaps,this);sre.MathMap.fromFile_(a,function(c,d){sre.MathMap.toFetch_--;c||b(d)});break;case sre.Engine.Mode.HTTP:sre.MathMap.toFetch_++;this.getJsonAjax_(a);break;default:a=sre.MathMap.loadFile(a),this.parseMaps(a)}}; +sre.MathMap.prototype.parseMaps=function(a){a=JSON.parse(a);this.addMaps(a)};sre.MathMap.prototype.addMaps=function(a,b){for(var c=0,d;d=Object.keys(a)[c];c++){var e=d.split("/");b&&b!==e[0]||a[d].forEach(this.addRules[e[1]])}};sre.MathMap.prototype.retrieveMaps=function(a){sre.AlphabetGenerator.generate(a,this.store);sre.Engine.getInstance().isIE&&sre.Engine.getInstance().mode===sre.Engine.Mode.HTTP?this.getJsonIE_(a):this.retrieveFiles(a)}; +sre.MathMap.prototype.getJsonIE_=function(a,b){var c=b||1;sre.BrowserUtil.mapsForIE?this.addMaps(sre.BrowserUtil.mapsForIE,a):5>=c&&setTimeout(goog.bind(function(){this.getJsonIE_(a,c++)},this),300)};sre.MathMap.fromFile_=function(a,b){return sre.SystemExternal.fs.readFile(a,"utf8",b)};sre.MathMap.loadFile=function(a){try{return sre.MathMap.readJSON_(a)}catch(b){console.error("Unable to load file: "+a+"\n"+b)}return"{}"};sre.MathMap.readJSON_=function(a){return sre.SystemExternal.fs.readFileSync(a)}; +sre.MathMap.prototype.getJsonAjax_=function(a){var b=new XMLHttpRequest,c=goog.bind(this.parseMaps,this);b.onreadystatechange=function(){4===b.readyState&&(sre.MathMap.toFetch_--,200===b.status&&c(b.responseText))};b.open("GET",a,!0);b.send()};sre.StoreUtil={};sre.StoreUtil.nodeCounter=function(a,b){var c=a.length,d=0,e=b;b||(e="");return function(){db&&0a}; +sre.ClearspeakUtil.hasPreference=function(a){return sre.Engine.getInstance().style===a};sre.ClearspeakUtil.simpleExpression=function(){return new sre.SemanticAnnotator("clearspeak",function(a){return sre.ClearspeakUtil.isSimpleExpression(a)?"simple":""})};sre.ClearspeakUtil.simpleNode=function(a){if(!a.hasAttribute("annotation"))return!1;a=a.getAttribute("annotation");return!!/clearspeak:simple$|clearspeak:simple;/.exec(a)}; +sre.ClearspeakUtil.simpleCell_=function(a){if(sre.ClearspeakUtil.simpleNode(a))return!0;if(a.tagName!==sre.SemanticAttr.Type.SUBSCRIPT)return!1;a=a.childNodes[0].childNodes;var b=a[1];return a[0].tagName===sre.SemanticAttr.Type.IDENTIFIER&&(sre.ClearspeakUtil.isInteger_(b)||b.tagName===sre.SemanticAttr.Type.INFIXOP&&b.hasAttribute("role")&&b.getAttribute("role")===sre.SemanticAttr.Role.IMPLICIT&&sre.ClearspeakUtil.allIndices_(b))}; +sre.ClearspeakUtil.isInteger_=function(a){return a.tagName===sre.SemanticAttr.Type.NUMBER&&a.hasAttribute("role")&&a.getAttribute("role")===sre.SemanticAttr.Role.INTEGER};sre.ClearspeakUtil.allIndices_=function(a){return sre.XpathUtil.evalXPath("children/*",a).every(function(b){return sre.ClearspeakUtil.isInteger_(b)||b.tagName===sre.SemanticAttr.Type.IDENTIFIER})}; +sre.ClearspeakUtil.allCellsSimple=function(a){return sre.XpathUtil.evalXPath(a.tagName===sre.SemanticAttr.Type.MATRIX?"children/row/children/cell/children/*":"children/line/children/*",a).every(sre.ClearspeakUtil.simpleCell_)?[a]:[]};sre.ClearspeakUtil.isSmallVulgarFraction=function(a){return sre.NumbersUtil.vulgarFractionSmall(a,20,11)?[a]:[]}; +sre.ClearspeakUtil.isUnitExpression=function(a){return a.type===sre.SemanticAttr.Type.TEXT||a.type===sre.SemanticAttr.Type.PUNCTUATED&&a.role===sre.SemanticAttr.Role.TEXT&&sre.ClearspeakUtil.isNumber_(a.childNodes[0])&&sre.ClearspeakUtil.allTextLastContent_(a.childNodes.slice(1))||a.type===sre.SemanticAttr.Type.IDENTIFIER&&a.role===sre.SemanticAttr.Role.UNIT||a.type===sre.SemanticAttr.Type.INFIXOP&&(a.role===sre.SemanticAttr.Role.IMPLICIT||a.role===sre.SemanticAttr.Role.UNIT)}; +sre.ClearspeakUtil.allTextLastContent_=function(a){for(var b=0;b2],self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1]'.split(","),'Rule,unit-divide,default,[n] children/*[1]; [t] "per"; [n] children/*[2] (grammar:singularUnit),self::fraction,@role="unit"'.split(","),'Rule{currency{default{[m] children/*[position()>1]; [n] children/*[1];{self::infixop{contains(@annotation, "clearspeak:unit"){children/*[1][@role="unit"]{CQFfirstCurrency'.split("{"), +'Rule;currency;Currency_Position;[m] children/*;self::infixop;contains(@annotation, "clearspeak:unit")'.split(";"),["SpecializedRule","currency","Currency_Position","Currency_Prefix"],'Rule{currency{Currency_Prefix{[n] children/*[last()]; [m] children/*[position()2{./children/punctuation[@role="ellipsis"]'.split("{"), +'Rule{multi-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2'.split("{"),'Rule,equality,default,[t] "equation"; [t] "left hand side"; [n] children/*[1];[p] (pause:200); [n] content/*[1] (pause:200);[t] "right hand side"; [n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2'.split(","),'Rule,simple-equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/identifier or ./children/number'.split(","), +'Rule,simple-equality2,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/function or ./children/appl'.split(","),["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit";children/*[1][@role="latinletter"] or children/*[1][@role="greekletter"] or children/*[1][@role="otherletter"] or name(children/*[1])="number";children/*[2][@role="latinletter"] or children/*[2][@role="greekletter"] or children/*[2][@role="otherletter"] or name(children/*[2])="number"'.split(";"), +["Rule","binary-operation","default","[p] (pause:100); [m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:100);","self::infixop"],'Rule,variable-addition,default,[t] "sum with variable number of summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(children/*)>2,children/punctuation[@role="ellipsis"]'.split(","),["Rule","prefix","default",'[t] "prefix"; [n] text(); [t] "of" (pause 150);[n] children/*[1]',"self::prefixop"],'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,self::prefixop[@role="negative"]'.split(","), +["Rule","postfix","default",'[n] children/*[1]; [t] "postfix"; [n] text() (pause 300)',"self::postfixop"],["Rule","identifier","default","[n] text()","self::identifier"],["Rule","number","default","[n] text()","self::number"],'Rule{font{default{[t] @font; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"),'Rule{font-identifier-short{default{[t] @font; [n] CQFhideFont; [t] CSFshowFont{self::identifier{string-length(text())=1{@font{@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font; [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),'Rule,simple-fraction,default,[p] (pause:100); [n] children/*[1] (rate:0.35); [t] "over"; [n] children/*[2] (rate:0.35); [p] (pause:100),self::fraction,name(children/*[1])="number" or name(children/*[1])="identifier",name(children/*[2])="number" or name(children/*[2])="identifier"'.split(","), +'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(";"),["Rule","fraction","default",'[p] (pause:250); [n] children/*[1] (rate:0.35); [p] (pause:250); [t] "divided by"; [p] (pause:250); [n] children/*[2] (rate:0.35); [p] (pause:250)',"self::fraction"],["Rule","superscript","default",'[n] children/*[1]; [t] "super"; [n] children/*[2] (pitch:0.35);[p] (pause:300)',"self::superscript"],["Rule","subscript","default",'[n] children/*[1]; [t] "sub"; [n] children/*[2] (pitch:-0.35);[p] (pause:300)', +"self::subscript"],'Rule,ellipsis,default,[p] (pause:200); [t] "ellipsis"; [p] (pause:300),self::punctuation,self::punctuation[@role="ellipsis"]'.split(","),'Rule;fence-single;default;[n] text();self::punctuation;self::punctuation[@role="openfence"]'.split(";"),["Alias","fence-single","self::punctuation",'self::punctuation[@role="closefence"]'],["Alias","fence-single","self::punctuation",'self::punctuation[@role="vbar"]'],["Alias","fence-single","self::punctuation",'self::punctuation[@role="application"]'], +["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule,fences-open-close,default,[p] (pause:200); [n] children/*[1] (rate:0.35); [p] (pause:200),self::fenced,@role="leftright"'.split(","),'Rule,fences-open-close-in-appl,default,[p] (pause:200); [n] children/*[1]; [p] (pause:200);,self::fenced[@role="leftright"],./parent::children/parent::appl'.split(","),'Rule,fences-neutral,default,[p] (pause:100); [t] "absolute value of"; [n] children/*[1];[p] (pause:350);,self::fenced,self::fenced[@role="neutral"]'.split(","), +["Rule","omit-fences","default","[p] (pause:500); [n] children/*[1]; [p] (pause:200);","self::fenced"],["Rule","matrix","default",'[t] "matrix"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100)',"self::matrix"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)','self::row[@role="matrix"]'],["Rule","matrix-cell","default","[n] children/*[1]",'self::cell[@role="matrix"]'],["Rule","vector","default",'[t] "vector"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"element",pause:100)', +"self::vector"],["Rule","cases","default",'[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100)',"self::cases"],["Rule","cases-row","default","[m] children/*",'self::row[@role="cases"]'],["Rule","cases-cell","default","[n] children/*[1]",'self::cell[@role="cases"]'],["Rule","row","default",'[m] ./* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',"self::row"],'Rule{cases-end{default{[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100);[t] "end cases"{self::cases{following-sibling::*'.split("{"), +["Rule","multiline","default",'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"line",pause:100)',"self::multiline"],["Rule","line","default","[m] children/*","self::line"],["Rule","table","default",'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200)',"self::table"],["Rule","table-row","default","[m] children/* (pause:100)",'self::row[@role="table"]'],["Alias","cases-cell",'self::cell[@role="table"]'],'Rule,end-punct,default,[m] children/*; [p] (pause:300),self::punctuated,@role="endpunct"'.split(","), +'Rule,start-punct,default,[n] content/*[1]; [p] (pause:200); [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1] (rate:0.2); [n] children/*[3] (rate:0.2),self::punctuated,@role="integral"'.split(","),["Rule","punctuated","default","[m] children/* (pause:100)","self::punctuated"],["Rule","function","default","[n] text()","self::function"],["Rule","appl","default","[n] children/*[1]; [n] content/*[1]; [n] children/*[2]","self::appl"], +'Rule,sum-only,default,[n] children/*[1]; [t] "from"; [n] children/*[2]; [t] "to";[n] children/*[3],self::limboth,@role="sum" or @role="integral"'.split(","),["Rule","limboth","default",'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[t] "under"; [n] children/*[3]; [p] (pause 250);',"self::limboth"],["Rule","limlower","default",'[n] children/*[1]; [t] "over"; [n] children/*[2];',"self::limlower"],["Rule","limupper","default",'[n] children/*[1]; [t] "under"; [n] children/*[2];', +"self::limupper"],["Rule","largeop","default","[n] text()","self::largeop"],["Rule","bigop","default",'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[p] (pause 250);',"self::bigop"],["Rule","integral","default","[n] children/*[1]; [p] (pause 100); [n] children/*[2];[p] (pause 200); [n] children/*[3] (rate:0.35);","self::integral"],["Rule","sqrt","default",'[t] "Square root of"; [n] children/*[1] (rate:0.35); [p] (pause:400)',"self::sqrt"],'Rule,square,default,[n] children/*[1]; [t] "squared" (pitch:0.35); [p] (pause:200),self::superscript,children/*[2][text()=2],name(./children/*[1])!="text"'.split(","), +'Rule,cube,default,[n] children/*[1]; [t] "cubed" (pitch:0.35); [p] (pause:200),self::superscript,children/*[2][text()=3],name(./children/*[1])!="text"'.split(","),["Rule","root","default",'[t] "root of order"; [n] children/*[1];[t] "over"; [n] children/*[1] (rate:0.35); [p] (pause:400)',"self::root"],"Rule,text-no-mult,default,[n] children/*[1]; [p] (pause:200); [n] children/*[2],self::infixop,children/text".split(","),["Rule","text","default","[n] text(); [p] (pause:200)","self::text"],'Rule;unit;default;[t] text() (annotation:unit, preprocess);self::identifier;@role="unit"'.split(";"), +'Rule,unit-square,default,[t] "square"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(","),'Rule,unit-cubic,default,[t] "cubic"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(","),'Rule,reciprocal,default,[t] "reciprocal"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(","), +'Rule,reciprocal,default,[t] "per"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(","),'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(";"),'Rule,unit-divide,default,[n] children/*[1] (pitch:0.3); [t] "per"; [n] children/*[2] (pitch:-0.3),self::fraction,@role="unit"'.split(",")]};sre.MathspeakFrenchUtil={};sre.MathspeakFrenchUtil.smallRoot=function(a){if(!a.childNodes||0===a.childNodes.length||!a.childNodes[0].childNodes)return[];var b=a.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(b))return[];b=parseInt(b,10);return 1=b?[a]:[]};sre.MathspeakFrenchUtil.baselineVerbose=function(a){return sre.MathspeakUtil.baselineVerbose(a).replace(/\-$/,"")};sre.MathspeakFrenchUtil.baselineBrief=function(a){return sre.MathspeakUtil.baselineBrief(a).replace(/\-$/,"")}; +sre.MathspeakFrenchUtil.leftSuperscriptVerbose=function(a){return sre.MathspeakUtil.superscriptVerbose(a).replace(/^exposant/,"exposant gauche")};sre.MathspeakFrenchUtil.leftSubscriptVerbose=function(a){return sre.MathspeakUtil.subscriptVerbose(a).replace(/^indice/,"indice gauche")};sre.MathspeakFrenchUtil.leftSuperscriptBrief=function(a){return sre.MathspeakUtil.superscriptBrief(a).replace(/^sup/,"sup gauche")}; +sre.MathspeakFrenchUtil.leftSubscriptBrief=function(a){return sre.MathspeakUtil.subscriptBrief(a).replace(/^sub/,"sub gauche")};sre.MathspeakFrench={locale:"fr",domain:"mathspeak",functions:[["CQF","CQFspaceoutNumber",sre.MathspeakUtil.spaceoutNumber],["CQF","CQFspaceoutIdentifier",sre.MathspeakUtil.spaceoutIdentifier],["CSF","CSFspaceoutText",sre.MathspeakUtil.spaceoutText],["CSF","CSFopenFracVerbose",sre.MathspeakUtil.openingFractionVerbose],["CSF","CSFcloseFracVerbose",sre.MathspeakUtil.closingFractionVerbose],["CSF","CSFoverFracVerbose",sre.MathspeakUtil.overFractionVerbose],["CSF","CSFopenFracBrief",sre.MathspeakUtil.openingFractionBrief], +["CSF","CSFcloseFracBrief",sre.MathspeakUtil.closingFractionBrief],["CSF","CSFopenFracSbrief",sre.MathspeakUtil.openingFractionSbrief],["CSF","CSFcloseFracSbrief",sre.MathspeakUtil.closingFractionSbrief],["CSF","CSFoverFracSbrief",sre.MathspeakUtil.overFractionSbrief],["CSF","CSFvulgarFrFraction",sre.NumbersUtil.vulgarFraction],["CQF","CQFvulgarFractionSmall",sre.MathspeakUtil.isSmallVulgarFraction],["CSF","CSFopenRadicalVerbose",sre.MathspeakUtil.openingRadicalVerbose],["CSF","CSFcloseRadicalVerbose", +sre.MathspeakUtil.closingRadicalVerbose],["CSF","CSFindexRadicalVerbose",sre.MathspeakUtil.indexRadicalVerbose],["CSF","CSFopenRadicalBrief",sre.MathspeakUtil.openingRadicalBrief],["CSF","CSFcloseRadicalBrief",sre.MathspeakUtil.closingRadicalBrief],["CSF","CSFindexRadicalBrief",sre.MathspeakUtil.indexRadicalBrief],["CSF","CSFopenRadicalSbrief",sre.MathspeakUtil.openingRadicalSbrief],["CSF","CSFindexRadicalSbrief",sre.MathspeakUtil.indexRadicalSbrief],["CQF","CQFisSmallRoot",sre.MathspeakFrenchUtil.smallRoot], +["CSF","CSFsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFbaselineVerbose",sre.MathspeakFrenchUtil.baselineVerbose],["CSF","CSFbaselineBrief",sre.MathspeakFrenchUtil.baselineBrief],["CSF","CSFleftsuperscriptVerbose",sre.MathspeakFrenchUtil.leftSuperscriptVerbose],["CSF","CSFleftsubscriptVerbose", +sre.MathspeakFrenchUtil.leftSubscriptVerbose],["CSF","CSFrightsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFrightsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFleftsuperscriptBrief",sre.MathspeakFrenchUtil.leftSuperscriptBrief],["CSF","CSFleftsubscriptBrief",sre.MathspeakFrenchUtil.leftSubscriptBrief],["CSF","CSFrightsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFrightsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFunderscript", +sre.MathspeakUtil.nestedUnderscore],["CSF","CSFoverscript",sre.MathspeakUtil.nestedOverscore],["CTXF","CTXFordinalCounter",sre.NumbersUtil.ordinalCounter],["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator],["CQF","CQFdetIsSimple",sre.MathspeakUtil.determinantIsSimple],["CSF","CSFRemoveParens",sre.MathspeakUtil.removeParens],["CQF","CQFresetNesting",sre.MathspeakUtil.resetNestingDepth],["CQF","CQFisLogarithm",sre.ClearspeakUtil.isLogarithmWithBase]],rules:['Rule;collapsed;default;[n] . (engine:modality=summary,grammar:collapsed);self::*;@alternative;not(contains(@grammar, "collapsed"));self::*;self::*;self::*;self::*;self::*'.split(";"), +["SpecializedRule","collapsed","default","brief"],["SpecializedRule","collapsed","brief","sbrief"],"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),["Rule","unknown","default","[n] text()","self::unknown"],'Rule;protected;default;[t] text();self::*;@role="protected"'.split(";"),["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule;blank-empty;default;[t] "vide";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(";"),'Rule{font{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"), +'Rule{font-identifier-short{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont);{self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [t] "et"; [n] children/*[2]; ,self::number,@role="mixed"'.split(","), +'Rule{number-with-chars{default{[t] "nombre"; [m] CQFspaceoutNumber{self::number{"" != translate(text(), "0123456789.,", ""){text() != translate(text(), "0123456789.,", "")'.split("{"),'Rule{number-as-upper-word{default{[t] "MotMajuscule"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split("{"), +'Rule{number-baseline{default{[t] "position de base"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline","default","brief",'[t] "base"; [n] . (grammar:baseline)'],["SpecializedRule","number-baseline","brief","sbrief"],'Rule{number-baseline-font{default{[t] "position de base"; [n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"), +["SpecializedRule","number-baseline-font","default","brief",'[t] "base"; [n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont)'],["SpecializedRule","number-baseline-font","brief","sbrief"],'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";@role!="protected";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(";"), +["Rule","identifier","default","[n] text()","self::identifier"],'Rule,negative,default,[t] "n\u00e9gatif"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(","),["Aliases","negative","self::prefixop",'@role="negative"',"children/number"],["Aliases","negative","self::prefixop",'@role="negative"','children/fraction[@role="vulgar"]'],'Rule,negative,default,[t] "n\u00e9gatif"; [n] children/*[1],self::prefixop,@role="negative"'.split(","),["Rule","prefix","default","[m] content/*; [n] children/*[1]", +"self::prefixop"],["Rule","postfix","default","[n] children/*[1]; [m] content/*","self::postfixop"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(";"),["Aliases","implicit","self::infixop",'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"'],'Rule,subtraction,default,[m] children/* (separator:"moins");,self::infixop,@role="subtraction"'.split(","), +["Rule","function-unknown","default","[n] children/*[1]; [n] children/*[2]","self::appl"],'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(","),'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(","),'Rule,fences-neutral,default,[t] "d\u00e9but valeur absolue"; [n] children/*[1]; [t] "fin valeur absolue",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(","), +["SpecializedRule","fences-neutral","default","sbrief",'[t] "valeur absolue"; [n] children/*[1]; [t] "fin valeur absolue"'],'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(","),'Rule,fences-set,default,[t] "d\u00e9but ensemble"; [n] children/*[1]; [t] "fin ensemble",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(","),["SpecializedRule","fences-set", +"default","sbrief",'[t] "ensemble"; [n] children/*[1]; [t] "fin ensemble"'],["Rule","text","default","[n] text()","self::text"],'Rule;factorial;default;[t] "factorielle";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"),'Rule;minus;default;[t] "moins";self::operator;text()="-"'.split(";"),'Rule;single-prime;default;[t] "prime";self::punctuated;@role="prime";count(children/*)=1'.split(";"),'Rule;double-prime;default;[t] "double prime";self::punctuated;@role="prime";count(children/*)=2'.split(";"), +'Rule;triple-prime;default;[t] "triple prime";self::punctuated;@role="prime";count(children/*)=3'.split(";"),'Rule;quadruple-prime;default;[t] "quadruple prime";self::punctuated;@role="prime";count(children/*)=4'.split(";"),'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(","),["Rule","fraction","default","[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose","self::fraction"],["Rule","fraction", +"brief","[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief","self::fraction"],["Rule","fraction","sbrief","[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief","self::fraction"],'Rule;vulgar-fraction;default;[t] CSFvulgarFrFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(";"),["SpecializedRule","vulgar-fraction","default","brief"],["SpecializedRule","vulgar-fraction", +"default","sbrief"],'Rule,continued-fraction-outer,default,[t] "fraction continue"; [n] children/*[1];[t] "sur"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","),["SpecializedRule","continued-fraction-outer","default","brief",'[t] "frac continue"; [n] children/*[1];[t] "sur"; [n] children/*[2]'],["SpecializedRule","continued-fraction-outer","brief","sbrief"],'Rule,continued-fraction-inner,default,[t] "d\u00e9but fraction"; [n] children/*[1];[t] "sur"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","), +["SpecializedRule","continued-fraction-inner","default","brief",'[t] "d\u00e9but frac"; [n] children/*[1];[t] "sur"; [n] children/*[2]'],["SpecializedRule","continued-fraction-inner","brief","sbrief",'[t] "frac"; [n] children/*[1];[t] "sur"; [n] children/*[2]'],["Rule","sqrt","default","[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose","self::sqrt"],["Rule","sqrt","brief","[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],["Rule","sqrt","sbrief", +"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,CQFisSmallRoot".split(","),"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(","),"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(","),["Rule","root","default", +"[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose","self::root"],["Rule","root","brief","[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],["Rule","root","sbrief","[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],'Rule,limboth,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];[t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","), +'Rule,limlower,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Rule,limupper,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"), +'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),["Rule","limboth-end","default",'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];[t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[3]; [t] "fin scripts"', +"self::limboth"],["Rule","limlower-end","default",'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2]; [t] "fin scripts"',"self::limlower"],["Rule","limupper-end","default",'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[2]; [t] "fin scripts"',"self::limupper"],["Aliases","limlower-end","self::underscore",'@role="limit function"'],["Aliases","limlower-end","self::underscore"],["Aliases","limupper-end","self::overscore"],["Rule","integral","default", +"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];","self::integral"],'Rule,integral,default,[n] children/*[1]; [t] "indice inf\u00e9rieur"; [n] children/*[2];[t] "indice sup\u00e9rieur"; [n] children/*[3]; [t] "position de base";,self::limboth,@role="integral"'.split(","),["SpecializedRule","integral","default","brief",'[n] children/*[1]; [t] "inf"; [n] children/*[2];[t] "sup"; [n] children/*[3]; [t] "position de base";'],["SpecializedRule","integral","brief","sbrief"],["Rule","bigop","default", +"[n] children/*[1]; [n] children/*[2];","self::bigop"],["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(","),'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(";"),["Rule","multrel","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::multirel"], +["Rule","subscript","default","[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]","self::subscript"],["Rule","subscript","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]","self::subscript"],["SpecializedRule","subscript","brief","sbrief"],'Rule,subscript-base,default,[n] children/*[1]; [t] "base"; [n] children/*[2],self::subscript,CQFisLogarithm,self::*,self::*,self::*'.split(","),["SpecializedRule","subscript-base","default","brief"],["SpecializedRule","subscript-base", +"default","sbrief"],'Rule,subscript-simple,brief,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(","),["SpecializedRule","subscript-simple","brief","sbrief"],'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","subscript-baseline","default","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","subscript-baseline","brief","sbrief"],'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","subscript-baseline", +"self::subscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel",sre.MathspeakUtil.generateBaselineConstraint()],["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)","@embellished"],'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["SpecializedRule","subscript-empty-sup", +"default","brief"],["SpecializedRule","subscript-empty-sup","brief","sbrief"],["Aliases","subscript-empty-sup","self::subscript",'name(children/*[2])="superscript"','name(children/*[2]/children/*[1])="empty"'],["Rule","superscript","default","[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]","self::superscript"],["SpecializedRule","superscript","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]"],["SpecializedRule","superscript","brief","sbrief"],'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","superscript-baseline","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief"],["SpecializedRule","superscript-baseline","brief","sbrief"],'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","superscript-baseline","self::superscript", +"not(following-sibling::*)","ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt"],["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel","not(@embellished)",sre.MathspeakUtil.generateBaselineConstraint()],'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(" "),'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","), +["SpecializedRule","superscript-empty-sub","default","brief"],["SpecializedRule","superscript-empty-sub","brief","sbrief"],["Aliases","superscript-empty-sub","self::superscript",'name(children/*[2])="subscript"','name(children/*[2]/children/*[1])="empty"'],'Rule,square,default,[n] children/*[1]; [t] "au carr\u00e9",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","square","default","brief"],["SpecializedRule","square","default","sbrief"],'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,cube,default,[n] children/*[1]; [t] "cubique",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","cube","default","brief"],["SpecializedRule","cube","default","sbrief"],'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(","),["SpecializedRule","prime","default","brief"],["SpecializedRule","prime","default","sbrief"],'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(","), +["SpecializedRule","prime-subscript","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]"],["SpecializedRule","prime-subscript","brief","sbrief"],'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(","), +["SpecializedRule","prime-subscript-baseline","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","prime-subscript-baseline","brief","sbrief"],'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(" "),'Rule,prime-subscript-simple,brief,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(","), +["SpecializedRule","prime-subscript-simple","brief","sbrief"],'Rule,overscore,default,[t] "suscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(","),'Rule,double-overscore,default,[t] "sus-suscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(","),'Rule,underscore,default,[t] "souscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(","), +'Rule,double-underscore,default,[t] "sous-souscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(","),'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(","),["Rule","matrix","default",'[t] "d\u00e9but matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin matrice"', +"self::matrix"],["Rule","matrix","sbrief",'[t] "matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin matrice"',"self::matrix"],["Aliases","matrix","self::vector"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne");[p] (pause: 200)',"self::row"],'Rule{row-with-label{default{[t] "avec \u00e9tiquette"; [n] content/*[1]; [t] "fin \u00e9tiquette"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content'.split("{"), +'Rule{row-with-label{brief{[t] "\u00e9tiquette"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content'.split("{"),["SpecializedRule","row-with-label","brief","sbrief"],'Rule{row-with-text-label{sbrief{[t] "\u00e9tiquette"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content{name(content/cell/children/*[1])="text"'.split("{"),'Rule;empty-row;default;[t] "vide";self::row;count(children/*)=0'.split(";"),["Rule", +"matrix-cell","default","[n] children/*[1]; [p] (pause: 300)","self::cell"],'Rule,empty-cell,default,[t] "vide"; [p] (pause: 300),self::cell,count(children/*)=0'.split(","),'Rule{determinant{default{[t] "d\u00e9but d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [t] ""; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"'.split("{"),["SpecializedRule","determinant","default","sbrief", +'[t] "d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin d\u00e9terminant"'],'Rule{determinant-simple{default{[t] "d\u00e9but d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e",grammar:simpleDet); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"{CQFdetIsSimple'.split("{"), +["SpecializedRule","determinant-simple","default","sbrief",'[t] "d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e",grammar:simpleDet); [t] "fin d\u00e9terminant"'],'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split("{"),["Rule","layout","default",'[t] "d\u00e9but tableau"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"', +"self::table"],["Rule","layout","sbrief",'[t] "tableau"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',"self::table"],'Rule,binomial,default,[t] "d\u00e9but binomiale"; [n] children/*[2]/children/*[1]; [t] "parmi"; [n] children/*[1]/children/*[1]; [t] "fin binomiale",self::vector,@role="binomial"'.split(","),'Rule,binomial,sbrief,[t] "binomiale"; [n] children/*[1]/children/*[1]; [t] "parmi"; [n] children/*[2]/children/*[1]; [t] "fin binomiale",self::vector,@role="binomial"'.split(","), +["Rule","cases","default",'[t] "d\u00e9but tableau"; [n] content/*[1]; [t] "\u00e9largie";[m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',"self::cases"],["Rule","cases","sbrief",'[t] "tableau"; [n] content/*[1]; [t] "\u00e9largie"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',"self::cases"],["Aliases","layout","self::multiline"],["Rule","line","default","[m] children/*","self::line"],'Rule,line-with-label,default,[t] "avec etiquette"; [n] content/*[1]; [t] "fin etiquette" (pause: 200); [m] children/*,self::line,content'.split(","), +["SpecializedRule","line-with-label","default","brief",'[t] "etiquette"; [n] content/*[1] (pause: 200); [m] children/*'],["SpecializedRule","line-with-label","brief","sbrief"],'Rule,line-with-text-label,sbrief,[t] "etiquette"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(","),'Rule;empty-line;default;[t] "vide";self::line;count(children/*)=0;not(content)'.split(";"),["SpecializedRule","empty-line","default","brief"],["SpecializedRule","empty-line", +"brief","sbrief"],'Rule,empty-line-with-label,default,[t] "avec etiquette"; [n] content/*[1]; [t] "fin etiquette" (pause: 200); [t] "vide",self::line,count(children/*)=0,content'.split(","),["SpecializedRule","empty-line-with-label","default","brief",'[t] "etiquette"; [n] content/*[1] (pause: 200); [t] "vide"'],["SpecializedRule","empty-line-with-label","brief","sbrief"],["Rule","enclose","default",'[t] "d\u00e9but enfermer en"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "fin enfermer"', +"self::enclose"],'Rule,overbar,default,[t] "d\u00e9but trait suscrit"; [n] children/*[1]; [t] "fin trait suscrit",self::enclose,@role="top"'.split(","),'Rule,underbar,default,[t] "d\u00e9but trait souscrit"; [n] children/*[1]; [t] "fin trait souscrit",self::enclose,@role="bottom"'.split(","),'Rule,leftbar,default,[t] "barre verticale"; [n] children/*[1],self::enclose,@role="left"'.split(","),'Rule,rightbar,default,[n] children/*[1]; [t] "barre verticale",self::enclose,@role="right"'.split(","),'Rule,crossout,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[1]; [t] "fin biff\u00e9",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","), +'Rule,cancel,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[1]/children/*[1]; [t] "avec"; [n] children/*[2]; [t] "fin biff\u00e9",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),["SpecializedRule","cancel","default","brief"],["SpecializedRule","cancel","default","sbrief"],["Aliases","cancel","self::underscore",'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'],'Rule,cancel-reverse,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[2]/children/*[1]; [t] "avec"; [n] children/*[1]; [t] "fin biff\u00e9",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(","), +["SpecializedRule","cancel-reverse","default","brief"],["SpecializedRule","cancel-reverse","default","sbrief"],["Aliases","cancel-reverse","self::underscore",'name(children/*[2])="enclose"','children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'],'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(";"),'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(","), +["Rule","punctuated","default","[m] children/*","self::punctuated"],'Rule;unit;default;[t] text() (grammar:annotation="unit":translate);self::identifier;@role="unit"'.split(";"),'Rule,unit-square,default,[n] children/*[1]; [t] "carr\u00e9",self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(","),'Rule,unit-cubic,default,[n] children/*[1]; [t] "cubique",self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(","),'Rule,reciprocal,default,[t] "r\u00e9ciproque"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(","), +'Rule,reciprocal,default,[t] "par"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(","),'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(";"),'Rule,unit-divide,default,[n] children/*[1]; [t] "par"; [n] children/*[2],self::fraction,@role="unit"'.split(",")],initialize:[sre.MathspeakUtil.generateTensorRules]};sre.MathspeakGerman={locale:"de",domain:"mathspeak",functions:[["CQF","CQFspaceoutNumber",sre.MathspeakUtil.spaceoutNumber],["CQF","CQFspaceoutIdentifier",sre.MathspeakUtil.spaceoutIdentifier],["CSF","CSFspaceoutText",sre.MathspeakUtil.spaceoutText],["CSF","CSFopenFracVerbose",sre.MathspeakUtil.openingFractionVerbose],["CSF","CSFcloseFracVerbose",sre.MathspeakUtil.closingFractionVerbose],["CSF","CSFoverFracVerbose",sre.MathspeakUtil.overFractionVerbose],["CSF","CSFopenFracBrief",sre.MathspeakUtil.openingFractionBrief], +["CSF","CSFcloseFracBrief",sre.MathspeakUtil.closingFractionBrief],["CSF","CSFopenFracSbrief",sre.MathspeakUtil.openingFractionSbrief],["CSF","CSFcloseFracSbrief",sre.MathspeakUtil.closingFractionSbrief],["CSF","CSFoverFracSbrief",sre.MathspeakUtil.overFractionSbrief],["CSF","CSFvulgarFraction",sre.NumbersUtil.vulgarFraction],["CQF","CQFvulgarFractionSmall",sre.MathspeakUtil.isSmallVulgarFraction],["CSF","CSFopenRadicalVerbose",sre.MathspeakUtil.openingRadicalVerbose],["CSF","CSFcloseRadicalVerbose", +sre.MathspeakUtil.closingRadicalVerbose],["CSF","CSFindexRadicalVerbose",sre.MathspeakUtil.indexRadicalVerbose],["CSF","CSFopenRadicalBrief",sre.MathspeakUtil.openingRadicalBrief],["CSF","CSFcloseRadicalBrief",sre.MathspeakUtil.closingRadicalBrief],["CSF","CSFindexRadicalBrief",sre.MathspeakUtil.indexRadicalBrief],["CSF","CSFopenRadicalSbrief",sre.MathspeakUtil.openingRadicalSbrief],["CSF","CSFindexRadicalSbrief",sre.MathspeakUtil.indexRadicalSbrief],["CSF","CSFsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose], +["CSF","CSFsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFbaselineVerbose",sre.MathspeakUtil.baselineVerbose],["CSF","CSFbaselineBrief",sre.MathspeakUtil.baselineBrief],["CSF","CSFleftsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFleftsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFrightsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose], +["CSF","CSFrightsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFleftsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFleftsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFrightsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFrightsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFunderscript",sre.MathspeakUtil.nestedUnderscore],["CSF","CSFoverscript",sre.MathspeakUtil.nestedOverscore],["CTXF","CTXFordinalCounter",sre.NumbersUtil.ordinalCounter], +["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator],["CQF","CQFdetIsSimple",sre.MathspeakUtil.determinantIsSimple],["CSF","CSFRemoveParens",sre.MathspeakUtil.removeParens],["CQF","CQFresetNesting",sre.MathspeakUtil.resetNestingDepth]],rules:['Rule{collapsed{default{[n] . (engine:modality=summary,grammar:collapsed); [t] "kollabiert"{self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split("{"),["SpecializedRule","collapsed","default","brief"], +["SpecializedRule","collapsed","brief","sbrief"],"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),["Rule","unknown","default","[n] text()","self::unknown"],'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(";"),["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule;blank-empty;default;[t] "leer";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(";"),'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{name(self::*)!="number"{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"), +'Rule{font-number{default{[t] @font (grammar:localFontNumber); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"),'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1 or string-length(text())=2{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1 or string-length(text())=2;@font;not(contains(@grammar, "ignoreFont"));@font="italic";self::*'.split(";"),'Rule{font-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::*{name(self::*)!="number"{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split("{"), +'Rule{font-number-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFontNumber){self::number{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split("{"),["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [n] children/*[2]; ,self::number,@role="mixed"'.split(","),'Rule{number-with-chars{default{[t] "Zahl"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split("{"), +'Rule{number-as-upper-word{default{[t] "Wort gro\u00df"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split("{"), +["SpecializedRule","number-as-upper-word","default","brief"],["SpecializedRule","number-as-upper-word","default","sbrief"],'Rule{number-baseline{default{[t] "Grundlinie"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline","default", +"brief",'[t] "Grund"; [n] . (grammar:baseline)'],["SpecializedRule","number-baseline","brief","sbrief"],'Rule{number-baseline-font{default{[t] "Grundlinie"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline-font", +"default","brief",'[t] "Grund"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font)'],["SpecializedRule","number-baseline-font","brief","sbrief"],'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(";"), +["Rule","identifier","default","[n] text()","self::identifier"],'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(","),["Aliases","negative","self::prefixop",'@role="negative"',"children/number"],["Aliases","negative","self::prefixop",'@role="negative"','children/fraction[@role="vulgar"]'],'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative"'.split(","),["Rule","prefix","default","[m] content/*; [n] children/*[1]", +"self::prefixop"],["Rule","postfix","default","[n] children/*[1]; [m] content/*","self::postfixop"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(";"),["Aliases","implicit","self::infixop",'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"'],'Rule,subtraction,default,[m] children/* (separator:"minus");,self::infixop,@role="subtraction"'.split(","), +["Rule","function-unknown","default","[n] children/*[1]; [n] children/*[2]","self::appl"],'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(","),'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(","),'Rule,fences-neutral,default,[t] "Anfang Betrag"; [n] children/*[1]; [t] "Ende Betrag",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(","), +["SpecializedRule","fences-neutral","default","sbrief",'[t] "Betrag"; [n] children/*[1]; [t] "Ende Betrag"'],'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(","),'Rule,fences-set,default,[t] "Anfang Menge"; [n] children/*[1]; [t] "Ende Menge",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(","),["SpecializedRule","fences-set","default","sbrief", +'[t] "Menge"; [n] children/*[1]; [t] "Ende Menge"'],["Rule","text","default","[n] text()","self::text"],'Rule;factorial;default;[t] "Fakult\u00e4t";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"),'Rule;minus;default;[t] "minus";self::operator;text()="-"'.split(";"),'Rule;single-prime;default;[t] "Strich";self::punctuated;@role="prime";count(children/*)=1'.split(";"),'Rule;double-prime;default;[t] "zwei Strich";self::punctuated;@role="prime";count(children/*)=2'.split(";"), +'Rule;triple-prime;default;[t] "drei Strich";self::punctuated;@role="prime";count(children/*)=3'.split(";"),'Rule;quadruple-prime;default;[t] "vier Strich";self::punctuated;@role="prime";count(children/*)=4'.split(";"),'Rule,counted-prime,default,[t] count(children/*); [t] "Strich",self::punctuated,@role="prime"'.split(","),["Rule","fraction","default","[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose","self::fraction"],["Rule","fraction", +"brief","[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief","self::fraction"],["Rule","fraction","sbrief","[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief","self::fraction"],'Rule;vulgar-fraction;default;[t] CSFvulgarFraction (grammar:correctOne);self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(";"),["SpecializedRule","vulgar-fraction","default","brief"],["SpecializedRule", +"vulgar-fraction","default","sbrief"],'Rule,continued-fraction-outer,default,[t] "Kettenbruch"; [n] children/*[1];[t] "durch"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","),'Rule,continued-fraction-inner,default,[t] "Anfang Bruch"; [n] children/*[1];[t] "durch"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","), +["SpecializedRule","continued-fraction-inner","default","sbrief",'[t] "Bruch"; [n] children/*[1];[t] "durch"; [n] children/*[2]'],["Rule","sqrt","default","[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose","self::sqrt"],["Rule","sqrt","brief","[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],["Rule","sqrt","sbrief","[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,children/*[1][text()=3 or text()=2]".split(","), +"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,children/*[1][text()=3 or text()=2]".split(","),"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,children/*[1][text()=3 or text()=2]".split(","),["Rule","root","default","[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose","self::root"],["Rule","root","brief","[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief", +"self::root"],["Rule","root","sbrief","[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","), +'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"), +'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),["Rule","limboth-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "Ende \u00dcberschrift"',"self::limboth"],["Rule","limlower-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "Ende Unterschrift"',"self::limlower"], +["Rule","limupper-end","default",'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "Ende \u00dcberschrift"',"self::limupper"],["Aliases","limlower-end","self::underscore",'@role="limit function"'],["Aliases","limlower-end","self::underscore"],["Aliases","limupper-end","self::overscore"],["Rule","integral","default","[n] children/*[1]; [n] children/*[2]; [n] children/*[3];","self::integral"],'Rule,integral,default,[n] children/*[1]; [t] "Index"; [n] children/*[2];[t] "Hoch"; [n] children/*[3]; [t] "Grundlinie";,self::limboth,@role="integral"'.split(","), +["SpecializedRule","integral","default","brief",'[n] children/*[1]; [t] "Index"; [n] children/*[2];[t] "Hoch"; [n] children/*[3]; [t] "Base";'],["SpecializedRule","integral","brief","sbrief"],["Rule","bigop","default","[n] children/*[1]; [n] children/*[2];","self::bigop"],["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(","), +'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(";"),["Rule","multrel","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::multirel"],["Rule","subscript","default","[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]","self::subscript"],["Rule","subscript","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]","self::subscript"],["SpecializedRule","subscript","brief","sbrief"], +'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(","),["SpecializedRule","subscript-simple","default","brief"],["SpecializedRule","subscript-simple","default","sbrief"],'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","subscript-baseline","default","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","subscript-baseline","brief","sbrief"],'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","subscript-baseline", +"self::subscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel",sre.MathspeakUtil.generateBaselineConstraint()],["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)","@embellished"],'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["SpecializedRule","subscript-empty-sup", +"default","brief"],["SpecializedRule","subscript-empty-sup","brief","sbrief"],["Aliases","subscript-empty-sup","self::subscript",'name(children/*[2])="superscript"','name(children/*[2]/children/*[1])="empty"'],["Rule","superscript","default","[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]","self::superscript"],["SpecializedRule","superscript","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]"],["SpecializedRule","superscript","brief","sbrief"],'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","superscript-baseline","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief"],["SpecializedRule","superscript-baseline","brief","sbrief"],'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","superscript-baseline","self::superscript", +"not(following-sibling::*)","ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt"],["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel","not(@embellished)",sre.MathspeakUtil.generateBaselineConstraint()],'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(" "),'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","), +["SpecializedRule","superscript-empty-sub","default","brief"],["SpecializedRule","superscript-empty-sub","brief","sbrief"],["Aliases","superscript-empty-sub","self::superscript",'name(children/*[2])="subscript"','name(children/*[2]/children/*[1])="empty"'],'Rule,square,default,[n] children/*[1]; [t] "Quadrat",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","square","default","brief"],["SpecializedRule","square","default","sbrief"],'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,cube,default,[n] children/*[1]; [t] "Kubik",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","cube","default","brief"],["SpecializedRule","cube","default","sbrief"],'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(","),["SpecializedRule","prime","default","brief"],["SpecializedRule","prime","default","sbrief"],'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(","), +["SpecializedRule","prime-subscript","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]"],["SpecializedRule","prime-subscript","brief","sbrief"],'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(","), +["SpecializedRule","prime-subscript-baseline","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","prime-subscript-baseline","brief","sbrief"],'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(" "),'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(","), +["SpecializedRule","prime-subscript-simple","default","brief"],["SpecializedRule","prime-subscript-simple","default","sbrief"],'Rule,overscore,default,[t] "modifiziert oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(","),["SpecializedRule","overscore","default","brief",'[t] "mod oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2]'],["SpecializedRule","overscore","brief","sbrief"],'Rule,double-overscore,default,[t] "modifiziert oben oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(","), +["SpecializedRule","double-overscore","default","brief",'[t] "mod oben oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2]'],["SpecializedRule","double-overscore","brief","sbrief"],'Rule,underscore,default,[t] "modifiziert unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(","),["SpecializedRule","underscore","default","brief",'[t] "mod unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2]'],["SpecializedRule","underscore","brief", +"sbrief"],'Rule,double-underscore,default,[t] "modifiziert unten unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(","),["SpecializedRule","double-underscore","default","brief",'[t] "mod unten unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2]'],["SpecializedRule","double-underscore","brief","sbrief"],'Rule,overbar,default,[n] children/*[1]; [t] "\u00dcberstrich",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","), +'Rule,underbar,default,[n] children/*[1]; [t] "Unterstrich",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","),'Rule,overtilde,default,[n] children/*[1]; [t] "Tilde oben",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","), +'Rule,undertilde,default,[n] children/*[1]; [t] "Tilde unten",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","),'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(","),["Rule","matrix","default",'[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Matrize"', +"self::matrix"],["Rule","matrix","sbrief",'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Matrize"',"self::matrix"],["Aliases","matrix","self::vector"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte");[p] (pause: 200)',"self::row"],'Rule{row-with-label{default{[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content'.split("{"), +'Rule{row-with-label{brief{[t] "Bezeichner"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content'.split("{"),["SpecializedRule","row-with-label","brief","sbrief"],'Rule{row-with-text-label{sbrief{[t] "Bezeichner"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content{name(content/cell/children/*[1])="text"'.split("{"),'Rule;empty-row;default;[t] "Blank";self::row;count(children/*)=0'.split(";"),["Rule","matrix-cell", +"default","[n] children/*[1]; [p] (pause: 300)","self::cell"],'Rule,empty-cell,default,[t] "leer"; [p] (pause: 300),self::cell,count(children/*)=0'.split(","),'Rule{determinant{default{[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Determinante"{self::matrix{@role="determinant"'.split("{"),["SpecializedRule","determinant","default","sbrief",'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Determinante"'], +'Rule{determinant-simple{default{[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile",grammar:simpleDet); [t] "Ende Determinante"{self::matrix{@role="determinant"{CQFdetIsSimple'.split("{"),["SpecializedRule","determinant-simple","default","sbrief",'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile",grammar:simpleDet); [t] "Ende Determinante"'], +'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split("{"),["Rule","layout","default",'[t] "Anfang Anordnung"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Anordnung"',"self::table"],["Rule","layout","sbrief",'[t] "Anordnung"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Anordnung"',"self::table"],'Rule,binomial,default,[t] "Anfang Binomialkoeffizient"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomialkoeffizient",self::vector,@role="binomial"'.split(","), +'Rule,binomial,brief,[t] "Anfang Binomial"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomial",self::vector,@role="binomial"'.split(","),'Rule,binomial,sbrief,[t] "Binomial"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomial",self::vector,@role="binomial"'.split(","),["Rule","cases","default",'[t] "Anfang Fallunterscheidung"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Fallunterscheidung"', +"self::cases"],["Rule","cases","brief",'[t] "Anfang F\u00e4lle"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende F\u00e4lle"',"self::cases"],["Rule","cases","sbrief",'[t] "F\u00e4lle"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende F\u00e4lle"',"self::cases"],["Aliases","layout","self::multiline"],["Rule","line","default","[m] children/*","self::line"],'Rule,line-with-label,default,[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner" (pause: 200); [m] children/*,self::line,content'.split(","), +["SpecializedRule","line-with-label","default","brief",'[t] "Bezeichner"; [n] content/*[1] (pause: 200); [m] children/*'],["SpecializedRule","line-with-label","brief","sbrief"],'Rule,line-with-text-label,sbrief,[t] "Bezeichner"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(","),'Rule;empty-line;default;[t] "leer";self::line;count(children/*)=0;not(content)'.split(";"),["SpecializedRule","empty-line","default","brief"],["SpecializedRule","empty-line", +"brief","sbrief"],'Rule,empty-line-with-label,default,[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner"(pause: 200); [t] "leer",self::line,count(children/*)=0,content'.split(","),["SpecializedRule","empty-line-with-label","default","brief",'[t] "Bezeichner"; [n] content/*[1] (pause: 200); [t] "leer"'],["SpecializedRule","empty-line-with-label","brief","sbrief"],["Rule","enclose","default",'[t] "Anfang Umschlie\u00dfung"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "Ende Umschlie\u00dfung"', +"self::enclose"],["Aliases","overbar","self::enclose",'@role="top"'],["Aliases","underbar","self::enclose",'@role="bottom"'],'Rule,leftbar,default,[t] "senkrechter Strich"; [n] children/*[1],self::enclose,@role="left"'.split(","),'Rule,rightbar,default,[n] children/*[1]; [t] "senkrechter Strich",self::enclose,@role="right"'.split(","),'Rule,crossout,default,[t] "durchgestrichen"; [n] children/*[1]; [t] "Ende duchgestrichen",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","), +'Rule,cancel,default,[t] "durchgestrichen"; [n] children/*[1]/children/*[1]; [t] "mit"; [n] children/*[2]; [t] "Ende duchgestrichen",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),["SpecializedRule","cancel","default","brief"],["SpecializedRule","cancel","default","sbrief"],["Aliases","cancel","self::underscore",'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'],'Rule,cancel-reverse,default,[t] "durchgestrichen"; [n] children/*[2]/children/*[1]; [t] "mit"; [n] children/*[1]; [t] "Ende duchgestrichen",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(","), +["SpecializedRule","cancel-reverse","default","brief"],["SpecializedRule","cancel-reverse","default","sbrief"],["Aliases","cancel-reverse","self::underscore",'name(children/*[2])="enclose"','children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'],'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(";"),'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(","), +["Rule","punctuated","default","[m] children/*","self::punctuated"],'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(";"),'Rule,unit-square,default,[t] "Quadrat"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(","),'Rule,unit-cubic,default,[t] "Kubik"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(","),'Rule,reciprocal,default,[n] children/*[1]; [t] "invers",self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(","), +'Rule,reciprocal,default,[t] "pro"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(","),'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(";"),'Rule,unit-divide,default,[n] children/*[1]; [t] "pro"; [n] children/*[2],self::fraction,@role="unit"'.split(","),["Rule","inference","default",'[t] "Schlussregel"; [m] content/*; [t] "mit Folgerung"; [n] children/*[1]; [t] "aus"; [t] count(children/*[2]/children/*); [t] "Pr\u00e4missen"', +"self::inference"],'Rule,inference,default,[t] "Schlussregel"; ; [m] content/*; [t] "mit Folgerung"; [n] children/*[1]; [t] "aus"; [t] count(children/*[2]/children/*); [t] "Pr\u00e4misse",self::inference,count(children/*[2]/children/*)<2'.split(","),["Rule","premise","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Pr\u00e4misse ");',"self::premises"],["Rule","conclusion","default","[n] children/*[1]","self::conclusion"],["Rule","label","default",'[t] "Regel"; [n] children/*[1]',"self::rulelabel"], +'Rule,axiom,default,[t] "Axiom"; [m] children/*[1];,self::inference,@role="axiom"'.split(","),'Rule,axiom,default,[t] "leeres Axiom";,self::empty,@role="axiom"'.split(",")],initialize:[sre.MathspeakUtil.generateTensorRules]};sre.MathspeakRules={domain:"mathspeak",functions:[["CQF","CQFspaceoutNumber",sre.MathspeakUtil.spaceoutNumber],["CQF","CQFspaceoutIdentifier",sre.MathspeakUtil.spaceoutIdentifier],["CSF","CSFspaceoutText",sre.MathspeakUtil.spaceoutText],["CSF","CSFopenFracVerbose",sre.MathspeakUtil.openingFractionVerbose],["CSF","CSFcloseFracVerbose",sre.MathspeakUtil.closingFractionVerbose],["CSF","CSFoverFracVerbose",sre.MathspeakUtil.overFractionVerbose],["CSF","CSFopenFracBrief",sre.MathspeakUtil.openingFractionBrief], +["CSF","CSFcloseFracBrief",sre.MathspeakUtil.closingFractionBrief],["CSF","CSFopenFracSbrief",sre.MathspeakUtil.openingFractionSbrief],["CSF","CSFcloseFracSbrief",sre.MathspeakUtil.closingFractionSbrief],["CSF","CSFoverFracSbrief",sre.MathspeakUtil.overFractionSbrief],["CSF","CSFvulgarFraction",sre.NumbersUtil.vulgarFraction],["CQF","CQFvulgarFractionSmall",sre.MathspeakUtil.isSmallVulgarFraction],["CSF","CSFopenRadicalVerbose",sre.MathspeakUtil.openingRadicalVerbose],["CSF","CSFcloseRadicalVerbose", +sre.MathspeakUtil.closingRadicalVerbose],["CSF","CSFindexRadicalVerbose",sre.MathspeakUtil.indexRadicalVerbose],["CSF","CSFopenRadicalBrief",sre.MathspeakUtil.openingRadicalBrief],["CSF","CSFcloseRadicalBrief",sre.MathspeakUtil.closingRadicalBrief],["CSF","CSFindexRadicalBrief",sre.MathspeakUtil.indexRadicalBrief],["CSF","CSFopenRadicalSbrief",sre.MathspeakUtil.openingRadicalSbrief],["CSF","CSFindexRadicalSbrief",sre.MathspeakUtil.indexRadicalSbrief],["CSF","CSFsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose], +["CSF","CSFsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFbaselineVerbose",sre.MathspeakUtil.baselineVerbose],["CSF","CSFbaselineBrief",sre.MathspeakUtil.baselineBrief],["CSF","CSFleftsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFleftsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFrightsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose], +["CSF","CSFrightsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFleftsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFleftsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFrightsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFrightsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFunderscript",sre.MathspeakUtil.nestedUnderscore],["CSF","CSFoverscript",sre.MathspeakUtil.nestedOverscore],["CTXF","CTXFordinalCounter",sre.NumbersUtil.ordinalCounter], +["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator],["CQF","CQFdetIsSimple",sre.MathspeakUtil.determinantIsSimple],["CSF","CSFRemoveParens",sre.MathspeakUtil.removeParens],["CQF","CQFresetNesting",sre.MathspeakUtil.resetNestingDepth]],rules:['Rule{collapsed{default{[t] "collapsed"; [n] . (engine:modality=summary,grammar:collapsed){self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split("{"),["SpecializedRule","collapsed","default","brief"], +["SpecializedRule","collapsed","brief","sbrief"],"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),["Rule","unknown","default","[n] text()","self::unknown"],'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(";"),["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule;blank-empty;default;[t] "Blank";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(";"),'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"), +'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),'Rule{german-font{default{[t] "German"; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="fraktur"'.split("{"), +'Rule{german-font{default{[t] "bold German"; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="bold-fraktur"'.split("{"),["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [t] "and"; [n] children/*[2]; ,self::number,@role="mixed"'.split(","),'Rule{number-with-chars{default{[t] "Number"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split("{"), +["SpecializedRule","number-with-chars","default","brief",'[t] "Num"; [m] CQFspaceoutNumber (grammar:protected)'],["SpecializedRule","number-with-chars","brief","sbrief"],'Rule{number-as-upper-word{default{[t] "UpperWord"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split("{"), +["SpecializedRule","number-as-upper-word","default","brief"],["SpecializedRule","number-as-upper-word","default","sbrief"],'Rule{number-baseline{default{[t] "Baseline"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline","default", +"brief",'[t] "Base"; [n] . (grammar:baseline)'],["SpecializedRule","number-baseline","brief","sbrief"],'Rule{number-baseline-font{default{[t] "Baseline"; [t] @font; [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline-font","default","brief", +'[t] "Base"; [t] @font; [n] . (grammar:ignoreFont=@font)'],["SpecializedRule","number-baseline-font","brief","sbrief"],'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(";"), +["Rule","identifier","default","[n] text()","self::identifier"],'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(","),["Aliases","negative","self::prefixop",'@role="negative"',"children/number"],["Aliases","negative","self::prefixop",'@role="negative"','children/fraction[@role="vulgar"]'],'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative"'.split(","),["Rule","prefix","default","[m] content/*; [n] children/*[1]", +"self::prefixop"],["Rule","postfix","default","[n] children/*[1]; [m] content/*","self::postfixop"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(";"),["Aliases","implicit","self::infixop",'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"'],'Rule,subtraction,default,[m] children/* (separator:"minus");,self::infixop,@role="subtraction"'.split(","), +["Rule","function-unknown","default","[n] children/*[1]; [n] children/*[2]","self::appl"],'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(","),'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(","),'Rule,fences-neutral,default,[t] "StartAbsoluteValue"; [n] children/*[1]; [t] "EndAbsoluteValue",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(","), +["SpecializedRule","fences-neutral","default","sbrief",'[t] "AbsoluteValue"; [n] children/*[1]; [t] "EndAbsoluteValue"'],'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(","),'Rule,fences-set,default,[t] "StartSet"; [n] children/*[1]; [t] "EndSet",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(","),["SpecializedRule","fences-set","default", +"sbrief",'[t] "Set"; [n] children/*[1]; [t] "EndSet"'],["Rule","text","default","[n] text()","self::text"],'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"),'Rule;minus;default;[t] "minus";self::operator;text()="-"'.split(";"),'Rule;single-prime;default;[t] "prime";self::punctuated;@role="prime";count(children/*)=1'.split(";"),'Rule;double-prime;default;[t] "double prime";self::punctuated;@role="prime";count(children/*)=2'.split(";"), +'Rule;triple-prime;default;[t] "triple prime";self::punctuated;@role="prime";count(children/*)=3'.split(";"),'Rule;quadruple-prime;default;[t] "quadruple prime";self::punctuated;@role="prime";count(children/*)=4'.split(";"),'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(","),["Rule","fraction","default","[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose","self::fraction"],["Rule","fraction", +"brief","[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief","self::fraction"],["Rule","fraction","sbrief","[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief","self::fraction"],'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(";"),["SpecializedRule","vulgar-fraction","default","brief"],["SpecializedRule","vulgar-fraction","default", +"sbrief"],'Rule,continued-fraction-outer,default,[t] "ContinuedFraction"; [n] children/*[1];[t] "Over"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","),["SpecializedRule","continued-fraction-outer","default","brief",'[t] "ContinuedFrac"; [n] children/*[1];[t] "Over"; [n] children/*[2]'],["SpecializedRule","continued-fraction-outer","brief","sbrief"],'Rule,continued-fraction-inner,default,[t] "StartFraction"; [n] children/*[1];[t] "Over"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","), +["SpecializedRule","continued-fraction-inner","default","brief",'[t] "StartFrac"; [n] children/*[1];[t] "Over"; [n] children/*[2]'],["SpecializedRule","continued-fraction-inner","brief","sbrief",'[t] "Frac"; [n] children/*[1];[t] "Over"; [n] children/*[2]'],["Rule","sqrt","default","[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose","self::sqrt"],["Rule","sqrt","brief","[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],["Rule","sqrt","sbrief", +"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],["Rule","root","default","[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose","self::root"],["Rule","root","brief","[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],["Rule","root","sbrief","[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief", +"self::root"],'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","), +'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"), +'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),["Rule","limboth-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "Endscripts"',"self::limboth"],["Rule","limlower-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "Endscripts"',"self::limlower"],["Rule","limupper-end", +"default",'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "Endscripts"',"self::limupper"],["Aliases","limlower-end","self::underscore",'@role="limit function"'],["Aliases","limlower-end","self::underscore"],["Aliases","limupper-end","self::overscore"],["Rule","integral","default","[n] children/*[1]; [n] children/*[2]; [n] children/*[3];","self::integral"],'Rule,integral,default,[n] children/*[1]; [t] "Subscript"; [n] children/*[2];[t] "Superscript"; [n] children/*[3]; [t] "Baseline";,self::limboth,@role="integral"'.split(","), +["SpecializedRule","integral","default","brief",'[n] children/*[1]; [t] "Sub"; [n] children/*[2];[t] "Sup"; [n] children/*[3]; [t] "Base";'],["SpecializedRule","integral","brief","sbrief"],["Rule","bigop","default","[n] children/*[1]; [n] children/*[2];","self::bigop"],["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(","), +'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(";"),["Rule","multrel","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::multirel"],["Rule","subscript","default","[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]","self::subscript"],["Rule","subscript","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]","self::subscript"],["SpecializedRule","subscript","brief","sbrief"], +'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(","),["SpecializedRule","subscript-simple","default","brief"],["SpecializedRule","subscript-simple","default","sbrief"],'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","subscript-baseline","default","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","subscript-baseline","brief","sbrief"],'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","subscript-baseline", +"self::subscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel",sre.MathspeakUtil.generateBaselineConstraint()],["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)","@embellished"],'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["SpecializedRule","subscript-empty-sup", +"default","brief"],["SpecializedRule","subscript-empty-sup","brief","sbrief"],["Aliases","subscript-empty-sup","self::subscript",'name(children/*[2])="superscript"','name(children/*[2]/children/*[1])="empty"'],["Rule","superscript","default","[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]","self::superscript"],["SpecializedRule","superscript","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]"],["SpecializedRule","superscript","brief","sbrief"],'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","superscript-baseline","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief"],["SpecializedRule","superscript-baseline","brief","sbrief"],'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","superscript-baseline","self::superscript", +"not(following-sibling::*)","ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt"],["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel","not(@embellished)",sre.MathspeakUtil.generateBaselineConstraint()],'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(" "),'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","), +["SpecializedRule","superscript-empty-sub","default","brief"],["SpecializedRule","superscript-empty-sub","brief","sbrief"],["Aliases","superscript-empty-sub","self::superscript",'name(children/*[2])="subscript"','name(children/*[2]/children/*[1])="empty"'],'Rule,square,default,[n] children/*[1]; [t] "squared",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","square","default","brief"],["SpecializedRule","square","default","sbrief"],'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,cube,default,[n] children/*[1]; [t] "cubed",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","cube","default","brief"],["SpecializedRule","cube","default","sbrief"],'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(","),["SpecializedRule","prime","default","brief"],["SpecializedRule","prime","default","sbrief"],'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(","), +["SpecializedRule","prime-subscript","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]"],["SpecializedRule","prime-subscript","brief","sbrief"],'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(","), +["SpecializedRule","prime-subscript-baseline","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief"],["SpecializedRule","prime-subscript-baseline","brief","sbrief"],'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(" "),'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(","), +["SpecializedRule","prime-subscript-simple","default","brief"],["SpecializedRule","prime-subscript-simple","default","sbrief"],'Rule,overscore,default,[t] "ModifyingAbove"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(","),["SpecializedRule","overscore","default","brief",'[t] "ModAbove"; [n] children/*[1]; [t] "With"; [n] children/*[2]'],["SpecializedRule","overscore","brief","sbrief"],'Rule,double-overscore,default,[t] "ModifyingAbove Above"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(","), +["SpecializedRule","double-overscore","default","brief",'[t] "ModAbove Above"; [n] children/*[1]; [t] "With"; [n] children/*[2]'],["SpecializedRule","double-overscore","brief","sbrief"],'Rule,underscore,default,[t] "ModifyingBelow"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(","),["SpecializedRule","underscore","default","brief",'[t] "ModBelow"; [n] children/*[1]; [t] "With"; [n] children/*[2]'],["SpecializedRule","underscore","brief", +"sbrief"],'Rule,double-underscore,default,[t] "ModifyingBelow Below"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(","),["SpecializedRule","double-underscore","default","brief",'[t] "ModBelow Below"; [n] children/*[1]; [t] "With"; [n] children/*[2]'],["SpecializedRule","double-underscore","brief","sbrief"],'Rule,overbar,default,[n] children/*[1]; [t] "overbar",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","), +["SpecializedRule","overbar","default","brief",'[n] children/*[1]; [t] "overBar"'],["SpecializedRule","overbar","brief","sbrief"],'Rule,underbar,default,[n] children/*[1]; [t] "underbar",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","),["SpecializedRule","underbar","default","brief",'[n] children/*[1]; [t] "underBar"'], +["SpecializedRule","underbar","brief","sbrief"],'Rule,overtilde,default,[n] children/*[1]; [t] "overTilde",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","),["SpecializedRule","overtilde","default","brief",'[n] children/*[1]; [t] "overtilde"'],["SpecializedRule","overtilde","brief","sbrief"],'Rule,undertilde,default,[n] children/*[1]; [t] "underTilde",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","), +["SpecializedRule","undertilde","default","brief",'[n] children/*[1]; [t] "undertilde"'],["SpecializedRule","undertilde","brief","sbrief"],'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(","),["Rule","matrix","default",'[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Matrix"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndMatrix"',"self::matrix"],["Rule","matrix","sbrief", +'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Matrix"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndMatrix"',"self::matrix"],["Aliases","matrix","self::vector"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column");[p] (pause: 200)',"self::row"],'Rule{row-with-label{default{[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split("{"), +'Rule{row-with-label{brief{[t] "Label"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split("{"),["SpecializedRule","row-with-label","brief","sbrief"],'Rule{row-with-text-label{sbrief{[t] "Label"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content{name(content/cell/children/*[1])="text"'.split("{"),'Rule;empty-row;default;[t] "Blank";self::row;count(children/*)=0'.split(";"),["Rule","matrix-cell", +"default","[n] children/*[1]; [p] (pause: 300)","self::cell"],'Rule,empty-cell,default,[t] "Blank"; [p] (pause: 300),self::cell,count(children/*)=0'.split(","),'Rule{determinant{default{[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndDeterminant"{self::matrix{@role="determinant"'.split("{"),["SpecializedRule","determinant","default","sbrief",'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndDeterminant"'], +'Rule{determinant-simple{default{[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row",grammar:simpleDet); [t] "EndDeterminant"{self::matrix{@role="determinant"{CQFdetIsSimple'.split("{"),["SpecializedRule","determinant-simple","default","sbrief",'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row",grammar:simpleDet); [t] "EndDeterminant"'], +'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split("{"),["Rule","layout","default",'[t] "StartLayout"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',"self::table"],["Rule","layout","sbrief",'[t] "Layout"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',"self::table"],'Rule,binomial,default,[t] "StartBinomialOrMatrix"; [n] children/*[1]/children/*[1]; [t] "Choose"; [n] children/*[2]/children/*[1]; [t] "EndBinomialOrMatrix",self::vector,@role="binomial"'.split(","), +'Rule,binomial,sbrief,[t] "BinomialOrMatrix"; [n] children/*[1]/children/*[1]; [t] "Choose"; [n] children/*[2]/children/*[1]; [t] "EndBinomialOrMatrix",self::vector,@role="binomial"'.split(","),["Rule","cases","default",'[t] "StartLayout"; [t] "Enlarged"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',"self::cases"],["Rule","cases","sbrief",'[t] "Layout"; [t] "Enlarged"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"', +"self::cases"],["Aliases","layout","self::multiline"],["Rule","line","default","[m] children/*","self::line"],'Rule,line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel" (pause: 200); [m] children/*,self::line,content'.split(","),["SpecializedRule","line-with-label","default","brief",'[t] "Label"; [n] content/*[1] (pause: 200); [m] children/*'],["SpecializedRule","line-with-label","brief","sbrief"],'Rule,line-with-text-label,sbrief,[t] "Label"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(","), +'Rule;empty-line;default;[t] "Blank";self::line;count(children/*)=0;not(content)'.split(";"),["SpecializedRule","empty-line","default","brief"],["SpecializedRule","empty-line","brief","sbrief"],'Rule,empty-line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [t] "Blank",self::line,count(children/*)=0,content'.split(","),["SpecializedRule","empty-line-with-label","default","brief",'[t] "Label"; [n] content/*[1] (pause: 200); [t] "Blank"'],["SpecializedRule","empty-line-with-label", +"brief","sbrief"],["Rule","enclose","default",'[t] "StartEnclose"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "EndEnclose"',"self::enclose"],["Aliases","overbar","self::enclose",'@role="top"'],["Aliases","underbar","self::enclose",'@role="bottom"'],'Rule,leftbar,default,[t] "vertical bar"; [n] children/*[1],self::enclose,@role="left"'.split(","),'Rule,rightbar,default,[n] children/*[1]; [t] "vertical bar",self::enclose,@role="right"'.split(","),'Rule,crossout,default,[t] "CrossOut"; [n] children/*[1]; [t] "EndCrossOut",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","), +'Rule,cancel,default,[t] "CrossOut"; [n] children/*[1]/children/*[1]; [t] "With"; [n] children/*[2]; [t] "EndCrossOut",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),["SpecializedRule","cancel","default","brief"],["SpecializedRule","cancel","default","sbrief"],["Aliases","cancel","self::underscore",'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'],'Rule,cancel-reverse,default,[t] "CrossOut"; [n] children/*[2]/children/*[1]; [t] "With"; [n] children/*[1]; [t] "EndCrossOut",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(","), +["SpecializedRule","cancel-reverse","default","brief"],["SpecializedRule","cancel-reverse","default","sbrief"],["Aliases","cancel-reverse","self::underscore",'name(children/*[2])="enclose"','children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'],'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(";"),'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(","), +["Rule","punctuated","default","[m] children/*","self::punctuated"],'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(";"),'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(";"),'Rule,unit-divide,default,[n] children/*[1]; [t] "per"; [n] children/*[2],self::fraction,@role="unit"'.split(","),["Rule","inference","default",'[t] "inference rule"; [m] content/*; [t] "with conclusion"; [n] children/*[1]; [t] "and"; [t] count(children/*[2]/children/*); [t] "premises"', +"self::inference"],'Rule,inference,default,[t] "inference rule"; ; [m] content/*; [t] "with conclusion"; [n] children/*[1]; [t] "and"; [t] count(children/*[2]/children/*); [t] "premise",self::inference,count(children/*[2]/children/*)<2'.split(","),["Rule","premise","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"premise ");',"self::premises"],["Rule","conclusion","default","[n] children/*[1]","self::conclusion"],["Rule","label","default",'[t] "label"; [n] children/*[1]',"self::rulelabel"], +'Rule,axiom,default,[t] "axiom"; [m] children/*[1];,self::inference,@role="axiom"'.split(","),'Rule,axiom,default,[t] "empty axiom";,self::empty,@role="axiom"'.split(",")],initialize:[sre.MathspeakUtil.generateTensorRules]};sre.MathspeakSpanishUtil={};sre.MathspeakSpanishUtil.ordinalCounter=function(a,b){var c=0;return function(){return sre.Messages.NUMBERS.numberToOrdinal(++c,!1)+" "+b}};sre.MathspeakSpanishUtil.smallRoot=function(a){if(!a.childNodes||0===a.childNodes.length||!a.childNodes[0].childNodes)return[];var b=a.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(b))return[];b=parseInt(b,10);return 1=b?[a]:[]};sre.UnitUtil={};sre.UnitUtil.unitMultipliers=function(a,b){var c=0;return function(){var d=sre.AuditoryDescription.create({text:sre.UnitUtil.rightMostUnit(a[c])&&sre.UnitUtil.leftMostUnit(a[c+1])?sre.Messages.UNIT_TIMES:""},{});c++;return[d]}};sre.UnitUtil.SCRIPT_ELEMENTS=[sre.SemanticAttr.Type.SUPERSCRIPT,sre.SemanticAttr.Type.SUBSCRIPT,sre.SemanticAttr.Type.OVERSCORE,sre.SemanticAttr.Type.UNDERSCORE]; +sre.UnitUtil.rightMostUnit=function(a){for(;a;){if("unit"===a.getAttribute("role"))return!0;var b=a.tagName;a=sre.XpathUtil.evalXPath("children/*",a);a=-1!==sre.UnitUtil.SCRIPT_ELEMENTS.indexOf(b)?a[0]:a[a.length-1]}return!1};sre.UnitUtil.leftMostUnit=function(a){for(;a;){if("unit"===a.getAttribute("role"))return!0;a=sre.XpathUtil.evalXPath("children/*",a)[0]}return!1}; +sre.UnitUtil.oneLeft=function(a){for(;a;){if("number"===a.tagName&&"1"===a.textContent)return[a];if("infixop"!==a.tagName||"multiplication"!==a.getAttribute("role")&&"implicit"!==a.getAttribute("role"))break;a=sre.XpathUtil.evalXPath("children/*",a)[0]}return[]};sre.MathspeakSpanish={locale:"es",domain:"mathspeak",functions:[["CQF","CQFspaceoutNumber",sre.MathspeakUtil.spaceoutNumber],["CQF","CQFspaceoutIdentifier",sre.MathspeakUtil.spaceoutIdentifier],["CSF","CSFspaceoutText",sre.MathspeakUtil.spaceoutText],["CSF","CSFopenFracVerbose",sre.MathspeakUtil.openingFractionVerbose],["CSF","CSFcloseFracVerbose",sre.MathspeakUtil.closingFractionVerbose],["CSF","CSFoverFracVerbose",sre.MathspeakUtil.overFractionVerbose],["CSF","CSFopenFracBrief",sre.MathspeakUtil.openingFractionBrief], +["CSF","CSFcloseFracBrief",sre.MathspeakUtil.closingFractionBrief],["CSF","CSFopenFracSbrief",sre.MathspeakUtil.openingFractionSbrief],["CSF","CSFcloseFracSbrief",sre.MathspeakUtil.closingFractionSbrief],["CSF","CSFoverFracSbrief",sre.MathspeakUtil.overFractionSbrief],["CSF","CSFopenRadicalVerbose",sre.MathspeakUtil.openingRadicalVerbose],["CSF","CSFcloseRadicalVerbose",sre.MathspeakUtil.closingRadicalVerbose],["CSF","CSFindexRadicalVerbose",sre.MathspeakUtil.indexRadicalVerbose],["CSF","CSFopenRadicalBrief", +sre.MathspeakUtil.openingRadicalBrief],["CSF","CSFcloseRadicalBrief",sre.MathspeakUtil.closingRadicalBrief],["CSF","CSFindexRadicalBrief",sre.MathspeakUtil.indexRadicalBrief],["CSF","CSFopenRadicalSbrief",sre.MathspeakUtil.openingRadicalSbrief],["CSF","CSFindexRadicalSbrief",sre.MathspeakUtil.indexRadicalSbrief],["CQF","CQFisSmallRoot",sre.MathspeakSpanishUtil.smallRoot],["CSF","CSFsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFsuperscriptBrief",sre.MathspeakUtil.superscriptBrief], +["CSF","CSFsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFbaselineVerbose",sre.MathspeakUtil.baselineVerbose],["CSF","CSFbaselineBrief",sre.MathspeakUtil.baselineBrief],["CSF","CSFleftsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFleftsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFrightsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFrightsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose], +["CSF","CSFleftsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFleftsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFrightsuperscriptBrief",sre.MathspeakUtil.superscriptBrief],["CSF","CSFrightsubscriptBrief",sre.MathspeakUtil.subscriptBrief],["CSF","CSFunderscript",sre.MathspeakUtil.nestedUnderscore],["CSF","CSFoverscript",sre.MathspeakUtil.nestedOverscore],["CTXF","CTXFordinalCounter",sre.MathspeakSpanishUtil.ordinalCounter],["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator], +["CTXF","CTXFunitMultipliers",sre.UnitUtil.unitMultipliers],["CQF","CQFdetIsSimple",sre.MathspeakUtil.determinantIsSimple],["CSF","CSFRemoveParens",sre.MathspeakUtil.removeParens],["CQF","CQFoneLeft",sre.UnitUtil.oneLeft],["CQF","CQFresetNesting",sre.MathspeakUtil.resetNestingDepth]],rules:['Rule{collapsed{default{[n] . (engine:modality=summary,grammar:collapsed); [t] "plegado";{self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split("{"),["SpecializedRule", +"collapsed","default","brief"],["SpecializedRule","collapsed","brief","sbrief"],"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),["Rule","unknown","default","[n] text()","self::unknown"],'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(";"),["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule;blank-empty;default;[t] "espacio";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(";"),'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"), +'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [t] "m\u00e1s"; [n] children/*[2]; ,self::number,@role="mixed"'.split(","), +'Rule{number-with-chars{default{[t] "n\u00famero"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split("{"),["SpecializedRule","number-with-chars","default","brief",'[t] "n\u00fam"; [m] CQFspaceoutNumber (grammar:protected)'],["SpecializedRule","number-with-chars","brief","sbrief"],'Rule{number-as-upper-word{default{[t] "may\u00fascula"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split("{"), +["SpecializedRule","number-as-upper-word","default","brief"],["SpecializedRule","number-as-upper-word","default","sbrief"],'Rule{number-baseline{default{[t] "l\u00ednea base"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline", +"default","brief",'[t] "base"; [n] text()'],["SpecializedRule","number-baseline","brief","sbrief"],'Rule{number-baseline-font{default{[t] "l\u00ednea base"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),["SpecializedRule","number-baseline-font", +"default","brief",'[t] "base"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font)'],["SpecializedRule","number-baseline-font","brief","sbrief"],'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(";"), +["Rule","identifier","default","[n] text()","self::identifier"],'Rule,negative,default,[t] "menos"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(","),["Aliases","negative","self::prefixop",'@role="negative"',"children/number"],["Aliases","negative","self::prefixop",'@role="negative"','children/fraction[@role="vulgar"]'],'Rule,negative,default,[t] "menos"; [n] children/*[1],self::prefixop,@role="negative"'.split(","),["Rule","prefix","default","[m] content/*; [n] children/*[1]", +"self::prefixop"],["Rule","postfix","default","[n] children/*[1]; [m] content/*","self::postfixop"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(";"),["Aliases","implicit","self::infixop",'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"'],'Rule,subtraction,default,[m] children/* (separator:"menos");,self::infixop,@role="subtraction"'.split(","), +["Rule","function-unknown","default","[n] children/*[1]; [n] children/*[2]","self::appl"],'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(","),'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(","),'Rule,fences-neutral,default,[t] "empezar valor absoluto"; [n] children/*[1]; [t] "finalizar valor absoluto",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(","), +["SpecializedRule","fences-neutral","default","sbrief",'[t] "valor absoluto"; [n] children/*[1]; [t] "finalizar valor absoluto"'],'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(","),'Rule,fences-set,default,[t] "empezar llave"; [n] children/*[1]; [t] "finalizar llave",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(","),["SpecializedRule", +"fences-set","default","sbrief",'[t] "llave"; [n] children/*[1]; [t] "finalizar llave"'],["Rule","text","default","[n] text() (grammar:noTranslateText)","self::text"],'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"),'Rule;minus;default;[t] "menos";self::operator;text()="-"'.split(";"),'Rule;single-prime;default;[t] "prima";self::punctuated;@role="prime";count(children/*)=1'.split(";"),'Rule;double-prime;default;[t] "doble prima";self::punctuated;@role="prime";count(children/*)=2'.split(";"), +'Rule;triple-prime;default;[t] "triple prima";self::punctuated;@role="prime";count(children/*)=3'.split(";"),'Rule;quadruple-prime;default;[t] "cuadruplicar prima";self::punctuated;@role="prime";count(children/*)=4'.split(";"),'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(","),["Rule","fraction","default","[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose","self::fraction"],["Rule","fraction", +"brief","[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief","self::fraction"],["Rule","fraction","sbrief","[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief","self::fraction"],'Rule,continued-fraction-outer,default,[t] "fracci\u00f3n continua"; [n] children/*[1];[t] "entre"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","), +["SpecializedRule","continued-fraction-outer","default","brief",'[t] "frac continua"; [n] children/*[1];[t] "entre"; [n] children/*[2]'],["SpecializedRule","continued-fraction-outer","brief","sbrief"],'Rule,continued-fraction-inner,default,[t] "empezar fracci\u00f3n"; [n] children/*[1];[t] "entre"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(","),["SpecializedRule","continued-fraction-inner","default", +"brief",'[t] "empezar frac"; [n] children/*[1];[t] "entre"; [n] children/*[2]'],["SpecializedRule","continued-fraction-inner","brief","sbrief",'[t] "frac"; [n] children/*[1];[t] "entre"; [n] children/*[2]'],["Rule","sqrt","default","[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose","self::sqrt"],["Rule","sqrt","brief","[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief","self::sqrt"],["Rule","sqrt","sbrief","[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief", +"self::sqrt"],"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,CQFisSmallRoot".split(","),"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(","),"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(","),["Rule","root","default","[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose", +"self::root"],["Rule","root","brief","[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],["Rule","root","sbrief","[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief","self::root"],'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","), +'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"), +'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),["Rule","limboth-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "finalizar \u00edndices"', +"self::limboth"],["Rule","limlower-end","default",'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "finalizar \u00edndices"',"self::limlower"],["Rule","limupper-end","default",'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "finalizar \u00edndices"',"self::limupper"],["Aliases","limlower-end","self::underscore",'@role="limit function"'],["Aliases","limlower-end","self::underscore"],["Aliases","limupper-end","self::overscore"],["Rule","integral","default","[n] children/*[1]; [n] children/*[2]; [n] children/*[3];", +"self::integral"],'Rule,integral,default,[n] children/*[1]; [t] "definida"; [t] "sub\u00edndice"; [n] children/*[2];[t] "super\u00edndice"; [n] children/*[3]; [t] "l\u00ednea base";,self::limboth,@role="integral"'.split(","),["SpecializedRule","integral","default","brief",'[n] children/*[1]; [t] "Sub"; [n] children/*[2];[t] "Sup"; [n] children/*[3]; [t] "Base";'],["SpecializedRule","integral","brief","sbrief"],["Rule","bigop","default","[n] children/*[1]; [n] children/*[2];","self::bigop"],["Rule", +"relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(","),'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(";"),["Rule","multrel","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::multirel"],["Rule","subscript","default","[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]", +"self::subscript"],["Rule","subscript","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]","self::subscript"],["SpecializedRule","subscript","brief","sbrief"],'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","subscript-baseline","default","brief","[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBriefS"],["SpecializedRule","subscript-baseline","brief","sbrief"],'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","subscript-baseline", +"self::subscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel",sre.MathspeakUtil.generateBaselineConstraint()],["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)","@embellished"],'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["SpecializedRule","subscript-empty-sup", +"default","brief"],["SpecializedRule","subscript-empty-sup","brief","sbrief"],["Aliases","subscript-empty-sup","self::subscript",'name(children/*[2])="superscript"','name(children/*[2]/children/*[1])="empty"'],["Rule","superscript","default","[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]","self::superscript"],["SpecializedRule","superscript","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]"],["SpecializedRule","superscript","brief","sbrief"],'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +["SpecializedRule","superscript-baseline","default","brief","[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBriefS"],["SpecializedRule","superscript-baseline","brief","sbrief"],'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","superscript-baseline","self::superscript", +"not(following-sibling::*)","ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt"],["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel","not(@embellished)",sre.MathspeakUtil.generateBaselineConstraint()],'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(" "),'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","), +["SpecializedRule","superscript-empty-sub","default","brief"],["SpecializedRule","superscript-empty-sub","brief","sbrief"],["Aliases","superscript-empty-sub","self::superscript",'name(children/*[2])="subscript"','name(children/*[2]/children/*[1])="empty"'],'Rule,square,default,[n] children/*[1]; [t] "al cuadrado",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","square","default","brief"],["SpecializedRule","square","default","sbrief"],'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,cube,default,[n] children/*[1]; [t] "al cubo",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(","), +["SpecializedRule","cube","default","brief"],["SpecializedRule","cube","default","sbrief"],'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(";"),'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(","),["SpecializedRule","prime","default","brief"],["SpecializedRule","prime","default","sbrief"],'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(","), +["SpecializedRule","prime-subscript","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]"],["SpecializedRule","prime-subscript","brief","sbrief"],'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(","), +["SpecializedRule","prime-subscript-baseline","default","brief","[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBriefS"],["SpecializedRule","prime-subscript-baseline","brief","sbrief"],'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(" "),'Rule,overscore,default,[t] "modificando superior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(","), +["SpecializedRule","overscore","default","brief",'[t] "mod superior"; [n] children/*[1]; [t] "con"; [n] children/*[2]'],["SpecializedRule","overscore","brief","sbrief"],'Rule,double-overscore,default,[t] "modificando superior superior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(","),["SpecializedRule","double-overscore","default","brief",'[t] "mod superior superior"; [n] children/*[1]; [t] "con"; [n] children/*[2]'], +["SpecializedRule","double-overscore","brief","sbrief"],'Rule,underscore,default,[t] "modificando inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(","),["SpecializedRule","underscore","default","brief",'[t] "mod inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2]'],["SpecializedRule","underscore","brief","sbrief"],'Rule,double-underscore,default,[t] "modificando inferior inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(","), +["SpecializedRule","double-underscore","default","brief",'[t] "mod inferior inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2]'],["SpecializedRule","double-underscore","brief","sbrief"],'Rule,overbar,default,[n] children/*[1]; [t] "barra",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","),["SpecializedRule","overbar", +"default","brief",'[n] children/*[1]; [t] "barra"'],["SpecializedRule","overbar","brief","sbrief"],'Rule,underbar,default,[n] children/*[1]; [t] "subbarra",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(","),["SpecializedRule","underbar","default","brief",'[n] children/*[1]; [t] "subbarra"'],["SpecializedRule","underbar", +"brief","sbrief"],'Rule,overtilde,default,[n] children/*[1]; [t] "tilde",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","),["SpecializedRule","overtilde","default","brief",'[n] children/*[1]; [t] "tilde"'],["SpecializedRule","overtilde","brief","sbrief"],'Rule,undertilde,default,[n] children/*[1]; [t] "subtilde",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(","), +["SpecializedRule","undertilde","default","brief",'[n] children/*[1]; [t] "subtilde"'],["SpecializedRule","undertilde","brief","sbrief"],'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(","),["Rule","matrix","default",'[t] "empezar matriz"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar matriz"',"self::matrix"],["Rule","matrix","sbrief", +'[t] "matriz"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:" "); [t] "finalizar matriz"',"self::matrix"],["Aliases","matrix","self::vector"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna");[p] (pause: 200)',"self::row"],'Rule{row-with-label{default{[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content'.split("{"), +'Rule{row-with-label{brief{[t] "etiqueta"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content'.split("{"),["SpecializedRule","row-with-label","brief","sbrief"],'Rule{row-with-text-label{sbrief{[t] "etiqueta"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content{name(content/cell/children/*[1])="text"'.split("{"),'Rule;empty-row;default;[t] "espacio";self::row;count(children/*)=0'.split(";"),["Rule","matrix-cell", +"default","[n] children/*[1]; [p] (pause: 300)","self::cell"],'Rule,empty-cell,default,[t] "espacio"; [p] (pause: 300),self::cell,count(children/*)=0'.split(","),'Rule{determinant{default{[t] "empezar determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar determinante"{self::matrix{@role="determinant"'.split("{"),["SpecializedRule","determinant","default","sbrief",'[t] "determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar determinante"'], +'Rule{determinant-simple{default{[t] "empezar determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila",grammar:simpleDet); [t] "finalizar determinante"{self::matrix{@role="determinant"{CQFdetIsSimple'.split("{"),["SpecializedRule","determinant-simple","default","sbrief",'[t] "determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila",grammar:simpleDet); [t] "finalizar determinante"'], +'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split("{"),["Rule","layout","default",'[t] "empezar esquema"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',"self::table"],["Rule","layout","sbrief",'[t] "esquema"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',"self::table"],'Rule,binomial,default,[t] "empezar binomial"; [n] children/*[1]/children/*[1]; [t] "en"; [n] children/*[2]/children/*[1]; [t] "finalizar binomial",self::vector,@role="binomial"'.split(","), +'Rule,binomial,sbrief,[t] "binomial"; [n] children/*[1]/children/*[1]; [t] "en"; [n] children/*[2]/children/*[1]; [t] "finalizar binomial",self::vector,@role="binomial"'.split(","),["Rule","cases","default",'[t] "empezar esquema"; [n] content/*[1]; [t] "alargada"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',"self::cases"],["Rule","cases","sbrief",'[t] "esquema"; [n] content/*[1]; [t] "alargada"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"', +"self::cases"],["Aliases","layout","self::multiline"],["Rule","line","default","[m] children/*","self::line"],'Rule,line-with-label,default,[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [m] children/*,self::line,content'.split(","),["SpecializedRule","line-with-label","default","brief",'[t] "etiqueta"; [n] content/*[1] (pause: 200); [m] children/*'],["SpecializedRule","line-with-label","brief","sbrief"],'Rule,line-with-text-label,sbrief,[t] "etiqueta"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(","), +'Rule;empty-line;default;[t] "espacio";self::line;count(children/*)=0;not(content)'.split(";"),["SpecializedRule","empty-line","default","brief"],["SpecializedRule","empty-line","brief","sbrief"],'Rule,empty-line-with-label,default,[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [t] "espacio",self::line,count(children/*)=0,content'.split(","),["SpecializedRule","empty-line-with-label","default","brief",'[t] "etiqueta"; [n] content/*[1] (pause: 200); [t] "espacio"'],["SpecializedRule", +"empty-line-with-label","brief","sbrief"],["Rule","enclose","default",'[t] "empezar rodear"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "finalizar rodear"',"self::enclose"],["Aliases","overbar","self::enclose",'@role="top"'],["Aliases","underbar","self::enclose",'@role="bottom"'],'Rule,leftbar,default,[t] "barra vertical"; [n] children/*[1],self::enclose,@role="left"'.split(","),'Rule,rightbar,default,[n] children/*[1]; [t] "barra vertical",self::enclose,@role="right"'.split(","),'Rule,crossout,default,[t] "tachado"; [n] children/*[1]; [t] "finalizar tachado",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","), +'Rule,cancel,default,[t] "tachado"; [n] children/*[1]/children/*[1]; [t] "con"; [n] children/*[2]; [t] "finalizar tachado",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),["SpecializedRule","cancel","default","brief"],["SpecializedRule","cancel","default","sbrief"],["Aliases","cancel","self::underscore",'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'],'Rule,cancel-reverse,default,[t] "tachado"; [n] children/*[2]/children/*[1]; [t] "con"; [n] children/*[1]; [t] "finalizar tachado",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(","), +["SpecializedRule","cancel-reverse","default","brief"],["SpecializedRule","cancel-reverse","default","sbrief"],["Aliases","cancel-reverse","self::underscore",'name(children/*[2])="enclose"','children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'],'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(";"),'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(","), +["Rule","punctuated","default","[m] children/*","self::punctuated"],'Rule;unit-singular;default;[t] text() (grammar:annotation="unit":translate);self::identifier;@role="unit"'.split(";"),'Rule;unit-plural;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit";not(contains(@grammar, "singularUnit"))'.split(";"),'Rule,unit-square,default,[n] children/*[1]; [t] "cuadrado",self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(","), +'Rule,unit-cubic,default,[n] children/*[1]; [t] "c\u00fabico",self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(","),'Rule,reciprocal,default,[t] "rec\u00edproco"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(","),'Rule,reciprocal,default,[t] "por"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(","), +'Rule;unit-combine;default;[m] children/* (sepFunc:CTXFunitMultipliers);self::infixop;@role="unit"'.split(";"),'Rule,unit-combine-mult,default,[m] children/* (sepFunc:CTXFunitMultipliers);,self::infixop,@role="multiplication" or @role="implicit",children/*[@role="unit"]'.split(","),'Rule{unit-combiner-singular{default{[n] children/*[1]; [t] "por"; [m] children/*[position()>1] (grammar:!singularUnit, sepFunc:CTXFunitMultipliers){self::infixop{@role="unit"{name(children/*[1])!="number"{contains(@grammar, "singularUnit"){count(children/*)>1'.split("{"), +'Rule,unit-combine-singular-first,default,[n] children/*[1]; [n] children/*[2] (grammar:singularUnit); [t] "por"; [m] children/*[position()>2] (sepFunc:CTXFunitMultipliers),self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1]'.split(","),'Rule,unit-combine-singular-first,default,[n] children/*[1]; [n] children/*[2] (grammar:singularUnit); ,self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1],count(children/*)=2'.split(","),'Rule,unit-divide,default,[n] children/*[1]; [t] "por"; [n] children/*[2] (grammar:singularUnit),self::fraction,@role="unit"'.split(",")], +initialize:[sre.MathspeakUtil.generateTensorRules]};sre.NemethUtil={};sre.NemethUtil.openingFraction=function(a){a=sre.MathspeakUtil.fractionNestingDepth(a);return Array(a).join(sre.Messages.MS.FRACTION_REPEAT)+sre.Messages.MS.FRACTION_START};sre.NemethUtil.closingFraction=function(a){a=sre.MathspeakUtil.fractionNestingDepth(a);return Array(a).join(sre.Messages.MS.FRACTION_REPEAT)+sre.Messages.MS.FRACTION_END};sre.NemethUtil.overFraction=function(a){a=sre.MathspeakUtil.fractionNestingDepth(a);return Array(a).join(sre.Messages.MS.FRACTION_REPEAT)+sre.Messages.MS.FRACTION_OVER}; +sre.NemethUtil.overBevelledFraction=function(a){a=sre.MathspeakUtil.fractionNestingDepth(a);return Array(a).join(sre.Messages.MS.FRACTION_REPEAT)+"\u2838"+sre.Messages.MS.FRACTION_OVER};sre.NemethUtil.nestedRadical=function(a,b){a=sre.NemethUtil.radicalNestingDepth(a);return 1===a?b:Array(a).join(sre.Messages.MS.NESTED)+b};sre.NemethUtil.radicalNestingDepth=function(a,b){b=b||0;return a.parentNode?sre.NemethUtil.radicalNestingDepth(a.parentNode,"root"===a.tagName||"sqrt"===a.tagName?b+1:b):b}; +sre.NemethUtil.openingRadical=function(a){return sre.NemethUtil.nestedRadical(a,sre.Messages.MS.STARTROOT)};sre.NemethUtil.closingRadical=function(a){return sre.NemethUtil.nestedRadical(a,sre.Messages.MS.ENDROOT)};sre.NemethUtil.indexRadical=function(a){return sre.NemethUtil.nestedRadical(a,sre.Messages.MS.ROOTINDEX)}; +sre.NemethUtil.enlargeFence=function(a){if(1===a.length)return"\u2820"+a;var b=a.split("");return b.every(function(c){return"\u2833"===c})?"\u2820"+b.join("\u2820"):a.slice(0,1)+"\u2820"+a.slice(1)};sre.Grammar.getInstance().setCorrection("enlargeFence",sre.NemethUtil.enlargeFence);sre.NemethUtil.NUMBER_PROPAGATORS_=[sre.SemanticAttr.Type.MULTIREL,sre.SemanticAttr.Type.RELSEQ,sre.SemanticAttr.Type.PUNCTUATED,sre.SemanticAttr.Type.APPL]; +sre.NemethUtil.checkParent_=function(a){a=a.parent;if(!a)return!1;var b=a.type;return-1!==sre.NemethUtil.NUMBER_PROPAGATORS_.indexOf(b)||b===sre.SemanticAttr.Type.PREFIXOP&&a.role===sre.SemanticAttr.Role.NEGATIVE?!0:!1};sre.NemethUtil.propagateNumber=function(a,b){if(!a.childNodes.length)return sre.NemethUtil.checkParent_(a)&&(b.number=!0),[b.number?"number":"",{number:!1}];sre.NemethUtil.checkParent_(a)&&(b.number=!0);return["",b]}; +sre.NemethUtil.numberIndicator=function(){return new sre.SemanticVisitor("nemeth",sre.NemethUtil.propagateNumber,{number:!0})};sre.NemethUtil.addAnnotators=function(){sre.SemanticAnnotations.getInstance().register(sre.NemethUtil.numberIndicator())};sre.NemethUtil.componentString_={2:"CSFbaseline",1:"CSFsubscript",0:"CSFsuperscript"};sre.NemethUtil.childNumber_={4:2,3:3,2:1,1:4,0:5}; +sre.NemethUtil.generateTensorRuleStrings_=function(a){var b=[],c="";a=parseInt(a,2);for(var d=0;5>d;d++){var e="children/*["+sre.NemethUtil.childNumber_[d]+"]";a&1?c="[t] "+sre.NemethUtil.componentString_[d%3]+"Verbose; [n] "+e+";"+c:b.unshift("name("+e+')="empty"');a>>=1}b.push(c);return b}; +sre.NemethUtil.generateTensorRules=function(a){var b=goog.bind(a.defineRule,a);a=goog.bind(a.defineRulesAlias,a);for(var c="11111 11110 11101 11100 10111 10110 10101 10100 01111 01110 01101 01100".split(" "),d=0,e;e=c[d];d++){var f="tensor"+e;e=sre.NemethUtil.generateTensorRuleStrings_(e);var g=e.pop(),h=[f,"default.default",g,"self::tensor"].concat(e);b.apply(null,h);g+="; [t]"+sre.NemethUtil.componentString_[2]+"Verbose";f+="-baseline";h=[f,"default.default",g,"self::tensor","following-sibling::*"].concat(e); +b.apply(null,h);f=[f,"self::tensor","not(following-sibling::*)","ancestor::fraction|ancestor::punctuated|ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::relseq|ancestor::multirel|@embellished"].concat(e);a.apply(null,f)}};sre.NemethRules={locale:"nemeth",modality:"braille",domain:"default",functions:[["CQF","CQFspaceoutNumber",sre.MathspeakUtil.spaceoutNumber],["CQF","CQFspaceoutIdentifier",sre.MathspeakUtil.spaceoutIdentifier],["CSF","CSFspaceoutText",sre.MathspeakUtil.spaceoutText],["CSF","CSFopenFraction",sre.NemethUtil.openingFraction],["CSF","CSFcloseFraction",sre.NemethUtil.closingFraction],["CSF","CSFoverFraction",sre.NemethUtil.overFraction],["CSF","CSFoverBevFraction",sre.NemethUtil.overBevelledFraction], +["CSF","CSFopenRadicalVerbose",sre.NemethUtil.openingRadical],["CSF","CSFcloseRadicalVerbose",sre.NemethUtil.closingRadical],["CSF","CSFindexRadicalVerbose",sre.NemethUtil.indexRadical],["CSF","CSFsuperscriptVerbose",sre.MathspeakUtil.superscriptVerbose],["CSF","CSFsubscriptVerbose",sre.MathspeakUtil.subscriptVerbose],["CSF","CSFbaselineVerbose",sre.MathspeakUtil.baselineVerbose],["CSF","CSFunderscript",sre.MathspeakUtil.nestedUnderscore],["CSF","CSFoverscript",sre.MathspeakUtil.nestedOverscore], +["CTXF","CTXFordinalCounter",sre.NumbersUtil.ordinalCounter],["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator],["CQF","CQFdetIsSimple",sre.MathspeakUtil.determinantIsSimple],["CSF","CSFRemoveParens",sre.MathspeakUtil.removeParens],["CQF","CQFresetNesting",sre.MathspeakUtil.resetNestingDepth]],rules:["Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),["Rule","unknown","default","[n] text()","self::unknown"],'Rule;protected;default;[t] text();self::*;@role="protected"'.split(";"), +["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule;blank-empty;default;[t] "\u2800";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(";"),'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"),'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;@role!="greekletter";not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),'Rule{number-indicator{default{[t] "\u283c"; [n] text() (pause:10){self::number{contains(@annotation, "nemeth:number"){not(ancestor::sqrt){not(ancestor::root){not(ancestor::fraction)'.split("{"), +["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [t] "\u2838\u2839"; [n] children/*[2]/children/*[1]; [t] "\u280c"; [n] children/*[2]/children/*[2]; [t] "\u2838\u283c",self::number,@role="mixed"'.split(","),'Rule{number-with-chars{default{[t] "\u283c"; [m] CQFspaceoutNumber{self::number{"" != translate(text(), "0123456789.,", ""){text() != translate(text(), "0123456789.,", "")'.split("{"),'Rule{number-as-upper-word{default{[t] "UpperWord"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split("{"), +'Rule{number-baseline{default{[t] "\u2810"; [n] text(){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"),'Rule{number-baseline-font{default{[t] "\u2810"; [t] @font; [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split("{"), +'Rule;identifier;default;[n] text();self::identifier;@role="protected"'.split(";"),'Rule,negative,default,[t] "\u2824"; [n] children/*[1],self::prefixop,@role="negative"'.split(","),["Rule","prefix","default","[n] text(); [n] children/*[1]","self::prefixop"],["Rule","postfix","default","[n] children/*[1]; [n] text()","self::postfixop"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(";"), +["Aliases","implicit","self::infixop",'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"'],["Rule","function-named","default",'[n] children/*[1]; [t] "\u2800"; [n] children/*[2]',"self::appl"],'Rule,function-prefix,default,[n] content/*[1]; [t] "\u2800"; [n] children/*[1],self::prefixop,content/*[1][@role="infix function"]'.split(","),'Rule,function-infix,default,[n] children/*[1]; [n] content/*[1]; [t] "\u2800"; [n] children/*[2],self::infixop,@role="infix function"'.split(","), +'Rule,function-simple,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="simple function"]'.split(","),["Rule","fences-open-close","default","[n] content/*[1]; [n] children/*[1]; [n] content/*[2]","self::fenced"],'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(","),["Rule","text","default","[n] text()","self::text"],'Rule;factorial;default;[t] "\u282f";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"), +'Rule;single-prime;default;[t] "\u2804";self::punctuated;@role="prime";count(children/*)=1'.split(";"),'Rule;double-prime;default;[t] "\u2804\u2804";self::punctuated;@role="prime";count(children/*)=2'.split(";"),'Rule;triple-prime;default;[t] "\u2804\u2804\u2804";self::punctuated;@role="prime";count(children/*)=3'.split(";"),'Rule;quadruple-prime;default;[t] "\u2804\u2804\u2804\u2804";self::punctuated;@role="prime";count(children/*)=4'.split(";"),["Rule","fraction","default","[t] CSFopenFraction; [n] children/*[1]; [t] CSFoverFraction; [n] children/*[2]; [t] CSFcloseFraction", +"self::fraction"],'Rule{bevelled-fraction{default{[t] CSFopenFraction; [n] children/*[1]; [t] CSFoverBevFraction; [n] children/*[2]; [t] CSFcloseFraction{self::fraction{contains(@annotation, "general:bevelled")'.split("{"),["Rule","sqrt","default","[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose","self::sqrt"],["Rule","root","default",'[t] CSFindexRadicalVerbose; [n] children/*[1];[t] "\u281c"; [n] children/*[2]; [t] CSFcloseRadicalVerbose',"self::root"],'Rule,limboth,default,[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","), +'Rule,limlower,default,[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Rule,limupper,default,[t] "\u2810"; [n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(","),'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"), +'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(";"),["Rule","limboth-end","default",'[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "\u283b"', +"self::limboth"],["Rule","limlower-end","default",'[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "\u283b"',"self::limlower"],["Rule","limupper-end","default",'[t] "\u2810"; [n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "\u283b"',"self::limupper"],["Aliases","limlower-end","self::underscore",'@role="limit function"'],["Aliases","limlower-end","self::underscore"],["Aliases","limupper-end","self::overscore"],["Rule","integral","default","[n] children/*[1]; [n] children/*[2]; [n] children/*[3];", +"self::integral"],'Rule,integral,default,[n] children/*[1]; [t] "\u2830"; [n] children/*[2];[t] "\u2818"; [n] children/*[3]; [t] "\u2810",self::limboth,@role="integral"'.split(","),["Rule","bigop","default","[n] children/*[1]; [n] children/*[2];","self::bigop"],["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(","),'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(";"), +["Rule","multrel","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::multirel"],["Rule","subscript","default","[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]","self::subscript"],'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"],self::*'.split(","),'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,@role!="prefix function",not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel",sre.MathspeakUtil.generateBaselineConstraint()],["Aliases","subscript-baseline","self::subscript","not(following-sibling::*)", +"@embellished"],'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["Aliases","subscript-empty-sup","self::subscript",'name(children/*[2])="superscript"','name(children/*[2]/children/*[1])="empty"'],["Rule","superscript","default","[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]","self::superscript"], +'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,@role!="prefix function",not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(","), +'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(";"),["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt"],["Aliases","superscript-baseline","self::superscript","not(following-sibling::*)","ancestor::relseq|ancestor::multirel", +"not(@embellished)",sre.MathspeakUtil.generateBaselineConstraint()],'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(" "),'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(","),["Aliases","superscript-empty-sub","self::superscript", +'name(children/*[2])="subscript"','name(children/*[2]/children/*[1])="empty"'],'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(","),'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(","),'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(","), +'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(" "),'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(","), +'Rule,overscore,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2823"; [n] children/*[2]; [t] "\u283b",self::overscore,children/*[2][@role="overaccent"]'.split(","),'Rule{overscore{default{[n] children/*[1]; [t] "\u2823"; [n] children/*[2]{self::overscore{children/*[2][@role="overaccent"]{contains(@grammar, "modified")'.split("{"),'Rule,double-overscore,default,[t] "\u2810"; [n] children/*[1] (grammar:"modified"); [t] "\u2823"; [n] children/*[2]; [t] "\u283b",self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(","), +'Rule,underscore,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2829"; [n] children/*[2]; [t] "\u283b",self::underscore,children/*[2][@role="underaccent"]'.split(","),'Rule{underscore{default{[n] children/*[1]; [t] "\u2829"; [n] children/*[2]{self::underscore{children/*[2][@role="underaccent"]{contains(@grammar, "modified")'.split("{"),'Rule,double-underscore,default,[t] "\u2810"; [n] children/*[1] (grammar:"modified"); [t] "\u2829"; [n] children/*[2]; [t] "\u283b",self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(","), +'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(","),["Rule","matrix","default",'[m] children/* (separator:"\u2800", join:"");',"self::matrix"],["Aliases","matrix","self::vector"],["Rule","matrix-row","default",'[n] ../../content/*[1] (grammar:enlargeFence); [m] children/* (separator:"\u2800"); [n] ../../content/*[2] (grammar:enlargeFence); ',"self::row"],["Aliases","matrix-row","self::line",'@role="vector"'],["Aliases","matrix-row", +"self::line",'@role="binomial"'],'Rule{row-with-label{default{[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split("{"),'Rule;empty-row;default;[t] "\u2800" (pause:300);self::row;count(children/*)=0'.split(";"),["Rule","matrix-cell","default","[n] children/*[1]","self::cell"],'Rule;empty-cell;default;[t] "\u2800" (pause: 300);self::cell;count(children/*)=0'.split(";"),["Rule","layout","default",'[m] children/* (separator:"\u2800", join:"");', +"self::table"],["Rule","cases","default",'[n] ../../content/*[1] (grammar:enlargeFence); [m] children/* (separator:"\u2800"); [t] "\u2810"',"self::cases"],["Aliases","layout","self::multiline"],["Rule","line","default","[m] children/*","self::line"],'Rule,line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel" (pause: 200); [m] children/*,self::line,content'.split(","),'Rule;empty-line;default;[t] "\u2800";self::line;count(children/*)=0;not(content)'.split(";"),'Rule,empty-line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [t] "Blank",self::line,count(children/*)=0,content'.split(","), +["Rule","enclose","default",'[t] "StartEnclose"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "EndEnclose"',"self::enclose"],'Rule,overbar,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2823\u2831\u283b",self::enclose,@role="top"'.split(","),'Rule,underbar,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2829\u2831\u283b",self::enclose,@role="bottom"'.split(","),'Rule,leftbar,default,[t] "\u2833"; [n] children/*[1],self::enclose,@role="left"'.split(","),'Rule,rightbar,default,[n] children/*[1]; [t] "\u2833",self::enclose,@role="right"'.split(","), +'Rule,crossout,default,[t] "\u282a"; [n] children/*[1]; [t] "\u283b",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),'Rule,cancel,default,[t] "\u282a"; [n] children/*[1]/children/*[1]; [t] "\u282a"; [n] children/*[2]; [t] "\u283b",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(","),["Aliases","cancel","self::underscore",'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'], +'Rule,cancel-reverse,default,[t] "\u282a"; [n] children/*[2]/children/*[1]; [t] "\u282a"; [n] children/*[1]; [t] "\u283b",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(","),["Aliases","cancel-reverse","self::underscore",'name(children/*[2])="enclose"','children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'],'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(";"), +'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule{punctuation{default{[n] text(); [t] "\u2810"{self::punctuation{@role="fullstop"{contains(@annotation, "nemeth:number")'.split("{"),'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(","),["Rule","punctuated","default","[m] children/*","self::punctuated"],'Rule,punctuation-comma,default,[n] text(); [t] "\u2800",self::punctuation,parent::*/parent::punctuated,following-sibling::*,@role!="fullstop"'.split(","), +'Rule,punctuation-ellipses,default,[t] "\u2800"; [n] text(); [t] "\u2800",self::punctuation,parent::*/parent::punctuated,following-sibling::*,@role="ellipsis",name(preceding-sibling::*[1])!="punctuation"'.split(","),'Rule,punctuation-ellipses,default,[t] "\u2800"; [n] text();,self::punctuation,parent::*/parent::punctuated,@role="ellipsis",name(preceding-sibling::*[1])!="punctuation"'.split(","),'Rule,reference-sign,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[1])="text" or (name(children/*[1])="punctuated" and children/*[1][@role="text"]),name(children/*[2])="operator" or name(children/*[2])="punctuation"'.split(","), +'Rule,reference-number,default,[n] children/*[1]; [t] "\u2808\u283b"; [n] children/*[2]; [t] "\u2810",self::superscript,name(children/*[1])="text" or (name(children/*[1])="punctuated" and children/*[1][@role="text"]),name(children/*[2])="number",children/*[2][@role="integer"]'.split(",")],initialize:[sre.NemethUtil.generateTensorRules,sre.NemethUtil.addAnnotators]};sre.PrefixFrench={locale:"fr",modality:"prefix",domain:"default",functions:[["CSF","CSFordinalPosition",sre.NumbersUtil.ordinalPosition]],rules:['Rule,numerator,default,[t] "num\u00e9rateur"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(","),'Rule,denominator,default,[t] "d\u00e9nominateur"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(","),'Rule,base,default,[t] "base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor" or name(../..)="limlower" or name(../..)="limupper",count(preceding-sibling::*)=0'.split(","), +'Rule,base-limit,default,[t] "base"; [p] (pause:200),self::*,name(../..)="limboth"'.split(","),'Rule,exponent,default,[t] "exposant"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(","),'Rule,subscript,default,[t] "indice"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(","),'Rule,overscript,default,[t] "indice suscrit"; [p] (pause:200),self::*,name(../..)="overscore" or name(../..)="limupper" or name(../..)="limboth",count(preceding-sibling::*)=1 or count(preceding-sibling::*)=2'.split(","), +'Rule,underscript,default,[t] "indice souscrit"; [p] (pause:200),self::*,name(../..)="underscore" or name(../..)="limlower" or name(../..)="limboth",count(preceding-sibling::*)=1'.split(","),'Rule,radicand,default,[t] "radicande"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(","),'Rule,radicand,default,[t] "radicande"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(","),'Rule,index,default,[t] "indice"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(","), +'Rule,leftsub,default,[t] "indice inf\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(","),'Rule,leftsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice inf\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(","),'Rule,leftsuper,default,[t] "indice sup\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(","),'Rule,leftsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice sup\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(","), +'Rule,rightsub,default,[t] "indice inf\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(","),'Rule,rightsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice inf\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(","),'Rule,rightsuper,default,[t] "indice sup\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(","),'Rule,rightsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice sup\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(","), +'Rule,choice,default,[t] "nombre d\'\u00e9l\u00e9ments choisis"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(","),'Rule,select,default,[t] "nombre d\'\u00e9l\u00e9ments disponibles"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(","),["Rule","row","default",'[t] CSFordinalPosition (grammar:gender="female"); [t] "rang\u00e9e"; [p] (pause:200)',"self::row"],["Aliases","row","self::line"], +'Rule{cell{default{[n] ../..; [t] CSFordinalPosition (grammar:gender="female"); [t] "colonne"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split("{"),["Rule","cell","default",'[t] CSFordinalPosition (grammar:gender="female"); [t] "colonne"; [p] (pause:200)',"self::cell"]]};sre.PrefixGerman={modality:"prefix",locale:"de",domain:"default",functions:[["CSF","CSFordinalPosition",sre.NumbersUtil.ordinalPosition]],rules:['Rule,numerator,default,[t] "Z\u00e4hler"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(","),'Rule,denominator,default,[t] "Nenner"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(","),'Rule,base,default,[t] "Basis"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(","), +'Rule,exponent,default,[t] "Exponent"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(","),'Rule,subscript,default,[t] "Index"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(","),'Rule,overscript,default,[t] "Oberer Grenzwert"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(","),'Rule,underscript,default,[t] "Unterer Grenzwert"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(","), +'Rule,radicand,default,[t] "Radikand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(","),'Rule,radicand,default,[t] "Radikand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(","),'Rule,index,default,[t] "Wurzelexponent"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(","),'Rule,leftsub,default,[t] "linker unterer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(","),'Rule,leftsub,default,[t] CSFordinalPosition; [t] "linker unterer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(","), +'Rule,leftsuper,default,[t] "linker oberer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(","),'Rule,leftsuper,default,[t] CSFordinalPosition; [t] "linker oberer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(","),'Rule,rightsub,default,[t] "rechter unterer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(","),'Rule,rightsub,default,[t] CSFordinalPosition; [t] "rechter unterer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(","), +'Rule,rightsuper,default,[t] "rechter oberer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(","),'Rule,rightsuper,default,[t] CSFordinalPosition; [t] "rechter oberer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(","),'Rule,choice,default,[t] "Grundgesamtheit"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(","),'Rule,select,default,[t] "Stichprobengr\u00f6\u00dfe"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(","), +["Rule","row","default",'[t] CSFordinalPosition; [t] "Zeile"; [p] (pause:200)',"self::row"],["Aliases","row","self::line"],'Rule{cell{default{[n] ../..; [t] CSFordinalPosition; [t] "Spalte"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split("{"),["Rule","cell","default",'[t] CSFordinalPosition; [t] "Spalte"; [p] (pause:200)',"self::cell"]]};sre.PrefixRules={modality:"prefix",domain:"default",functions:[["CSF","CSFordinalPosition",sre.NumbersUtil.ordinalPosition]],rules:['Rule,numerator,default,[t] "Numerator"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(","),'Rule,denominator,default,[t] "Denominator"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(","),'Rule,base,default,[t] "Base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(","), +'Rule,exponent,default,[t] "Exponent"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(","),'Rule,subscript,default,[t] "Subscript"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(","),'Rule,overscript,default,[t] "Overscript"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(","),'Rule,underscript,default,[t] "Underscript"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(","), +'Rule,radicand,default,[t] "Radicand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(","),'Rule,radicand,default,[t] "Radicand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(","),'Rule,index,default,[t] "Index"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(","),'Rule,leftsub,default,[t] "Left Subscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(","),'Rule,leftsub,default,[t] CSFordinalPosition; [t] "Left Subscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(","), +'Rule,leftsuper,default,[t] "Left Superscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(","),'Rule,leftsuper,default,[t] CSFordinalPosition; [t] "Left Superscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(","),'Rule,rightsub,default,[t] "Right Subscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(","),'Rule,rightsub,default,[t] CSFordinalPosition; [t] "Right Subscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(","), +'Rule,rightsuper,default,[t] "Right Superscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(","),'Rule,rightsuper,default,[t] CSFordinalPosition; [t] "Right Superscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(","),'Rule,choice,default,[t] "Choice Quantity"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(","),'Rule,select,default,[t] "Selection Quantity"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(","), +["Rule","row","default",'[t] CSFordinalPosition; [t] "Row"; [p] (pause:200)',"self::row"],["Aliases","row","self::line"],'Rule{cell{default{[n] ../..; [t] CSFordinalPosition; [t] "Column"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split("{"),["Rule","cell","default",'[t] CSFordinalPosition; [t] "Column"; [p] (pause:200)',"self::cell"]]};sre.PrefixSpanish={locale:"es",modality:"prefix",domain:"default",functions:[["CSF","CSFordinalPosition",sre.NumbersUtil.ordinalPosition]],rules:['Rule,numerator,default,[t] "numerador"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(","),'Rule,denominator,default,[t] "denominador"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(","),'Rule,base,default,[t] "base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(","), +'Rule,exponent,default,[t] "exponente"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(","),'Rule,subscript,default,[t] "sub\u00edndice"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(","),'Rule,overscript,default,[t] "sobre\u00edndice"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(","),'Rule,underscript,default,[t] "bajo\u00edndice"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(","), +'Rule,radicand,default,[t] "radicand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(","),'Rule,radicand,default,[t] "radicand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(","),'Rule,index,default,[t] "\u00edndice"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(","),'Rule,leftsub,default,[t] "sub\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(","),'Rule,leftsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "sub\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(","), +'Rule,leftsuper,default,[t] "super\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(","),'Rule,leftsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "super\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(","),'Rule,rightsub,default,[t] "sub\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(","),'Rule,rightsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "sub\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(","), +'Rule,rightsuper,default,[t] "super\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(","),'Rule,rightsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "super\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(","),'Rule,choice,default,[t] "cantidad de elecci\u00f3n"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(","), +'Rule,select,default,[t] "cantidad de selecci\u00f3n"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(","),["Rule","row","default",'[t] CSFordinalPosition (grammar:gender="female"); [t] "fila"; [p] (pause:200)',"self::row"],["Aliases","row","self::line"],'Rule{cell{default{[n] ../..; [t] CSFordinalPosition (grammar:gender="female"); [t] "columna"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split("{"),["Rule","cell","default",'[t] CSFordinalPosition (grammar:gender="female"); [t] "columna"; [p] (pause:200)', +"self::cell"]]};sre.SemanticTreeRules={domain:"default",functions:[["CTXF","CTXFnodeCounter",sre.StoreUtil.nodeCounter],["CTXF","CTXFcontentIterator",sre.StoreUtil.contentIterator]],rules:['Rule{collapsed{default{[t] "collapsed"; [n] . (engine:modality=summary,grammar:collapsed){self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split("{"),["Rule","stree","default","[n] ./*[1]","self::stree"],'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(";"), +["Rule","multrel","default",'[t] "multirelation"; [m] children/* (sepFunc:CTXFcontentIterator)',"self::multirel"],'Rule{variable-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2{./children/punctuation[@role="ellipsis"]'.split("{"),'Rule{multi-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2'.split("{"), +'Rule,equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2'.split(","),'Rule,simple-equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/identifier or ./children/number'.split(","),'Rule,simple-equality2,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/function or ./children/appl'.split(","), +["Rule","relseq","default","[m] children/* (sepFunc:CTXFcontentIterator)","self::relseq"],["Rule","binary-operation","default","[m] children/* (sepFunc:CTXFcontentIterator);","self::infixop"],'Rule,variable-addition,default,[t] "sum with variable number of summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(children/*)>2,children/punctuation[@role="ellipsis"]'.split(","),'Rule,multi-addition,default,[t] "sum with"; [t] count(./children/*); [t] "summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(./children/*)>2'.split(","), +["Rule","prefix","default",'[t] "prefix"; [m] content/* (pause 150);[n] children/*[1]',"self::prefixop"],'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,self::prefixop[@role="negative"]'.split(","),["Rule","postfix","default",'[n] children/*[1]; [t] "postfix"; [m] content/* (pause 300)',"self::postfixop"],["Rule","identifier","default","[n] text()","self::identifier"],["Rule","number","default","[n] text()","self::number"],'Rule,mixed-number,default,[n] children/*[1]; [t] "and"; [n] children/*[2]; ,self::number,@role="mixed"'.split(","), +'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split("{"),'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split("{"), +'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split("{"),'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(";"),["Rule","fraction","default",'[p] (pause:250); [n] children/*[1] (rate:0.35); [p] (pause:250); [t] "divided by"; [n] children/*[2] (rate:-0.35); [p] (pause:400)', +"self::fraction"],["Rule","superscript","default",'[n] children/*[1]; [t] "super"; [n] children/*[2] (pitch:0.35);[p] (pause:300)',"self::superscript"],["Rule","subscript","default",'[n] children/*[1]; [t] "sub"; [n] children/*[2] (pitch:-0.35);[p] (pause:300)',"self::subscript"],'Rule,ellipsis,default,[p] (pause:200); [t] "ellipsis"; [p] (pause:300),self::punctuation,self::punctuation[@role="ellipsis"]'.split(","),'Rule;fence-single;default;[n] text();self::punctuation;self::punctuation[@role="openfence"]'.split(";"), +["Aliases","fence-single","self::punctuation",'self::punctuation[@role="closefence"]'],["Aliases","fence-single","self::punctuation",'self::punctuation[@role="vbar"]'],["Aliases","fence-single","self::punctuation",'self::punctuation[@role="application"]'],["Rule","omit-empty","default","[p] (pause:100)","self::empty"],'Rule,fences-open-close,default,[p] (pause:100); [n] content/*[1]; [n] children/*[1]; [n] content/*[2]; [p] (pause:100),self::fenced,@role="leftright"'.split(","),'Rule,fences-open-close-in-appl,default,[p] (pause:200); [n] children/*[1]; [p] (pause:200);,self::fenced[@role="leftright"],./parent::children/parent::appl'.split(","), +'Rule,fences-neutral,default,[p] (pause:100); [t] "absolute value of"; [n] children/*[1];[p] (pause:350);,self::fenced,self::fenced[@role="neutral"]'.split(","),["Rule","omit-fences","default","[p] (pause:500); [n] children/*[1]; [p] (pause:200);","self::fenced"],["Rule","matrix","default",'[t] "matrix"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100)',"self::matrix"],["Rule","matrix-row","default",'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)','self::row[@role="matrix"]'], +["Rule","matrix-cell","default","[n] children/*[1]",'self::cell[@role="matrix"]'],["Rule","vector","default",'[t] "vector"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"element",pause:100)',"self::vector"],["Rule","cases","default",'[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100)',"self::cases"],["Rule","cases-row","default","[m] children/*",'self::row[@role="cases"]'],["Rule","cases-cell","default","[n] children/*[1]",'self::cell[@role="cases"]'],["Rule", +"row","default",'[m] ./* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',"self::row"],'Rule{cases-end{default{[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100);[t] "end cases"{self::cases{following-sibling::*'.split("{"),["Rule","multiline","default",'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"line",pause:100)',"self::multiline"],'Rule{multiline-ineq{default{[t] "multiline inequality";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100){self::multiline{@role="inequality"'.split("{"), +["Rule","line","default","[m] children/*","self::line"],["Rule","table","default",'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200)',"self::table"],'Rule{table-ineq{default{[t] "multiline inequality";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200){self::table{@role="inequality"'.split("{"),["Rule","table-row","default","[m] children/* (pause:100)",'self::row[@role="table"]'],["Aliases","cases-cell",'self::cell[@role="table"]'],'Rule;empty-cell;default;[t] "Blank";self::cell;count(children/*)=0'.split(";"), +'Rule,end-punct,default,[m] children/*; [p] (pause:300),self::punctuated,@role="endpunct"'.split(","),'Rule,start-punct,default,[n] content/*[1]; [p] (pause:200); [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(","),'Rule,integral-punct,default,[n] children/*[1] (rate:0.2); [n] children/*[3] (rate:0.2),self::punctuated,@role="integral"'.split(","),["Rule","punctuated","default","[m] children/* (pause:100)","self::punctuated"],["Rule","function","default","[n] text()","self::function"], +["Rule","appl","default","[n] children/*[1]; [n] content/*[1]; [n] children/*[2]","self::appl"],'Rule,sum-only,default,[n] children/*[1]; [t] "from"; [n] children/*[2]; [t] "to";[n] children/*[3],self::limboth,self::limboth[@role="sum"]'.split(","),["Rule","limboth","default",'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[t] "under"; [n] children/*[3]; [p] (pause 250);',"self::limboth"],["Rule","limlower","default",'[n] children/*[1]; [t] "over"; [n] children/*[2];',"self::limlower"], +["Rule","limupper","default",'[n] children/*[1]; [t] "under"; [n] children/*[2];',"self::limupper"],["Rule","largeop","default","[n] text()","self::largeop"],["Rule","bigop","default",'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[p] (pause 250);',"self::bigop"],["Rule","integral","default","[n] children/*[1]; [p] (pause 100); [n] children/*[2];[p] (pause 200); [n] children/*[3] (rate:0.35);","self::integral"],["Rule","sqrt","default",'[t] "Square root of"; [n] children/*[1] (rate:0.35); [p] (pause:400)', +"self::sqrt"],'Rule,square,default,[n] children/*[1]; [t] "squared" (pitch:0.35); [p] (pause:300),self::superscript,children/*[2][text()=2],name(./children/*[1])!="text"'.split(","),'Rule,cube,default,[n] children/*[1]; [t] "cubed" (pitch:0.35); [p] (pause:300),self::superscript,children/*[2][text()=3],name(./children/*[1])!="text"'.split(","),["Rule","root","default",'[t] "root of order"; [n] children/*[1];[t] "over"; [n] children/*[2] (rate:0.35); [p] (pause:400)',"self::root"],["Rule","text","default", +"[n] text(); [p] (pause:200)","self::text"],'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(";"),'Rule,unit-square,default,[t] "square"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(","),'Rule,unit-cubic,default,[t] "cubic"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(","),'Rule,reciprocal,default,[t] "reciprocal"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(","), +'Rule,reciprocal,default,[t] "per"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(","),'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(";"),'Rule,unit-divide,default,[n] children/*[1] (pitch:0.3); [t] "per"; [n] children/*[2] (pitch:-0.3),self::fraction,@role="unit"'.split(",")]};sre.SummaryFrench={locale:"fr",modality:"summary",rules:[["Rule","collapsed-masculine","default.masculine",'[t] "compress\u00e9"','contains(@grammar, "collapsed")'],["Rule","collapsed-feminine","default.feminine",'[t] "compress\u00e9e"','contains(@grammar, "collapsed")'],["Rule","no-collapsed","default.masculine",'[t] ""','not(contains(@grammar, "collapsed"))'],["Rule","no-collapsed","default.feminine",'[t] ""','not(contains(@grammar, "collapsed"))'],["Rule","stree","default.default","[n] ./*[1]", +"self::stree"],'Rule{abstr-identifier{default.default{[t] "identifiant long"; [n] . (engine:style=masculine){self::identifier{contains(@grammar, "collapsed")'.split("{"),["Rule","abstr-identifier","default.default",'[t] "identifiant"; [n] . (engine:style=masculine)',"self::identifier"],'Rule{abstr-number{default.default{[t] "nombre long"; [n] . (engine:style=masculine){self::number{contains(@grammar, "collapsed")'.split("{"),["Rule","abstr-number","default.default",'[t] "nombre"; [n] . (engine:style=masculine)', +"self::number"],'Rule{abstr-mixed-number{default.default{[t] "nombre fractionnaire long"; [n] . (engine:style=masculine){self::number{@role="mixed"{contains(@grammar, "collapsed")'.split("{"),'Rule,abstr-mixed-number,default.default,[t] "nombre fractionnaire"; [n] . (engine:style=masculine),self::number,@role="mixed"'.split(","),["Rule","abstr-text","default.default",'[t] "texte"; [n] . (engine:style=masculine)',"self::text"],["Rule","abstr-function","default.default",'[t] "expression fonctionnelle"; [n] . (engine:style=feminine)', +"self::function"],["Rule","abstr-function","mathspeak.brief",'[t] "fonction"; [n] . (engine:style=feminine)',"self::function"],["SpecializedRule","abstr-function","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-lim,default.default,[t] "fonction de limitation"; [n] . (engine:style=feminine),self::function,@role="limit function"'.split(","),'Rule,abstr-lim,mathspeak.brief,[t] "lim"; [n] . (engine:style=feminine),self::function,@role="limit function"'.split(","),["SpecializedRule","abstr-lim","mathspeak.brief", +"mathspeak.sbrief"],["Rule","abstr-fraction","default.default",'[t] "fraction"; [n] . (engine:style=feminine)',"self::fraction"],["Rule","abstr-fraction","mathspeak.brief",'[t] "frac"; [n] . (engine:style=feminine)',"self::fraction"],["SpecializedRule","abstr-fraction","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-continued-fraction,default.default,[t] "fraction continue"; [n] . (engine:style=feminine),self::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(","),'Rule,abstr-continued-fraction,mathspeak.brief,[t] "frac continue"; [n] . (engine:style=feminine),self::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(","), +["SpecializedRule","abstr-continued-fraction","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-sqrt","default.default",'[t] "racine carr\u00e9e"; [n] . (engine:style=feminine)',"self::sqrt"],'Rule,abstr-sqrt-nested,default.default,[t] "racine carr\u00e9e imbriqu\u00e9e"; [n] . (engine:style=feminine),self::sqrt,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),'Rule{abstr-root{default.default{[t] "racine d\'indice"; [n] children/*[1] (engine:modality="speech"); [t] "fin indice"; [n] . (engine:style=feminine);{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +["Rule","abstr-root","default.default",'[t] "racine d\'indice"; [n] children/*[1] (engine:modality=speech); [n] . (engine:style=feminine)',"self::root"],["Rule","abstr-root","mathspeak.brief",'[t] "racine"; [n] . (engine:style=feminine)',"self::root"],["SpecializedRule","abstr-root","mathspeak.brief","mathspeak.sbrief"],'Rule{abstr-root-nested{default.default{[t] "racine imbriqu\u00e9e d\'indice"; [n] children/*[1] (engine:modality=speech); [t] "fin indice"; [n] . (engine:style=feminine);{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +'Rule,abstr-root-nested,default.default,[t] "racine imbriqu\u00e9e d\'indice"; [n] children/*[1] (engine:modality=speech); [n] . (engine:style=feminine),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),'Rule,abstr-root-nested,mathspeak.brief,[t] "racine imbriqu\u00e9e"; [n] . (engine:style=feminine),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),["SpecializedRule","abstr-root-nested","mathspeak.brief", +"mathspeak.sbrief"],["Rule","abstr-superscript","default.default",'[t] "puissance"; [n] . (engine:style=feminine)',"self::superscript"],["Rule","abstr-subscript","default.default",'[t] "indice"; [n] . (engine:style=masculine)',"self::subscript"],'Rule,abstr-subsup,default.default,[t] "puissance avec index"; [n] . (engine:style=feminine),self::superscript,name(children/*[1])="subscript"'.split(","),["Rule","abstr-infixop","default.default",'[t] @role (grammar:localRole); [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=masculine)', +"self::infixop"],'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "avec un nombre d\'\u00e9l\u00e9ments variable"; [n] . (engine:style=masculine),self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","),["Rule","abstr-infixop","mathspeak.brief","[t] @role (grammar:localRole); [n] . (engine:style=masculine)","self::infixop"],["SpecializedRule","abstr-infixop","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-addition,default.default,[t] "somme avec"; [t] count(./children/*); [t] "op\u00e9randes"; [n] . (engine:style=feminine),self::infixop,@role="addition"'.split(","), +'Rule,abstr-addition,mathspeak.brief,[t] "somme"; [n] . (engine:style=feminine),self::infixop,@role="addition"'.split(","),["SpecializedRule","abstr-addition","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-addition,default.default,[t] "somme avec un nombre variable d\'op\u00e9randes"; [n] . (engine:style=feminine),self::infixop,@role="addition",count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","),'Rule,abstr-multiplication,default.default,[t] "produit avec"; [t] count(./children/*); [t] "facteurs"; [n] . (engine:style=masculine);,self::infixop,@role="multiplication"'.split(","), +'Rule,abstr-multiplication,mathspeak.brief,[t] "produit"; [n] . (engine:style=masculine),self::infixop,@role="multiplication"'.split(","),["SpecializedRule","abstr-multiplication","mathspeak.brief","mathspeak.sbrief"],["Aliases","abstr-multiplication","self::infixop",'@role="implicit"'],'Rule,abstr-var-multiplication,default.default,[t] "produit avec un nombre de facteurs variable"; [n] . (engine:style=masculine),self::infixop,@role="multiplication",count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","), +'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),["Rule","abstr-vector","default.default",'[t] "vecteur de dimension"; [t] count(./children/*); [n] . (engine:style=masculine)',"self::vector"],["Rule","abstr-vector","mathspeak.brief",'[t] "vecteur"; [n] . (engine:style=masculine)',"self::vector"],["SpecializedRule","abstr-vector","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-vector,default.default,[t] "vecteur colonne de dimension n"; [n] . (engine:style=masculine),self::vector,./children/*/children/punctuation[@role="ellipsis"]'.split(","), +'Rule,abstr-binomial,default.default,[t] "binomial"; [n] . (engine:style=masculine),self::vector,@role="binomial"'.split(","),["SpecializedRule","abstr-binomial","default.default","mathspeak.brief"],["SpecializedRule","abstr-binomial","default.default","mathspeak.sbrief"],'Rule,abstr-determinant,default.default,[t] "d\u00e9terminant de dimension"; [t] count(./children/*); [n] . (engine:style=masculine),self::matrix,@role="determinant"'.split(","),'Rule,abstr-determinant,mathspeak.brief,[t] "d\u00e9terminant"; [n] . (engine:style=masculine),self::matrix,@role="determinant"'.split(","), +["SpecializedRule","abstr-determinant","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-determinant,default.default,[t] "d\u00e9terminant de dimension n"; [n] . (engine:style=masculine),self::matrix,@role="determinant",./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(","),'Rule,abstr-squarematrix,default.default,[t] "matrice carr\u00e9e de dimension"; [t] count(./children/*); [n] . (engine:style=feminine),self::matrix,@role="squarematrix"'.split(","),'Rule,abstr-squarematrix,mathspeak.brief,[t] "matrice carr\u00e9e"; [n] . (engine:style=feminine),self::matrix,@role="squarematrix"'.split(","), +["SpecializedRule","abstr-squarematrix","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-rowvector,default.default,[t] "vecteur ligne de dimension"; [t] count(./children/row/children/*); [n] . (engine:style=masculine),self::matrix,@role="rowvector"'.split(","),'Rule,abstr-rowvector,mathspeak.brief,[t] "vecteur ligne"; [n] . (engine:style=masculine),self::matrix,@role="rowvector"'.split(","),["SpecializedRule","abstr-rowvector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "vecteur ligne de dimension n";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-matrix","default.default",'[t] "matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [n] . (engine:style=feminine)',"self::matrix"],["Rule","abstr-matrix","mathspeak.brief",'[t] "matrice"; [n] . (engine:style=feminine)',"self::matrix"],["SpecializedRule","abstr-matrix","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-matrix,default.default,[t] "matrice de dimension n par m"; [n] . (engine:style=feminine),self::matrix,./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-cases","default.default",'[t] "d\u00e9claration de cas";[t] "avec"; [t] count(children/*); [t] "cas"; [n] . (engine:style=feminine)',"self::cases"],["Rule","abstr-cases","mathspeak.brief",'[t] "d\u00e9claration de cas"; [n] . (engine:style=feminine)',"self::cases"],["SpecializedRule","abstr-cases","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-cases,default.default,[t] "d\u00e9claration de cas variable"; [n] . (engine:style=feminine),self::cases,./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-punctuated","default.default",'[t] "liste de longueur"; [t] count(children/*) - count(content/*); [t] "s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine)',"self::punctuated"],["Rule","abstr-punctuated","mathspeak.brief",'[t] "liste s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine)',"self::punctuated"],["SpecializedRule","abstr-punctuated","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-punctuated,default.default,[t] "liste de longueur variable s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine),self::punctuated,./children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-bigop","default.default","[n] content/*[1]; [n] . (engine:style=masculine)","self::bigop"],["Rule","abstr-integral","default.default",'[t] "int\u00e9grale"; [n] . (engine:style=feminine)','@role="integral"'],"Rule,abstr-relation,default.default,[t] @role (grammar:localRole); [n] . (engine:style=masculine);,self::relseq,count(./children/*)=2".split(","),'Rule,abstr-relation-seq,default.default,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2'.split(","), +'Rule,abstr-relation-seq,mathspeak.brief,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2'.split(","),["SpecializedRule","abstr-relation-seq","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-relation,default.default,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [t] "avec un nombre de \u00e9l\u00e9ments variable"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","), +'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(" "),'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),'Rule,abstr-multirel,default.default,[t] "s\u00e9quence de relation"; [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2'.split(","),'Rule,abstr-multirel,mathspeak.brief,[t] "s\u00e9quence de relation"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2'.split(","), +["SpecializedRule","abstr-multirel","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-multirel,default.default,[t] "s\u00e9quence de relation avec un nombre de \u00e9l\u00e9ments variable"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","),["Rule","abstr-table","default.default",'[t] "table avec"; [t] count(children/*); [t] "lignes et";[t] count(children/*[1]/children/*); [t] "colonnes"; [n] . (engine:style=feminine);',"self::table"], +["Rule","abstr-line","default.default",'[t] "dans"; [t] @role (grammar:localRole); [n] . (engine:style=masculine)',"self::line"],["Rule","abstr-row","default.default",'[t] "dans"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "avec";[t] count(children/*); [t] "colonnes"; [n] . (engine:style=feminine)',"self::row"],["Rule","abstr-cell","default.default",'[t] "dans"; [t] @role (grammar:localRole); [n] . (engine:style=feminine);',"self::cell"]]};sre.SummaryGerman={modality:"summary",locale:"de",rules:['Rule;abstr-identifier;default.default;[t] "langer Bezeichner";self::identifier;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-identifier","default.default",'[t] "Bezeichner"',"self::identifier"],'Rule;abstr-number;default.default;[t] "lange Zahl";self::number;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-number","default.default",'[t] "Zahl"',"self::number"],'Rule;abstr-mixed-number;default.default;[t] "langer gemischter Bruch";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(";"), +'Rule;abstr-mixed-number;default.default;[t] "gemischter Bruch";self::number;@role="mixed"'.split(";"),["Rule","abstr-text","default.default",'[t] "Text"',"self::text"],["Rule","abstr-function","default.default",'[t] "Funktionsausdruck"',"self::function"],["Rule","abstr-function","mathspeak.brief",'[t] "Funktion"',"self::function"],["SpecializedRule","abstr-function","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-lim;default.default;[t] "Grenzwertfunktion";self::function;@role="limit function"'.split(";"), +'Rule;abstr-lim;mathspeak.brief;[t] "Grenzwert";self::function;@role="limit function"'.split(";"),["SpecializedRule","abstr-lim","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-fraction","default.default",'[t] "Bruch"',"self::fraction"],'Rule;abstr-continued-fraction;default.default;[t] "Kettenbruch";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(";"),["Rule","abstr-sqrt","default.default",'[t] "Quadratwurzel"',"self::sqrt"],'Rule;abstr-sqrt-nested;default.default;[t] "verschachtelte Quadratwurzel";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"), +'Rule{abstr-root{default.default{[t] "Wurzel mit Exponent"; [n] children/*[1] (engine:modality=speech); [t] "Exponentende"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split("{"),["Rule","abstr-root","default.default",'[t] "Wurzel mit Exponent"; [n] children/*[1] (engine:modality=speech)',"self::root"],["Rule","abstr-root","mathspeak.brief",'[t] "Wurzel"',"self::root"],["SpecializedRule","abstr-root","mathspeak.brief","mathspeak.sbrief"],'Rule{abstr-root-nested{default.default{[t] "verschachtelte Wurzel mit Wurzelexponent"; [n] children/*[1] (engine:modality="speech"); [t] "Ende Wurzelexponent"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +'Rule,abstr-root-nested,default.default,[t] "verschachtelte Wurzel mit Exponent"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),'Rule;abstr-root-nested;mathspeak.brief;[t] "verschachtelte Wurzel";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"),["SpecializedRule","abstr-root-nested","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-superscript","default.default", +'[t] "Potenz"',"self::superscript"],["Rule","abstr-subscript","default.default",'[t] "Index"',"self::subscript"],'Rule;abstr-subsup;default.default;[t] "Potenz mit Index";self::superscript;name(children/*[1])="subscript"'.split(";"),["Rule","abstr-infixop","default.default",'[t] @role (grammar:localRole); [t] "mit"; [t] count(./children/*); [t] "Elementen"',"self::infixop"],'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "mit ver\u00e4nderlicher Anzahl an Elementen",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-infixop","mathspeak.brief","[t] @role (grammar:localRole)","self::infixop"],["SpecializedRule","abstr-infixop","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-addition,default.default,[t] "Summe mit"; [t] count(./children/*); [t] "Summanden",self::infixop,@role="addition"'.split(","),'Rule;abstr-addition;mathspeak.brief;[t] "Summe";self::infixop;@role="addition"'.split(";"),["SpecializedRule","abstr-addition","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-addition;default.default;[t] "Summe mit ver\u00e4nderlicher Anzahl an Summanden";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Rule,abstr-multiplication,default.default,[t] "Produkt mit"; [t] count(./children/*); [t] "Faktoren",self::infixop,@role="multiplication"'.split(","),'Rule;abstr-multiplication;mathspeak.brief;[t] "Produkt";self::infixop;@role="multiplication"'.split(";"),["SpecializedRule","abstr-multiplication","mathspeak.brief","mathspeak.sbrief"],["Aliases","abstr-multiplication","self::infixop",'@role="implicit"'],'Rule;abstr-var-multiplication;default.default;[t] "Produkt mit ver\u00e4nderlicher Anzahl an Faktoren";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),["Rule","abstr-vector","default.default",'[t] count(./children/*) ; [t] "dimensionaler Vektor"',"self::vector"],["Rule","abstr-vector","mathspeak.brief",'[t] "Vektor"',"self::vector"],["SpecializedRule","abstr-vector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-vector;default.default;[t] "n dimensionaler Vektor";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(";"), +'Rule;abstr-binomial;default.default;[t] "Binomialkoeffizient";self::vector;@role="binomial"'.split(";"),["SpecializedRule","abstr-binomial","default.default","mathspeak.brief"],["SpecializedRule","abstr-binomial","default.default","mathspeak.sbrief"],'Rule,abstr-determinant,default.default,[t] count(./children/*); [t] "dimensionale Determinante",self::matrix,@role="determinant"'.split(","),'Rule;abstr-determinant;mathspeak.brief;[t] "Determinante";self::matrix;@role="determinant"'.split(";"),["SpecializedRule", +"abstr-determinant","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-determinant;default.default;[t] "n dimensionale Determinante";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),'Rule,abstr-squarematrix,default.default,[t] count(./children/*); [t] "dimensionale quadratische Matrize",self::matrix,@role="squarematrix"'.split(","),'Rule;abstr-squarematrix;mathspeak.brief;[t] "quadratische Matrize";self::matrix;@role="squarematrix"'.split(";"), +["SpecializedRule","abstr-squarematrix","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-rowvector,default.default,[t] count(./children/row/children/*); [t] "dimensionaler Zeilenvektor",self::matrix,@role="rowvector"'.split(","),'Rule;abstr-rowvector;mathspeak.brief;[t] "Zeilenvektor";self::matrix;@role="rowvector"'.split(";"),["SpecializedRule","abstr-rowvector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "n dimensionaler Zeilenvektor";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-matrix","default.default",'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"',"self::matrix"],["Rule","abstr-matrix","mathspeak.brief",'[t] "Matrize"',"self::matrix"],["SpecializedRule","abstr-matrix","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "n mal m dimensionale Matrize";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-cases","default.default",'[t] "Fallunterscheidung";[t] "mit"; [t] count(children/*); [t] "F\u00e4llen"', +"self::cases"],["Rule","abstr-cases","mathspeak.brief",'[t] "Fallunterscheidung"',"self::cases"],["SpecializedRule","abstr-cases","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-cases;default.default;[t] "Fallunterscheidung mit ver\u00e4nderlicher Anzahl an F\u00e4llen";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-punctuated","default.default",'[t] "mit"; [n] content/*[1]; [t] "getrennte Liste der L\u00e4nge"; [t] count(children/*) - count(content/*)', +"self::punctuated"],["Rule","abstr-punctuated","mathspeak.brief",'[t] "mit"; [n] content/*[1]; [t] "getrennte Liste";',"self::punctuated"],["SpecializedRule","abstr-punctuated","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-punctuated,default.default,[t] "mit"; [n] content/*[1]; [t] "getrennte Liste";[t] "ver\u00e4nderlicher L\u00e4nge",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(","),["Rule","abstr-bigop","default.default","[n] content/*[1]","self::bigop"],["Rule","abstr-integral", +"default.default",'[t] "Integral"','@role="integral"'],"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(","),'Rule{abstr-relation-seq{default.default{[t] @role (grammar:localRole, join:""); [t] "ssequenz"; [t] "mit"; [t] count(./children/*); [t] "Elementen"{self::relseq{count(./children/*)>2'.split("{"),'Rule{abstr-relation-seq{mathspeak.brief{[t] @role (grammar:localRole, join:""); [t] "ssequenz"{self::relseq{count(./children/*)>2'.split("{"), +["SpecializedRule","abstr-relation-seq","mathspeak.brief","mathspeak.sbrief"],'Rule{abstr-var-relation{default.default{[t] @role (grammar:localRole, join:""); [t] "ssequenz";[t] "mit ver\u00e4nderlicher Anzahl an Elementen"{self::relseq{count(./children/*)>2{./children/punctuation[@role="ellipsis"]'.split("{"),'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(" "),'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "), +'Rule,abstr-multirel,default.default,[t] "Relationsequenz"; [t] "mit"; [t] count(./children/*); [t] "Elementen",self::multirel,count(./children/*)>2'.split(","),'Rule;abstr-multirel;mathspeak.brief;[t] "Relationsequenz";self::multirel;count(./children/*)>2'.split(";"),["SpecializedRule","abstr-multirel","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-multirel;default.default;[t] "Relationsequenz mit ver\u00e4nderlicher Anzahl an Elementen";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-table","default.default",'[t] "Tabelle mit"; [t] count(children/*); [t] "Zeilen und";[t] count(children/*[1]/children/*); [t] "Spalten"',"self::table"],["Rule","abstr-line","default.default",'[t] "in"; [t] @role (grammar:localRole);',"self::line"],["Rule","abstr-row","default.default",'[t] "in"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "mit";[t] count(children/*); [t] "Spalten"',"self::row"],["Rule","abstr-cell","default.default",'[t] "in"; [t] @role (grammar:localRole);', +"self::cell"]]};sre.SummaryRules={modality:"summary",rules:['Rule;abstr-identifier;default.default;[t] "long identifier";self::identifier;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-identifier","default.default",'[t] "identifier"',"self::identifier"],'Rule;abstr-number;default.default;[t] "long number";self::number;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-number","default.default",'[t] "number"',"self::number"],'Rule;abstr-mixed-number;default.default;[t] "long mixed number";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(";"), +'Rule;abstr-mixed-number;default.default;[t] "mixed number";self::number;@role="mixed"'.split(";"),["Rule","abstr-text","default.default",'[t] "text"',"self::text"],["Rule","abstr-function","default.default",'[t] "functional expression"',"self::function"],["Rule","abstr-function","mathspeak.brief",'[t] "function"',"self::function"],["SpecializedRule","abstr-function","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-lim;default.default;[t] "limit function";self::function;@role="limit function"'.split(";"), +'Rule;abstr-lim;mathspeak.brief;[t] "lim";self::function;@role="limit function"'.split(";"),["SpecializedRule","abstr-lim","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-fraction","default.default",'[t] "fraction"',"self::fraction"],["Rule","abstr-fraction","mathspeak.brief",'[t] "frac"',"self::fraction"],["SpecializedRule","abstr-fraction","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-continued-fraction;default.default;[t] "continued fraction";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(";"), +'Rule;abstr-continued-fraction;mathspeak.brief;[t] "continued frac";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(";"),["SpecializedRule","abstr-continued-fraction","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-sqrt","default.default",'[t] "square root"',"self::sqrt"],'Rule;abstr-sqrt-nested;default.default;[t] "nested square root";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"),'Rule{abstr-root{default.default{[t] "root of index"; [n] children/*[1] (engine:modality="speech"); [t] "endindex"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +["Rule","abstr-root","default.default",'[t] "root of index"; [n] children/*[1] (engine:modality=speech)',"self::root"],["Rule","abstr-root","mathspeak.brief",'[t] "root"',"self::root"],["SpecializedRule","abstr-root","mathspeak.brief","mathspeak.sbrief"],'Rule{abstr-root-nested{default.default{[t] "nested root of index"; [n] children/*[1] (engine:modality="speech"); [t] "endindex"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +'Rule,abstr-root-nested,default.default,[t] "nested root of index"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),'Rule;abstr-root-nested;mathspeak.brief;[t] "nested root";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"),["SpecializedRule","abstr-root-nested","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-superscript","default.default",'[t] "power"', +"self::superscript"],["Rule","abstr-subscript","default.default",'[t] "subscript"',"self::subscript"],'Rule;abstr-subsup;default.default;[t] "power with subscript";self::superscript;name(children/*[1])="subscript"'.split(";"),["Rule","abstr-infixop","default.default",'[t] @role (grammar:localRole); [t] "with"; [t] count(./children/*); [t] "elements"',"self::infixop"],'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "with variable number of elements",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-infixop","mathspeak.brief","[t] @role (grammar:localRole)","self::infixop"],["SpecializedRule","abstr-infixop","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-addition,default.default,[t] "sum with"; [t] count(./children/*); [t] "summands",self::infixop,@role="addition"'.split(","),'Rule;abstr-addition;mathspeak.brief;[t] "sum";self::infixop;@role="addition"'.split(";"),["SpecializedRule","abstr-addition","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-addition;default.default;[t] "sum with variable number of summands";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Rule,abstr-multiplication,default.default,[t] "product with"; [t] count(./children/*); [t] "factors",self::infixop,@role="multiplication"'.split(","),'Rule;abstr-multiplication;mathspeak.brief;[t] "product";self::infixop;@role="multiplication"'.split(";"),["SpecializedRule","abstr-multiplication","mathspeak.brief","mathspeak.sbrief"],["Aliases","abstr-multiplication","self::infixop",'@role="implicit"'],'Rule;abstr-var-multiplication;default.default;[t] "product with variable number of factors";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),["Rule","abstr-vector","default.default",'[t] count(./children/*) ; [t] "dimensional vector"',"self::vector"],["Rule","abstr-vector","mathspeak.brief",'[t] "vector"',"self::vector"],["SpecializedRule","abstr-vector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-vector;default.default;[t] "n dimensional vector";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(";"), +'Rule;abstr-binomial;default.default;[t] "binomial";self::vector;@role="binomial"'.split(";"),["SpecializedRule","abstr-binomial","default.default","mathspeak.brief"],["SpecializedRule","abstr-binomial","default.default","mathspeak.sbrief"],'Rule,abstr-determinant,default.default,[t] count(./children/*); [t] "dimensional determinant",self::matrix,@role="determinant"'.split(","),'Rule;abstr-determinant;mathspeak.brief;[t] "determinant";self::matrix;@role="determinant"'.split(";"),["SpecializedRule", +"abstr-determinant","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-determinant;default.default;[t] "n dimensional determinant";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),'Rule,abstr-squarematrix,default.default,[t] count(./children/*); [t] "dimensional square matrix",self::matrix,@role="squarematrix"'.split(","),'Rule;abstr-squarematrix;mathspeak.brief;[t] "square matrix";self::matrix;@role="squarematrix"'.split(";"),["SpecializedRule", +"abstr-squarematrix","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-rowvector,default.default,[t] count(./children/row/children/*); [t] "dimensional row vector",self::matrix,@role="rowvector"'.split(","),'Rule;abstr-rowvector;mathspeak.brief;[t] "row vector";self::matrix;@role="rowvector"'.split(";"),["SpecializedRule","abstr-rowvector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "n dimensional row vector";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-matrix","default.default",'[t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"',"self::matrix"],["Rule","abstr-matrix","mathspeak.brief",'[t] "matrix"',"self::matrix"],["SpecializedRule","abstr-matrix","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "n by m dimensional matrix";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-cases","default.default",'[t] "case statement";[t] "with"; [t] count(children/*); [t] "cases"', +"self::cases"],["Rule","abstr-cases","mathspeak.brief",'[t] "case statement"',"self::cases"],["SpecializedRule","abstr-cases","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-cases;default.default;[t] "case statement with variable number of cases";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-punctuated","default.default",'[n] content/*[1]; [t] "separated list"; [t] "of length"; [t] count(children/*) - count(content/*)', +"self::punctuated"],["Rule","abstr-punctuated","mathspeak.brief",'[n] content/*[1]; [t] "separated list"',"self::punctuated"],["SpecializedRule","abstr-punctuated","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-punctuated,default.default,[n] content/*[1]; [t] "separated list";[t] "of variable length",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(","),["Rule","abstr-bigop","default.default","[n] content/*[1]","self::bigop"],["Rule","abstr-integral","default.default",'[t] "integral"', +'@role="integral"'],"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(","),'Rule,abstr-relation-seq,default.default,[t] @role (grammar:localRole); [t] "sequence"; [t] "with"; [t] count(./children/*); [t] "elements",self::relseq,count(./children/*)>2'.split(","),'Rule,abstr-relation-seq,mathspeak.brief,[t] @role (grammar:localRole); [t] "sequence",self::relseq,count(./children/*)>2'.split(","),["SpecializedRule","abstr-relation-seq","mathspeak.brief", +"mathspeak.sbrief"],'Rule,abstr-var-relation,default.default,[t] @role (grammar:localRole); [t] "sequence"; [t] "with variable number of elements",self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","),'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(" "),'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),'Rule,abstr-multirel,default.default,[t] "relation sequence"; [t] "with"; [t] count(./children/*); [t] "elements",self::multirel,count(./children/*)>2'.split(","), +'Rule;abstr-multirel;mathspeak.brief;[t] "relation sequence";self::multirel;count(./children/*)>2'.split(";"),["SpecializedRule","abstr-multirel","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-multirel;default.default;[t] "relation sequence with variable number of elements";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-table","default.default",'[t] "table with"; [t] count(children/*); [t] "rows and";[t] count(children/*[1]/children/*); [t] "columns"', +"self::table"],["Rule","abstr-line","default.default",'[t] "in"; [t] @role (grammar:localRole);',"self::line"],["Rule","abstr-row","default.default",'[t] "in"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "with";[t] count(children/*); [t] "columns"',"self::row"],["Rule","abstr-cell","default.default",'[t] "in"; [t] @role (grammar:localRole);',"self::cell"]]};sre.SummarySpanish={locale:"es",modality:"summary",rules:[["Rule","stree","default.default","[n] ./*[1]","self::stree"],'Rule;abstr-identifier;default.default;[t] "identificador largo";self::identifier;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-identifier","default.default",'[t] "identificador"',"self::identifier"],'Rule;abstr-number;default.default;[t] "n\u00famero largo";self::number;contains(@grammar, "collapsed")'.split(";"),["Rule","abstr-number","default.default",'[t] "n\u00famero"', +"self::number"],'Rule;abstr-mixed-number;default.default;[t] "n\u00famero largo mixto";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(";"),'Rule;abstr-mixed-number;default.default;[t] "n\u00famero mixto";self::number;@role="mixed"'.split(";"),["Rule","abstr-text","default.default",'[t] "texto"',"self::text"],["Rule","abstr-function","default.default",'[t] "expresi\u00f3n funcional"',"self::function"],["Rule","abstr-function","mathspeak.brief",'[t] "funci\u00f3n"',"self::function"], +["SpecializedRule","abstr-function","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-lim;default.default;[t] "funci\u00f3n de l\u00edmite";self::function;@role="limit function"'.split(";"),'Rule;abstr-lim;mathspeak.brief;[t] "l\u00edmite";self::function;@role="limit function"'.split(";"),["SpecializedRule","abstr-lim","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-fraction","default.default",'[t] "fracci\u00f3n"',"self::fraction"],["Rule","abstr-fraction","mathspeak.brief",'[t] "frac"',"self::fraction"], +["SpecializedRule","abstr-fraction","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-continued-fraction;default.default;[t] "fracci\u00f3n continua";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(";"),'Rule;abstr-continued-fraction;mathspeak.brief;[t] "frac continua";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(";"),["SpecializedRule","abstr-continued-fraction","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-sqrt","default.default", +'[t] "ra\u00edz cuadrada"',"self::sqrt"],'Rule;abstr-sqrt-nested;default.default;[t] "ra\u00edz cuadrada anidada";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"),'Rule{abstr-root{default.default{[t] "ra\u00edz del \u00edndice"; [n] children/*[1] (engine:modality="speech"); [t] "finalizar de \u00edndice"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split("{"),["Rule","abstr-root","default.default", +'[t] "ra\u00edz del \u00edndice"; [n] children/*[1] (engine:modality=speech)',"self::root"],["Rule","abstr-root","mathspeak.brief",'[t] "ra\u00edz"',"self::root"],["SpecializedRule","abstr-root","mathspeak.brief","mathspeak.sbrief"],'Rule{abstr-root-nested{default.default{[t] "ra\u00edz anidada del \u00edndice"; [n] children/*[1] (engine:modality="speech"); [t] "finalizar de \u00edndice"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split("{"), +'Rule,abstr-root-nested,default.default,[t] "ra\u00edz anidada del \u00edndice"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(","),'Rule;abstr-root-nested;mathspeak.brief;[t] "ra\u00edz anidada";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(";"),["SpecializedRule","abstr-root-nested","mathspeak.brief","mathspeak.sbrief"],["Rule","abstr-superscript","default.default", +'[t] "potencia"',"self::superscript"],["Rule","abstr-subscript","default.default",'[t] "sub\u00edndice"',"self::subscript"],'Rule;abstr-subsup;default.default;[t] "potencia con sub\u00edndice";self::superscript;name(children/*[1])="subscript"'.split(";"),["Rule","abstr-infixop","default.default",'[t] @role (grammar:localRole); [t] "con"; [t] count(./children/*); [t] "elementos"',"self::infixop"],'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "con una cantidad variable de elementos",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","), +["Rule","abstr-infixop","mathspeak.brief","[t] @role (grammar:localRole)","self::infixop"],["SpecializedRule","abstr-infixop","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-addition,default.default,[t] "suma con"; [t] count(./children/*); [t] "sumandos",self::infixop,@role="addition"'.split(","),'Rule;abstr-addition;mathspeak.brief;[t] "suma";self::infixop;@role="addition"'.split(";"),["SpecializedRule","abstr-addition","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-addition;default.default;[t] "suma con n\u00famero variable de sumandos";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Rule,abstr-multiplication,default.default,[t] "producto con"; [t] count(./children/*); [t] "factores",self::infixop,@role="multiplication"'.split(","),'Rule;abstr-multiplication;mathspeak.brief;[t] "producto";self::infixop;@role="multiplication"'.split(";"),["SpecializedRule","abstr-multiplication","mathspeak.brief","mathspeak.sbrief"],["Aliases","abstr-multiplication","self::infixop",'@role="implicit"'],'Rule;abstr-var-multiplication;default.default;[t] "producto con una cantidad variable de factores";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "),["Rule","abstr-vector","default.default",'[t] "vector de dimensi\u00f3n"; [t] count(./children/*)',"self::vector"],["Rule","abstr-vector","mathspeak.brief",'[t] "vector"',"self::vector"],["SpecializedRule","abstr-vector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-vector;default.default;[t] "vector de dimensi\u00f3n n";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(";"), +'Rule;abstr-binomial;default.default;[t] "binomio";self::vector;@role="binomial"'.split(";"),["SpecializedRule","abstr-binomial","default.default","mathspeak.brief"],["SpecializedRule","abstr-binomial","default.default","mathspeak.sbrief"],'Rule,abstr-determinant,default.default,[t] "determinante de dimensi\u00f3n"; [t] count(./children/*),self::matrix,@role="determinant"'.split(","),'Rule;abstr-determinant;mathspeak.brief;[t] "determinante";self::matrix;@role="determinant"'.split(";"),["SpecializedRule", +"abstr-determinant","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-determinant;default.default;[t] "determinante de dimensi\u00f3n n";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),'Rule,abstr-squarematrix,default.default,[t] "matriz cuadrada de dimensi\u00f3n"; [t] count(./children/*),self::matrix,@role="squarematrix"'.split(","),'Rule;abstr-squarematrix;mathspeak.brief;[t] "matriz cuadrada";self::matrix;@role="squarematrix"'.split(";"), +["SpecializedRule","abstr-squarematrix","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-rowvector,default.default,[t] "vector fila de dimensi\u00f3n"; [t] count(./children/row/children/*),self::matrix,@role="rowvector"'.split(","),'Rule;abstr-rowvector;mathspeak.brief;[t] "vector fila";self::matrix;@role="rowvector"'.split(";"),["SpecializedRule","abstr-rowvector","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "vector fila de dimensi\u00f3n n";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-matrix","default.default",'[t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [t] "matriz"',"self::matrix"],["Rule","abstr-matrix","mathspeak.brief",'[t] "matriz"',"self::matrix"],["SpecializedRule","abstr-matrix","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-matrix;default.default;[t] "matriz de dimensi\u00f3n n por m";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-cases","default.default",'[t] "declaraci\u00f3n de caso";[t] "con"; [t] count(children/*); [t] "casos"', +"self::cases"],["Rule","abstr-cases","mathspeak.brief",'[t] "declaraci\u00f3n de caso"',"self::cases"],["SpecializedRule","abstr-cases","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-cases;default.default;[t] "declaraci\u00f3n de caso con n\u00famero variable de casos";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(";"),["Rule","abstr-punctuated","default.default",'[t] "lista separada por"; [n] content/*[1]; [t] "de longitud"; [t] count(children/*) - count(content/*)', +"self::punctuated"],["Rule","abstr-punctuated","mathspeak.brief",'[t] "lista separada por"; [n] content/*[1]',"self::punctuated"],["SpecializedRule","abstr-punctuated","mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-punctuated,default.default,[t] "lista separada por"; [n] content/*[1],[t] "de longitud variable",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(","),["Rule","abstr-bigop","default.default","[n] content/*[1]","self::bigop"],["Rule","abstr-integral","default.default", +'[t] "integral"','@role="integral"'],"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(","),'Rule,abstr-relation-seq,default.default,[t] "secuencia de"; [t] @role (grammar:localRole); [t] "con"; [t] count(./children/*); [t] "elementos",self::relseq,count(./children/*)>2'.split(","),'Rule,abstr-relation-seq,mathspeak.brief,[t] "secuencia de"; [t] @role (grammar:localRole),self::relseq,count(./children/*)>2'.split(","),["SpecializedRule","abstr-relation-seq", +"mathspeak.brief","mathspeak.sbrief"],'Rule,abstr-var-relation,default.default,[t] "secuencia de"; [t] @role (grammar:localRole); [t] "con una cantidad variable de elementos",self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(","),'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(" "),'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(" "), +'Rule,abstr-multirel,default.default,[t] "secuencia de relaci\u00f3n"; [t] "con"; [t] count(./children/*); [t] "elementos",self::multirel,count(./children/*)>2'.split(","),'Rule;abstr-multirel;mathspeak.brief;[t] "secuencia de relaci\u00f3n";self::multirel;count(./children/*)>2'.split(";"),["SpecializedRule","abstr-multirel","mathspeak.brief","mathspeak.sbrief"],'Rule;abstr-var-multirel;default.default;[t] "secuencia de relaci\u00f3n con n\u00famero variable de elementos";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(";"), +["Rule","abstr-table","default.default",'[t] "mesa con"; [t] count(children/*); [t] "filas y";[t] count(children/*[1]/children/*); [t] "columnas"',"self::table"],["Rule","abstr-line","default.default",'[t] "en"; [t] @role (grammar:localRole);',"self::line"],["Rule","abstr-row","default.default",'[t] "en"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "con";[t] count(children/*); [t] "columnas"',"self::row"],["Rule","abstr-cell","default.default",'[t] "en"; [t] @role (grammar:localRole);', +"self::cell"]]};sre.SpeechRuleStores={}; +sre.SpeechRuleStores.RULE_SETS_={SemanticTreeRules:sre.SemanticTreeRules,MathspeakFrench:sre.MathspeakFrench,MathspeakGerman:sre.MathspeakGerman,MathspeakRules:sre.MathspeakRules,MathspeakSpanish:sre.MathspeakSpanish,NemethRules:sre.NemethRules,ClearspeakFrench:sre.ClearspeakFrench,ClearspeakGerman:sre.ClearspeakGerman,ClearspeakRules:sre.ClearspeakRules,EmacspeakRules:sre.EmacspeakRules,SummaryFrench:sre.SummaryFrench,SummaryGerman:sre.SummaryGerman,SummaryRules:sre.SummaryRules,SummarySpanish:sre.SummarySpanish, +PrefixFrench:sre.PrefixFrench,PrefixGerman:sre.PrefixGerman,PrefixRules:sre.PrefixRules,PrefixSpanish:sre.PrefixSpanish};sre.SpeechRuleStores.availableSets=function(){return Object.keys(sre.SpeechRuleStores.RULE_SETS_)};sre.SpeechRuleStores.getConstructor=function(a){return(a=sre.SpeechRuleStores.RULE_SETS_[a])?a:null};sre.SpeechRuleEngine=function(){this.activeStore_=null;this.cache_={};this.ready_=!0;this.combinedStores_={};this.evaluators_={};this.ruleSets_={};sre.Engine.registerTest(goog.bind(function(a){return this.ready_},this))};goog.addSingletonGetter(sre.SpeechRuleEngine); +sre.SpeechRuleEngine.prototype.parameterize=function(a){for(var b={},c=0,d=a.length;c=g.length&&d.push(g.shift());e=e.concat(g)}b.push(d);e.forEach(function(h){return b.push(h)})}else a.childNodes.forEach(function(h){return sre.ColorGenerator.visitStree_(h, +b,c)})}else c[a.id]||b.push(a.id)};sre.DirectSpeechGenerator=function(){sre.AbstractSpeechGenerator.call(this)};goog.inherits(sre.DirectSpeechGenerator,sre.AbstractSpeechGenerator);sre.DirectSpeechGenerator.prototype.getSpeech=function(a,b){return sre.WalkerUtil.getAttribute(a,this.modality)};sre.DummySpeechGenerator=function(){sre.AbstractSpeechGenerator.call(this)};goog.inherits(sre.DummySpeechGenerator,sre.AbstractSpeechGenerator);sre.DummySpeechGenerator.prototype.getSpeech=function(a,b){return""};sre.TreeSpeechGenerator=function(){sre.AbstractSpeechGenerator.call(this)};goog.inherits(sre.TreeSpeechGenerator,sre.AbstractSpeechGenerator); +sre.TreeSpeechGenerator.prototype.getSpeech=function(a,b){var c=this.generateSpeech(a,b);a.setAttribute(this.modality,c);var d=this.getRebuilt().nodeDict,e;for(e in d){var f=d[e],g=sre.WalkerUtil.getBySemanticId(b,e),h=sre.WalkerUtil.getBySemanticId(a,e);g&&h&&(sre.SpeechGeneratorUtil.addSpeech(h,f,this.modality),this.modality===sre.EnrichMathml.Attribute.SPEECH&&sre.SpeechGeneratorUtil.addPrefix(h,f))}return c};sre.NodeSpeechGenerator=function(){sre.TreeSpeechGenerator.call(this)};goog.inherits(sre.NodeSpeechGenerator,sre.TreeSpeechGenerator);sre.NodeSpeechGenerator.prototype.getSpeech=function(a,b){var c=sre.WalkerUtil.getAttribute(a,this.modality);return c?c:sre.NodeSpeechGenerator.superClass_.getSpeech.call(this,a,b)};sre.SummarySpeechGenerator=function(){sre.AbstractSpeechGenerator.call(this)};goog.inherits(sre.SummarySpeechGenerator,sre.AbstractSpeechGenerator);sre.SummarySpeechGenerator.prototype.getSpeech=function(a,b){sre.SpeechGeneratorUtil.connectAllMactions(b,this.getRebuilt().xml);return this.generateSpeech(a,b)};sre.SpeechGeneratorFactory={};sre.SpeechGeneratorFactory.generator=function(a){return new (sre.SpeechGeneratorFactory.generatorMapping_[a]||sre.SpeechGeneratorFactory.generatorMapping_.Direct)};sre.SpeechGeneratorFactory.generatorMapping_={Adhoc:sre.AdhocSpeechGenerator,Color:sre.ColorGenerator,Direct:sre.DirectSpeechGenerator,Dummy:sre.DummySpeechGenerator,Node:sre.NodeSpeechGenerator,Summary:sre.SummarySpeechGenerator,Tree:sre.TreeSpeechGenerator};sre.EventUtil={};sre.EventUtil.KeyCode={ENTER:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,TAB:9,LESS:188,GREATER:190,DASH:189,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90};sre.EventUtil.Move=function(){var a={},b;for(b in sre.EventUtil.KeyCode)a[sre.EventUtil.KeyCode[b]]=b;return a}(); +sre.EventUtil.EventType={CLICK:"click",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",SELECTSTART:"selectstart",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel"};sre.EventUtil.Event=function(a,b,c){this.src=a;this.type=b;this.callback=c};sre.EventUtil.Event.prototype.add=function(){this.src.addEventListener(this.type,this.callback)}; +sre.EventUtil.Event.prototype.remove=function(){this.src.removeEventListener(this.type,this.callback)};sre.Focus=function(a,b){this.semanticNodes_=a;this.semanticPrimary_=b;this.domNodes_=[];this.domPrimary_=null;this.allNodes_=[]};sre.Focus.prototype.getSemanticPrimary=function(){return this.semanticPrimary_};sre.Focus.prototype.getSemanticNodes=function(){return this.semanticNodes_};sre.Focus.prototype.getNodes=function(){return this.allNodes_};sre.Focus.prototype.getDomNodes=function(){return this.domNodes_};sre.Focus.prototype.getDomPrimary=function(){return this.domPrimary_}; +sre.Focus.prototype.toString=function(){return"Primary:"+this.domPrimary_+" Nodes:"+this.domNodes_};sre.Focus.prototype.clone=function(){var a=new sre.Focus(this.semanticNodes_,this.semanticPrimary_);a.domNodes_=this.domNodes_;a.domPrimary_=this.domPrimary_;a.allNodes_=this.allNodes_;return a}; +sre.Focus.factory=function(a,b,c,d){var e=function(h){return sre.WalkerUtil.getBySemanticId(d,h)},f=c.nodeDict;c=e(a);e=b.map(e);var g=b.map(function(h){return f[h]});a=new sre.Focus(g,f[a]);a.domNodes_=e;a.domPrimary_=c;a.allNodes_=sre.Focus.generateAllVisibleNodes_(b,e,f,d);return a}; +sre.Focus.generateAllVisibleNodes_=function(a,b,c,d){for(var e=function(m){return sre.WalkerUtil.getBySemanticId(d,m)},f=[],g=0,h=a.length;ga||a>=b.length?null:b[a]};sre.Levels.prototype.depth=function(){return this.level_.length};sre.Levels.prototype.clone=function(){var a=new sre.Levels;a.level_=this.level_.slice(0);return a};sre.Levels.prototype.toString=function(){for(var a="",b=0,c;c=this.level_[b];b++)a+="\n"+c.map(function(d){return d.toString()});return a};sre.Walker=function(){};sre.Walker.prototype.isActive=function(){};sre.Walker.prototype.activate=function(){};sre.Walker.prototype.deactivate=function(){};sre.Walker.prototype.speech=function(){};sre.Walker.prototype.getXml=function(){};sre.Walker.prototype.getRebuilt=function(){};sre.Walker.prototype.getFocus=function(a){};sre.Walker.prototype.setFocus=function(a){};sre.Walker.prototype.getDepth=function(){};sre.Walker.prototype.move=function(a){};sre.Walker.prototype.update=function(a){}; +sre.Walker.move={UP:"up",DOWN:"down",LEFT:"left",RIGHT:"right",REPEAT:"repeat",DEPTH:"depth",ENTER:"enter",EXPAND:"expand",HOME:"home",SUMMARY:"summary",DETAIL:"detail",ROW:"row",CELL:"cell"};sre.Walker.STATE_={};sre.Walker.resetState=function(a){delete sre.Walker.STATE_[a]};sre.Walker.setState=function(a,b){sre.Walker.STATE_[a]=b};sre.Walker.getState=function(a){return sre.Walker.STATE_[a]};sre.AbstractWalker=function(a,b,c,d){this.node=a;this.node.id?this.id=this.node.id:this.node.hasAttribute(sre.AbstractWalker.SRE_ID_ATTR)?this.id=this.node.getAttribute(sre.AbstractWalker.SRE_ID_ATTR):(this.node.setAttribute(sre.AbstractWalker.SRE_ID_ATTR,sre.AbstractWalker.ID_COUNTER),this.id=sre.AbstractWalker.ID_COUNTER++);this.generator=b;this.highlighter=c;this.rootNode=sre.WalkerUtil.getSemanticRoot(a);this.rootId=this.rootNode.getAttribute(sre.EnrichMathml.Attribute.ID);this.xmlString_=d;this.focus_= +this.rebuilt_=this.xml_=null;this.keyMapping={};this.keyMapping[sre.EventUtil.KeyCode.UP]=goog.bind(this.up,this);this.keyMapping[sre.EventUtil.KeyCode.DOWN]=goog.bind(this.down,this);this.keyMapping[sre.EventUtil.KeyCode.RIGHT]=goog.bind(this.right,this);this.keyMapping[sre.EventUtil.KeyCode.LEFT]=goog.bind(this.left,this);this.keyMapping[sre.EventUtil.KeyCode.TAB]=goog.bind(this.repeat,this);this.keyMapping[sre.EventUtil.KeyCode.DASH]=goog.bind(this.expand,this);this.keyMapping[sre.EventUtil.KeyCode.SPACE]= +goog.bind(this.depth,this);this.keyMapping[sre.EventUtil.KeyCode.HOME]=goog.bind(this.home,this);this.keyMapping[sre.EventUtil.KeyCode.X]=goog.bind(this.summary,this);this.keyMapping[sre.EventUtil.KeyCode.Z]=goog.bind(this.detail,this);this.keyMapping[sre.EventUtil.KeyCode.V]=goog.bind(this.virtualize,this);this.keyMapping[sre.EventUtil.KeyCode.P]=goog.bind(this.previous,this);this.keyMapping[sre.EventUtil.KeyCode.U]=goog.bind(this.undo,this);this.keyMapping[sre.EventUtil.KeyCode.LESS]=goog.bind(this.previousRules, +this);this.keyMapping[sre.EventUtil.KeyCode.GREATER]=goog.bind(this.nextRules,this);this.active_=!1;this.moved=sre.Walker.move.ENTER;this.cursors=[]};sre.AbstractWalker.prototype.getXml=function(){this.xml_||(this.xml_=sre.DomUtil.parseInput(this.xmlString_));return this.xml_};sre.AbstractWalker.prototype.getRebuilt=function(){this.rebuilt_||(this.rebuilt_=this.rebuildStree());return this.rebuilt_};sre.AbstractWalker.ID_COUNTER=0;sre.AbstractWalker.SRE_ID_ATTR="sre-explorer-id"; +sre.AbstractWalker.prototype.isActive=function(){return this.active_};sre.AbstractWalker.prototype.toggleActive_=function(){this.active_=!this.active_};sre.AbstractWalker.prototype.activate=function(){this.isActive()||(this.generator.start(),this.toggleActive_())};sre.AbstractWalker.prototype.deactivate=function(){this.isActive()&&(sre.Walker.setState(this.id,this.primaryId()),this.generator.end(),this.toggleActive_())}; +sre.AbstractWalker.prototype.getFocus=function(a){this.focus_||(this.focus_=sre.Focus.factory(this.rootId,[this.rootId],this.getRebuilt(),this.node));a&&this.updateFocus();return this.focus_};sre.AbstractWalker.prototype.setFocus=function(a){this.focus_=a};sre.AbstractWalker.prototype.getDepth=function(){return this.levels.depth()-1};sre.AbstractWalker.prototype.isSpeech=function(){return this.generator.modality===sre.EnrichMathml.Attribute.SPEECH}; +sre.AbstractWalker.prototype.speech=function(){var a=this.getFocus().getDomNodes();if(!a.length)return"";var b=this.specialMove();if(null!==b)return b;switch(this.moved){case sre.Walker.move.DEPTH:return this.depth_();case sre.Walker.move.SUMMARY:return this.summary_();case sre.Walker.move.DETAIL:return this.detail_();default:b=[];for(var c=this.getFocus().getSemanticNodes(),d=0,e=a.length;d=a.length-1?a[0]:a[c+1]}if("clearspeak"===a){var d=sre.ClearspeakPreferences.getLocalePreferences().en;if(!d)return"default";a=sre.ClearspeakPreferences.relevantPreferences(this.getFocus().getSemanticPrimary());c=sre.ClearspeakPreferences.findPreference(b,a);d=d[a].map(function(e){return e.split("_")[1]});c=d.indexOf(c);return-1===c?b:sre.ClearspeakPreferences.addPreference(b, +a,c>=d.length-1?d[0]:d[c+1])}return b};sre.AbstractWalker.prototype.previousRules=function(){var a=this.generator.getOptions();if("speech"!==a.modality)return this.getFocus();a.style=this.nextStyle(a.domain,a.style);this.update(a);this.moved=sre.Walker.move.REPEAT;return this.getFocus().clone()};sre.DummyWalker=function(a,b,c,d){sre.AbstractWalker.call(this,a,b,c,d)};goog.inherits(sre.DummyWalker,sre.AbstractWalker);sre.DummyWalker.prototype.up=function(){};sre.DummyWalker.prototype.down=function(){};sre.DummyWalker.prototype.left=function(){};sre.DummyWalker.prototype.right=function(){};sre.DummyWalker.prototype.repeat=function(){};sre.DummyWalker.prototype.depth=function(){};sre.DummyWalker.prototype.home=function(){};sre.DummyWalker.prototype.getDepth=function(){return 0}; +sre.DummyWalker.prototype.initLevels=function(){};sre.SemanticWalker=function(a,b,c,d){sre.AbstractWalker.call(this,a,b,c,d);this.levels=null;this.restoreState()};goog.inherits(sre.SemanticWalker,sre.AbstractWalker);sre.SemanticWalker.prototype.initLevels=function(){var a=new sre.Levels;a.push([this.getFocus()]);return a}; +sre.SemanticWalker.prototype.up=function(){sre.SemanticWalker.superClass_.up.call(this);var a=this.previousLevel();if(!a)return null;this.levels.pop();return this.levels.find(function(b){return b.getSemanticNodes().some(function(c){return c.id.toString()===a})})};sre.SemanticWalker.prototype.down=function(){sre.SemanticWalker.superClass_.down.call(this);var a=this.nextLevel();if(0===a.length)return null;this.levels.push(a);return a[0]}; +sre.SemanticWalker.prototype.combineContentChildren=function(a,b,c,d){switch(a){case sre.SemanticAttr.Type.RELSEQ:case sre.SemanticAttr.Type.INFIXOP:case sre.SemanticAttr.Type.MULTIREL:return this.makePairList(d,c);case sre.SemanticAttr.Type.PREFIXOP:return[this.focusFromId(d[0],c.concat(d))];case sre.SemanticAttr.Type.POSTFIXOP:return[this.focusFromId(d[0],d.concat(c))];case sre.SemanticAttr.Type.MATRIX:case sre.SemanticAttr.Type.VECTOR:case sre.SemanticAttr.Type.FENCED:return[this.focusFromId(d[0], +[c[0],d[0],c[1]])];case sre.SemanticAttr.Type.CASES:return[this.focusFromId(d[0],[c[0],d[0]])];case sre.SemanticAttr.Type.PUNCTUATED:return b===sre.SemanticAttr.Role.TEXT?d.map(goog.bind(this.singletonFocus,this)):d.length===c.length?c.map(goog.bind(this.singletonFocus,this)):this.combinePunctuations(d,c,[],[]);case sre.SemanticAttr.Type.APPL:return[this.focusFromId(d[0],[d[0],c[0]]),this.singletonFocus(d[1])];case sre.SemanticAttr.Type.ROOT:return[this.singletonFocus(d[1]),this.singletonFocus(d[0])]; +default:return d.map(goog.bind(this.singletonFocus,this))}};sre.SemanticWalker.prototype.combinePunctuations=function(a,b,c,d){if(0===a.length)return d;var e=a.shift(),f=b.shift();if(e===f)return c.push(f),this.combinePunctuations(a,b,c,d);b.unshift(f);c.push(e);if(a.length===b.length)return d.push(this.focusFromId(e,c.concat(b))),d;d.push(this.focusFromId(e,c));return this.combinePunctuations(a,b,[],d)}; +sre.SemanticWalker.prototype.makePairList=function(a,b){if(0===a.length)return[];if(1===a.length)return[this.singletonFocus(a[0])];for(var c=[this.singletonFocus(a.shift())],d=0,e=a.length;dthis.currentTable_.childNodes.length)return this.getFocus();this.row_=a;this.moved=sre.Walker.move.ROW;return this.getFocus().clone()}; +sre.TableWalker.prototype.jumpCell_=function(a,b){this.firstJump?this.virtualize(!1):(this.firstJump=this.getFocus(),this.virtualize(!0));var c=this.currentTable_.id.toString();do var d=this.levels.pop();while(-1===d.indexOf(c));this.levels.push(d);this.setFocus(this.singletonFocus(c));this.levels.push(this.nextLevel());a=this.currentTable_.childNodes[a-1];this.setFocus(this.singletonFocus(a.id.toString()));this.levels.push(this.nextLevel());return this.singletonFocus(a.childNodes[b-1].id.toString())}; +sre.TableWalker.prototype.isLegalJump_=function(a,b){var c=sre.DomUtil.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",this.currentTable_.id.toString())[0];if(!c||c.hasAttribute("alternative"))return!1;a=this.currentTable_.childNodes[a-1];if(!a)return!1;c=sre.DomUtil.querySelectorAllByAttrValue(c,"id",a.id.toString())[0];return!c||c.hasAttribute("alternative")?!1:!(!a||!a.childNodes[b-1])}; +sre.TableWalker.prototype.isInTable_=function(){for(var a=this.getFocus().getSemanticPrimary();a;){if(-1!==sre.TableWalker.ELIGIBLE_TABLE_TYPES.indexOf(a.type))return this.currentTable_=a,!0;a=a.parent}return!1};sre.TableWalker.prototype.undo=function(){var a=sre.TableWalker.superClass_.undo.call(this);a===this.firstJump&&(this.firstJump=null);return a};sre.WalkerFactory={};sre.WalkerFactory.walker=function(a,b,c,d,e){return new (sre.WalkerFactory.walkerMapping_[a.toLowerCase()]||sre.WalkerFactory.walkerMapping_.dummy)(b,c,d,e)};sre.WalkerFactory.walkerMapping_={dummy:sre.DummyWalker,semantic:sre.SemanticWalker,syntax:sre.SyntaxWalker,table:sre.TableWalker};sre.ProcessorFactory={};sre.ProcessorFactory.PROCESSORS_={};sre.ProcessorFactory.get_=function(a){var b=sre.ProcessorFactory.PROCESSORS_[a.toLowerCase()];if(!b)throw new sre.Engine.Error("Unknown processor "+a);return b};sre.ProcessorFactory.process=function(a,b){return sre.ProcessorFactory.get_(a).processor(b)};sre.ProcessorFactory.print=function(a,b){a=sre.ProcessorFactory.get_(a);return sre.Engine.getInstance().pprint?a.pprint(b):a.print(b)}; +sre.ProcessorFactory.output=function(a,b){a=sre.ProcessorFactory.get_(a);b=a.processor(b);return sre.Engine.getInstance().pprint?a.pprint(b):a.print(b)};sre.ProcessorFactory.keypress=function(a,b){a=sre.ProcessorFactory.get_(a);b=a.key?a.key(b):b;b=a.processor(b);return sre.Engine.getInstance().pprint?a.pprint(b):a.print(b)}; +sre.Processor=function(a,b){this.name=a;this.processor=b.processor;this.print=b.print||sre.Processor.stringify_;this.pprint=b.pprint||this.print;sre.ProcessorFactory.PROCESSORS_[this.name]=this};sre.KeyProcessor=function(a,b){sre.Processor.call(this,a,b);this.key=b.key||sre.KeyProcessor.getKey_};goog.inherits(sre.KeyProcessor,sre.Processor);sre.KeyProcessor.getKey_=function(a){return"string"===typeof a?sre.EventUtil.KeyCode[a.toUpperCase()]:a}; +sre.Processor.LocalState_={walker:null,speechGenerator:null,highlighter:null};sre.Processor.stringify_=function(a){return a?a.toString():a};new sre.Processor("semantic",{processor:function(a){a=sre.DomUtil.parseInput(a);return sre.Semantic.xmlTree(a)},pprint:function(a){return sre.DomUtil.formatXml(a.toString())}}); +new sre.Processor("speech",{processor:function(a){a=sre.DomUtil.parseInput(a);a=sre.Semantic.xmlTree(a);a=sre.SpeechGeneratorUtil.computeSpeech(a);var b=sre.AuralRendering.getInstance();return b.finalize(b.markup(a))},pprint:function(a){a=a.toString();return sre.AuralRendering.ofType(sre.XmlRenderer)?sre.DomUtil.formatXml(a):a}}); +new sre.Processor("json",{processor:function(a){a=sre.DomUtil.parseInput(a,sre.Engine.Error);return sre.Semantic.getTree(a).toJson()},print:function(a){return JSON.stringify(a)},pprint:function(a){return JSON.stringify(a,null,2)}});new sre.Processor("description",{processor:function(a){a=sre.DomUtil.parseInput(a);a=sre.Semantic.xmlTree(a);return sre.SpeechGeneratorUtil.computeSpeech(a)},print:function(a){return JSON.stringify(a)},pprint:function(a){return JSON.stringify(a,null,2)}}); +new sre.Processor("enriched",{processor:function(a){a=sre.Enrich.semanticMathmlSync(a);var b=sre.WalkerUtil.getSemanticRoot(a);switch(sre.Engine.getInstance().speech){case sre.Engine.Speech.SHALLOW:var c=sre.SpeechGeneratorFactory.generator("Adhoc");c.getSpeech(b,a);break;case sre.Engine.Speech.DEEP:c=sre.SpeechGeneratorFactory.generator("Tree"),c.getSpeech(b,a)}return a},pprint:function(a){return sre.DomUtil.formatXml(a.toString())}}); +new sre.Processor("walker",{processor:function(a){var b=sre.SpeechGeneratorFactory.generator("Node");sre.Processor.LocalState_.speechGenerator=b;sre.Processor.LocalState_.highlighter=sre.HighlighterFactory.highlighter({color:"black"},{color:"white"},{renderer:"NativeMML"});a=sre.ProcessorFactory.process("enriched",a);var c=sre.ProcessorFactory.print("enriched",a);sre.Processor.LocalState_.walker=sre.WalkerFactory.walker(sre.Engine.getInstance().walker,a,b,sre.Processor.LocalState_.highlighter,c); +return sre.Processor.LocalState_.walker},print:function(a){return sre.Processor.LocalState_.walker.speech()}});new sre.KeyProcessor("move",{processor:function(a){return sre.Processor.LocalState_.walker?!1===sre.Processor.LocalState_.walker.move(a)?sre.AuralRendering.getInstance().error(a):sre.Processor.LocalState_.walker.speech():null}});sre.System=function(){this.version=sre.Variables.VERSION};goog.addSingletonGetter(sre.System); +sre.System.prototype.setupEngine=function(a){var b=sre.Engine.getInstance(),c=function(d){b[d]=a[d]||b[d]};c("mode");sre.System.prototype.configBlocks_(a);sre.Engine.BINARY_FEATURES.forEach(function(d){"undefined"!==typeof a[d]&&(b[d]=!!a[d])});sre.Engine.STRING_FEATURES.forEach(c);a.json&&(sre.SystemExternal.jsonPath=sre.BaseUtil.makePath(a.json));a.xpath&&(sre.SystemExternal.WGXpath=a.xpath);b.setupBrowsers();b.ruleSets=a.rules?a.rules:sre.SpeechRuleStores.availableSets();sre.SpeechRuleEngine.getInstance().parameterize(b.ruleSets); +b.setDynamicCstr();sre.L10n.setLocale()};sre.System.prototype.configBlocks_=function(a){if(!sre.Engine.getInstance().config&&sre.Engine.getInstance().mode===sre.Engine.Mode.HTTP){sre.Engine.getInstance().config=!0;for(var b=document.documentElement.querySelectorAll('script[type="text/x-sre-config"]'),c=0,d=b.length;c= 0; i--) { + var dependent = this.dependents[i]; + if (dependent.Disable) dependent.Disable(false,menu); + } + if (update) MathJax.Hub.Queue(["Reprocess",MathJax.Hub]); + }, + + // + // Register a dependent + // + Dependent: function (extension) { + this.dependents.push(extension); + } +}; + +(function () { + // + // Set up the a11y path,if it isn't already in place + // + var PATH = MathJax.Ajax.config.path; + if (!PATH.a11y) PATH.a11y = HUB.config.root + "/extensions/a11y"; + + // + // Load SRE and use the signal to tell MathJax when it is loaded. + // Since SRE waits for the mml element jax, load that too. + // + if (!PATH.SRE) PATH.SRE = MathJax.Ajax.fileURL(PATH.a11y); + MathJax.Ajax.Load("[SRE]/mathjax-sre.js"); + MathJax.Hub.Register.StartupHook("Sre Ready",["loadComplete",MathJax.Ajax,"[SRE]/mathjax-sre.js"]); +})(); + +// +// Make a queue so that the MathML jax and SRE are both loaded before +// we install the filter and signal that we are ready. The MathML config.js +// file must load before loading its jax.js file. +// +MathJax.Callback.Queue( + // + // Load mml jax + // + ["Require",MathJax.Ajax,"[MathJax]/jax/element/mml/jax.js"], + // + // Load MathML input jax (since we need Parse.MakeMML) + // + ["Require",MathJax.Ajax,"[MathJax]/jax/input/MathML/config.js"], + ["Require",MathJax.Ajax,"[MathJax]/jax/input/MathML/jax.js"], + // + // Load toMathML extension (if it isn't already) + // + ["Require",MathJax.Ajax,"[MathJax]/extensions/toMathML.js"], + // + // Wait for SRE (which waits for mml jax) before modifying mbase + // + MathJax.Hub.Register.StartupHook("Sre Ready",function () { + var MML = MathJax.ElementJax.mml, + ENRICH = MathJax.Extension["semantic-enrich"]; + + // + // Override toMathML's attribute function to include additional + // attributes inherited from mstyle (so SRE doesn't have to look them + // up itself). Eventually, this should be moved to toMathML.js directly. + // + MML.mbase.Augment({ + toMathMLattributes: function () { + var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults); + var names = (this.attrNames||MML.copyAttributeNames), + skip = MML.skipAttributes, copy = MML.copyAttributes, + lookup = (ENRICH.running ? ENRICH.mstyleLookup[this.type]||[] : []); + var attr = [], ATTR = (this.attr||{}); + + if (this.type === "math" && (!this.attr || !('xmlns' in this.attr))) + attr.push('xmlns="http://www.w3.org/1998/Math/MathML"'); + if (!this.attrNames) { + for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) { + if (this[id] != null && this[id] !== defaults[id]) { + if (this.Get(id,null,1) !== this[id]) this.toMathMLaddAttr(attr,id,this[id]); + } + }} + } + for (var i = 0, m = names.length; i < m; i++) { + if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue; + value = ATTR[names[i]]; if (value == null) value = this[names[i]]; + if (value != null) this.toMathMLaddAttr(attr,names[i],value); + } + for (i = 0, m = lookup.length; i < m; i++) { + id = lookup[i]; + if (defaults.hasOwnProperty(id) && !attr["_"+id]) { + value = this.Get(id,1); + if (value != null) this.toMathMLaddAttr(attr,id,value); + } + } + this.toMathMLclass(attr); + if (attr.length) return " "+attr.join(" "); else return ""; + }, + toMathMLaddAttr: function (attr,id,value) { + attr.push(id+'="'+this.toMathMLquote(value)+'"'); + attr["_"+id] = 1; + } + }); + + // + // Adjust setTeXclass for so that added elements don't + // cause unwanted space. + // + var TEXCLASS = MML.mo.prototype.setTeXclass; + MML.mo.Augment({ + setTeXclass: function (prev) { + var values = this.getValues("form","lspace","rspace"); // sets useMMLspacing + if (this.useMMLspacing) { + this.texClass = MML.TEXCLASS.NONE; + return this; + } + if (this.attr && this.attr["data-semantic-added"]) { + this.texClass = this.prevClass = MML.TEXCLASS.NONE; + return prev; + } + return TEXCLASS.apply(this,arguments); + } + }); + }), + function () { + // + // Install enrichment filter, and signal that we are ready. + // + MathJax.Hub.postInputHooks.Add(["Filter",MathJax.Extension["semantic-enrich"]],50); + MathJax.Hub.Startup.signal.Post("Semantic Enrich Ready"); + MathJax.Ajax.loadComplete("[a11y]/semantic-enrich.js"); + } +); + + +// @license-end diff --git a/js/mathjax/extensions/a11y/wgxpath.install.js b/js/mathjax/extensions/a11y/wgxpath.install.js new file mode 100644 index 0000000..a983680 --- /dev/null +++ b/js/mathjax/extensions/a11y/wgxpath.install.js @@ -0,0 +1,77 @@ +(function(){'use strict';var k=this; +function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"== +b&&"undefined"==typeof a.call)return"object";return b}function l(a){return"string"==typeof a}function ba(a,b,c){return a.call.apply(a.bind,arguments)}function ca(a,b,c){if(!a)throw Error();if(2b?1:0};var ha=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(l(a))return l(b)&&1==b.length?a.indexOf(b,c):-1;for(;cc?null:l(a)?a.charAt(c):a[c]}function la(a){return Array.prototype.concat.apply(Array.prototype,arguments)}function ma(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};var u;a:{var na=k.navigator;if(na){var oa=na.userAgent;if(oa){u=oa;break a}}u=""};var pa=q(u,"Opera")||q(u,"OPR"),v=q(u,"Trident")||q(u,"MSIE"),qa=q(u,"Edge"),ra=q(u,"Gecko")&&!(q(u.toLowerCase(),"webkit")&&!q(u,"Edge"))&&!(q(u,"Trident")||q(u,"MSIE"))&&!q(u,"Edge"),sa=q(u.toLowerCase(),"webkit")&&!q(u,"Edge");function ta(){var a=k.document;return a?a.documentMode:void 0}var ua; +a:{var va="",wa=function(){var a=u;if(ra)return/rv\:([^\);]+)(\)|;)/.exec(a);if(qa)return/Edge\/([\d\.]+)/.exec(a);if(v)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(sa)return/WebKit\/(\S+)/.exec(a);if(pa)return/(?:Version)[ \/]?(\S+)/.exec(a)}();wa&&(va=wa?wa[1]:"");if(v){var xa=ta();if(null!=xa&&xa>parseFloat(va)){ua=String(xa);break a}}ua=va}var ya={}; +function za(a){if(!ya[a]){for(var b=0,c=fa(String(ua)).split("."),d=fa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f",4,2,function(a,b,c){return O(function(a,b){return a>b},a,b,c)});P("<=",4,2,function(a,b,c){return O(function(a,b){return a<=b},a,b,c)});P(">=",4,2,function(a,b,c){return O(function(a,b){return a>=b},a,b,c)});var Wa=P("=",3,2,function(a,b,c){return O(function(a,b){return a==b},a,b,c,!0)});P("!=",3,2,function(a,b,c){return O(function(a,b){return a!=b},a,b,c,!0)});P("and",2,2,function(a,b,c){return M(a,c)&&M(b,c)});P("or",1,2,function(a,b,c){return M(a,c)||M(b,c)});function Q(a,b,c){this.a=a;this.b=b||1;this.f=c||1};function Za(a,b){if(b.a.length&&4!=a.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");n.call(this,a.i);this.c=a;this.h=b;this.g=a.g;this.b=a.b}m(Za);Za.prototype.a=function(a){a=this.c.a(a);return $a(this.h,a)};Za.prototype.toString=function(){var a;a="Filter:"+J(this.c);return a+=J(this.h)};function ab(a,b){if(b.lengtha.v)throw Error("Function "+a.j+" expects at most "+a.v+" arguments, "+b.length+" given");a.B&&r(b,function(b,d){if(4!=b.i)throw Error("Argument "+d+" to function "+a.j+" is not of type Nodeset: "+b);});n.call(this,a.i);this.h=a;this.c=b;Ua(this,a.g||ja(b,function(a){return a.g}));Va(this,a.D&&!b.length||a.C&&!!b.length||ja(b,function(a){return a.b}))}m(ab); +ab.prototype.a=function(a){return this.h.m.apply(null,la(a,this.c))};ab.prototype.toString=function(){var a="Function: "+this.h;if(this.c.length)var b=t(this.c,function(a,b){return a+J(b)},"Arguments:"),a=a+J(b);return a};function bb(a,b,c,d,e,f,g,h,p){this.j=a;this.i=b;this.g=c;this.D=d;this.C=e;this.m=f;this.A=g;this.v=void 0!==h?h:g;this.B=!!p}bb.prototype.toString=function(){return this.j};var cb={}; +function R(a,b,c,d,e,f,g,h){if(cb.hasOwnProperty(a))throw Error("Function already created: "+a+".");cb[a]=new bb(a,b,c,d,!1,e,f,g,h)}R("boolean",2,!1,!1,function(a,b){return M(b,a)},1);R("ceiling",1,!1,!1,function(a,b){return Math.ceil(K(b,a))},1);R("concat",3,!1,!1,function(a,b){return t(ma(arguments,1),function(b,d){return b+L(d,a)},"")},2,null);R("contains",2,!1,!1,function(a,b,c){return q(L(b,a),L(c,a))},2);R("count",1,!1,!1,function(a,b){return b.a(a).l},1,1,!0); +R("false",2,!1,!1,function(){return!1},0);R("floor",1,!1,!1,function(a,b){return Math.floor(K(b,a))},1);R("id",4,!1,!1,function(a,b){function c(a){if(w){var b=e.all[a];if(b){if(b.nodeType&&a==b.id)return b;if(b.length)return ka(b,function(b){return a==b.id})}return null}return e.getElementById(a)}var d=a.a,e=9==d.nodeType?d:d.ownerDocument,d=L(b,a).split(/\s+/),f=[];r(d,function(a){a=c(a);!a||0<=ha(f,a)||f.push(a)});f.sort(La);var g=new C;r(f,function(a){F(g,a)});return g},1); +R("lang",2,!1,!1,function(){return!1},1);R("last",1,!0,!1,function(a){if(1!=arguments.length)throw Error("Function last expects ()");return a.f},0);R("local-name",3,!1,!0,function(a,b){var c=b?Ra(b.a(a)):a.a;return c?c.localName||c.nodeName.toLowerCase():""},0,1,!0);R("name",3,!1,!0,function(a,b){var c=b?Ra(b.a(a)):a.a;return c?c.nodeName.toLowerCase():""},0,1,!0);R("namespace-uri",3,!0,!1,function(){return""},0,1,!0); +R("normalize-space",3,!1,!0,function(a,b){return(b?L(b,a):z(a.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1);R("not",2,!1,!1,function(a,b){return!M(b,a)},1);R("number",1,!1,!0,function(a,b){return b?K(b,a):+z(a.a)},0,1);R("position",1,!0,!1,function(a){return a.b},0);R("round",1,!1,!1,function(a,b){return Math.round(K(b,a))},1);R("starts-with",2,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);return 0==b.lastIndexOf(a,0)},2);R("string",3,!1,!0,function(a,b){return b?L(b,a):z(a.a)},0,1); +R("string-length",1,!1,!0,function(a,b){return(b?L(b,a):z(a.a)).length},0,1);R("substring",3,!1,!1,function(a,b,c,d){c=K(c,a);if(isNaN(c)||Infinity==c||-Infinity==c)return"";d=d?K(d,a):Infinity;if(isNaN(d)||-Infinity===d)return"";c=Math.round(c)-1;var e=Math.max(c,0);a=L(b,a);return Infinity==d?a.substring(e):a.substring(e,c+Math.round(d))},2,3);R("substring-after",3,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);c=b.indexOf(a);return-1==c?"":b.substring(c+a.length)},2); +R("substring-before",3,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);a=b.indexOf(a);return-1==a?"":b.substring(0,a)},2);R("sum",1,!1,!1,function(a,b){for(var c=H(b.a(a)),d=0,e=I(c);e;e=I(c))d+=+z(e);return d},1,1,!0);R("translate",3,!1,!1,function(a,b,c,d){b=L(b,a);c=L(c,a);var e=L(d,a);a={};for(d=0;d]=|\s+|./g,hb=/^\s/;function S(a,b){return a.b[a.a+(b||0)]}function T(a){return a.b[a.a++]}function ib(a){return a.b.length<=a.a};function jb(a){n.call(this,3);this.c=a.substring(1,a.length-1)}m(jb);jb.prototype.a=function(){return this.c};jb.prototype.toString=function(){return"Literal: "+this.c};function E(a,b){this.j=a.toLowerCase();var c;c="*"==this.j?"*":"http://www.w3.org/1999/xhtml";this.c=b?b.toLowerCase():c}E.prototype.a=function(a){var b=a.nodeType;if(1!=b&&2!=b)return!1;b=void 0!==a.localName?a.localName:a.nodeName;return"*"!=this.j&&this.j!=b.toLowerCase()?!1:"*"==this.c?!0:this.c==(a.namespaceURI?a.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")};E.prototype.f=function(){return this.j}; +E.prototype.toString=function(){return"Name Test: "+("http://www.w3.org/1999/xhtml"==this.c?"":this.c+":")+this.j};function kb(a,b){n.call(this,a.i);this.h=a;this.c=b;this.g=a.g;this.b=a.b;if(1==this.c.length){var c=this.c[0];c.u||c.c!=lb||(c=c.o,"*"!=c.f()&&(this.f={name:c.f(),s:null}))}}m(kb);function mb(){n.call(this,4)}m(mb);mb.prototype.a=function(a){var b=new C;a=a.a;9==a.nodeType?F(b,a):F(b,a.ownerDocument);return b};mb.prototype.toString=function(){return"Root Helper Expression"};function nb(){n.call(this,4)}m(nb);nb.prototype.a=function(a){var b=new C;F(b,a.a);return b};nb.prototype.toString=function(){return"Context Helper Expression"}; +function ob(a){return"/"==a||"//"==a}kb.prototype.a=function(a){var b=this.h.a(a);if(!(b instanceof C))throw Error("Filter expression must evaluate to nodeset.");a=this.c;for(var c=0,d=a.length;ca.length)throw Error("Unclosed literal string");return new jb(a)} +function Hb(a){var b,c=[],d;if(ob(S(a.a))){b=T(a.a);d=S(a.a);if("/"==b&&(ib(a.a)||"."!=d&&".."!=d&&"@"!=d&&"*"!=d&&!/(?![0-9])[\w]/.test(d)))return new mb;d=new mb;W(a,"Missing next location step.");b=Ib(a,b);c.push(b)}else{a:{b=S(a.a);d=b.charAt(0);switch(d){case "$":throw Error("Variable reference not allowed in HTML XPath");case "(":T(a.a);b=Cb(a);W(a,'unclosed "("');Eb(a,")");break;case '"':case "'":b=Gb(a);break;default:if(isNaN(+b))if(!db(b)&&/(?![0-9])[\w]/.test(d)&&"("==S(a.a,1)){b=T(a.a); +b=cb[b]||null;T(a.a);for(d=[];")"!=S(a.a);){W(a,"Missing function argument list.");d.push(Cb(a));if(","!=S(a.a))break;T(a.a)}W(a,"Unclosed function argument list.");Fb(a);b=new ab(b,d)}else{b=null;break a}else b=new Ab(+T(a.a))}"["==S(a.a)&&(d=new sb(Jb(a)),b=new Za(b,d))}if(b)if(ob(S(a.a)))d=b;else return b;else b=Ib(a,"/"),d=new nb,c.push(b)}for(;ob(S(a.a));)b=T(a.a),W(a,"Missing next location step."),b=Ib(a,b),c.push(b);return new kb(d,c)} +function Ib(a,b){var c,d,e;if("/"!=b&&"//"!=b)throw Error('Step op should be "/" or "//"');if("."==S(a.a))return d=new U(yb,new G("node")),T(a.a),d;if(".."==S(a.a))return d=new U(xb,new G("node")),T(a.a),d;var f;if("@"==S(a.a))f=lb,T(a.a),W(a,"Missing attribute name");else if("::"==S(a.a,1)){if(!/(?![0-9])[\w]/.test(S(a.a).charAt(0)))throw Error("Bad token: "+T(a.a));c=T(a.a);f=wb[c]||null;if(!f)throw Error("No axis with name: "+c);T(a.a);W(a,"Missing node name")}else f=tb;c=S(a.a);if(/(?![0-9])[\w\*]/.test(c.charAt(0)))if("("== +S(a.a,1)){if(!db(c))throw Error("Invalid node type: "+c);c=T(a.a);if(!db(c))throw Error("Invalid type name: "+c);Eb(a,"(");W(a,"Bad nodetype");e=S(a.a).charAt(0);var g=null;if('"'==e||"'"==e)g=Gb(a);W(a,"Bad nodetype");Fb(a);c=new G(c,g)}else if(c=T(a.a),e=c.indexOf(":"),-1==e)c=new E(c);else{var g=c.substring(0,e),h;if("*"==g)h="*";else if(h=a.b(g),!h)throw Error("Namespace prefix not declared: "+g);c=c.substr(e+1);c=new E(c,h)}else throw Error("Bad token: "+T(a.a));e=new sb(Jb(a),f.a);return d|| +new U(f,c,e,"//"==b)}function Jb(a){for(var b=[];"["==S(a.a);){T(a.a);W(a,"Missing predicate expression.");var c=Cb(a);b.push(c);W(a,"Unclosed predicate expression.");Eb(a,"]")}return b}function Db(a){if("-"==S(a.a))return T(a.a),new zb(Db(a));var b=Hb(a);if("|"!=S(a.a))a=b;else{for(b=[b];"|"==T(a.a);)W(a,"Missing next union location path."),b.push(Hb(a));a.a.a--;a=new rb(b)}return a};function Kb(a){switch(a.nodeType){case 1:return ea(Lb,a);case 9:return Kb(a.documentElement);case 11:case 10:case 6:case 12:return Mb;default:return a.parentNode?Kb(a.parentNode):Mb}}function Mb(){return null}function Lb(a,b){if(a.prefix==b)return a.namespaceURI||"http://www.w3.org/1999/xhtml";var c=a.getAttributeNode("xmlns:"+b);return c&&c.specified?c.value||null:a.parentNode&&9!=a.parentNode.nodeType?Lb(a.parentNode,b):null};function Nb(a,b){if(!a.length)throw Error("Empty XPath expression.");var c=fb(a);if(ib(c))throw Error("Invalid XPath expression.");b?"function"==aa(b)||(b=da(b.lookupNamespaceURI,b)):b=function(){return null};var d=Cb(new Bb(c,b));if(!ib(c))throw Error("Bad token: "+T(c));this.evaluate=function(a,b){var c=d.a(new Q(a));return new Y(c,b)}} +function Y(a,b){if(0==b)if(a instanceof C)b=4;else if("string"==typeof a)b=2;else if("number"==typeof a)b=1;else if("boolean"==typeof a)b=3;else throw Error("Unexpected evaluation result.");if(2!=b&&1!=b&&3!=b&&!(a instanceof C))throw Error("value could not be converted to the specified type");this.resultType=b;var c;switch(b){case 2:this.stringValue=a instanceof C?Sa(a):""+a;break;case 1:this.numberValue=a instanceof C?+Sa(a):+a;break;case 3:this.booleanValue=a instanceof C?0=c.length?null:c[f++]};this.snapshotItem=function(a){if(6!=b&&7!=b)throw Error("snapshotItem called with wrong result type");return a>=c.length|| +0>a?null:c[a]}}Y.ANY_TYPE=0;Y.NUMBER_TYPE=1;Y.STRING_TYPE=2;Y.BOOLEAN_TYPE=3;Y.UNORDERED_NODE_ITERATOR_TYPE=4;Y.ORDERED_NODE_ITERATOR_TYPE=5;Y.UNORDERED_NODE_SNAPSHOT_TYPE=6;Y.ORDERED_NODE_SNAPSHOT_TYPE=7;Y.ANY_UNORDERED_NODE_TYPE=8;Y.FIRST_ORDERED_NODE_TYPE=9;function Ob(a){this.lookupNamespaceURI=Kb(a)} +function Pb(a,b){var c=a||k,d=c.Document&&c.Document.prototype||c.document;if(!d.evaluate||b)c.XPathResult=Y,d.evaluate=function(a,b,c,d){return(new Nb(a,c)).evaluate(b,d)},d.createExpression=function(a,b){return new Nb(a,b)},d.createNSResolver=function(a){return new Ob(a)}}var Qb=["wgxpath","install"],Z=k;Qb[0]in Z||!Z.execScript||Z.execScript("var "+Qb[0]);for(var Rb;Qb.length&&(Rb=Qb.shift());)Qb.length||void 0===Pb?Z[Rb]?Z=Z[Rb]:Z=Z[Rb]={}:Z[Rb]=Pb;}).call(this) diff --git a/js/mathjax/extensions/asciimath2jax.js b/js/mathjax/extensions/asciimath2jax.js new file mode 100644 index 0000000..48f797b --- /dev/null +++ b/js/mathjax/extensions/asciimath2jax.js @@ -0,0 +1,256 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/asciimath2jax.js + * + * Implements the AsciiMath to Jax preprocessor that locates AsciiMath + * code within the text of a document and replaces it with SCRIPT tags for + * processing by MathJax. + * + * Modified by David Lippman, based on tex2jax.js. + * Additional work by Davide P. Cervone. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension.asciimath2jax = { + version: "2.7.9", + config: { + delimiters: [['`','`']], // The star/stop delimiter pairs for asciimath code + + skipTags: ["script","noscript","style","textarea","pre","code","annotation","annotation-xml"], + // The names of the tags whose contents will not be + // scanned for math delimiters + + ignoreClass: "asciimath2jax_ignore", // the class name of elements whose contents should + // NOT be processed by asciimath2jax. Note that this + // is a regular expression, so be sure to quote any + // regexp special characters + + processClass: "asciimath2jax_process", // the class name of elements whose contents SHOULD + // be processed when they appear inside ones that + // are ignored. Note that this is a regular expression, + // so be sure to quote any regexp special characters + + preview: "AsciiMath" // set to "none" to not insert MathJax_Preview spans + // or set to an array specifying an HTML snippet + // to use the same preview for every equation. + + }, + + // + // Tags to ignore when searching for AsciiMath in the page + // + ignoreTags: { + br: (MathJax.Hub.Browser.isMSIE && document.documentMode < 9 ? "\n" : " "), + wbr: "", + "#comment": "" + }, + + PreProcess: function (element) { + if (!this.configured) { + this.config = MathJax.Hub.CombineConfig("asciimath2jax",this.config); + if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)} + this.configured = true; + } + if (typeof(element) === "string") {element = document.getElementById(element)} + if (!element) {element = document.body} + if (this.createPatterns()) {this.scanElement(element,element.nextSibling)} + }, + + createPatterns: function () { + var starts = [], i, m, config = this.config; this.match = {}; + if (config.delimiters.length === 0) {return false} + for (i = 0, m = config.delimiters.length; i < m; i++) { + starts.push(this.patternQuote(config.delimiters[i][0])); + this.match[config.delimiters[i][0]] = { + mode: "", + end: config.delimiters[i][1], + pattern: this.endPattern(config.delimiters[i][1]) + }; + } + this.start = new RegExp(starts.sort(this.sortLength).join("|"),"g"); + this.skipTags = new RegExp("^("+config.skipTags.join("|")+")$","i"); + var ignore = []; + if (MathJax.Hub.config.preRemoveClass) {ignore.push(MathJax.Hub.config.preRemoveClass)} + if (config.ignoreClass) {ignore.push(config.ignoreClass)} + this.ignoreClass = (ignore.length ? new RegExp("(^| )("+ignore.join("|")+")( |$)") : /^$/); + this.processClass = new RegExp("(^| )("+config.processClass+")( |$)"); + return true; + }, + + patternQuote: function (s) {return s.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,'\\$1')}, + + endPattern: function (end) { + return new RegExp(this.patternQuote(end)+"|\\\\.","g"); + }, + + sortLength: function (a,b) { + if (a.length !== b.length) {return b.length - a.length} + return (a == b ? 0 : (a < b ? -1 : 1)); + }, + + scanElement: function (element,stop,ignore) { + var cname, tname, ignoreChild, process; + while (element && element != stop) { + if (element.nodeName.toLowerCase() === '#text') { + if (!ignore) {element = this.scanText(element)} + } else { + cname = (typeof(element.className) === "undefined" ? "" : element.className); + tname = (typeof(element.tagName) === "undefined" ? "" : element.tagName); + if (typeof(cname) !== "string") {cname = String(cname)} // jsxgraph uses non-string class names! + process = this.processClass.exec(cname); + if (element.firstChild && !cname.match(/(^| )MathJax/) && + (process || !this.skipTags.exec(tname))) { + ignoreChild = (ignore || this.ignoreClass.exec(cname)) && !process; + this.scanElement(element.firstChild,stop,ignoreChild); + } + } + if (element) {element = element.nextSibling} + } + }, + + scanText: function (element) { + if (element.nodeValue.replace(/\s+/,'') == '') {return element} + var match, prev, pos = 0, rescan; + this.search = {start: true}; + this.pattern = this.start; + while (element) { + rescan = null; + this.pattern.lastIndex = pos || 0; pos = 0; + while (element && element.nodeName.toLowerCase() === '#text' && + (match = this.pattern.exec(element.nodeValue))) { + if (this.search.start) {element = this.startMatch(match,element)} + else {element = this.endMatch(match,element)} + } + if (this.search.matched) element = this.encloseMath(element); + else if (!this.search.start) rescan = this.search; + if (element) { + do {prev = element; element = element.nextSibling} + while (element && this.ignoreTags[element.nodeName.toLowerCase()] != null); + if (!element || element.nodeName !== '#text') { + if (!rescan) return prev; + element = rescan.open; + pos = rescan.opos + rescan.olen; + this.search = {start: true}; + this.pattern = this.start; + } + } + } + return element; + }, + + startMatch: function (match,element) { + var delim = this.match[match[0]]; + if (delim != null) { + this.search = { + end: delim.end, mode: delim.mode, + open: element, olen: match[0].length, + opos: this.pattern.lastIndex - match[0].length + }; + this.switchPattern(delim.pattern); + } + return element; + }, + + endMatch: function (match,element) { + if (match[0] == this.search.end) { + this.search.close = element; + this.search.cpos = this.pattern.lastIndex; + this.search.clen = (this.search.isBeginEnd ? 0 : match[0].length); + this.search.matched = true; + element = this.encloseMath(element); + this.switchPattern(this.start); + } + return element; + }, + + switchPattern: function (pattern) { + pattern.lastIndex = this.pattern.lastIndex; + this.pattern = pattern; + this.search.start = (pattern === this.start); + }, + + encloseMath: function (element) { + var search = this.search, close = search.close, CLOSE, math, next; + if (search.cpos === close.length) {close = close.nextSibling} + else {close = close.splitText(search.cpos)} + if (!close) {CLOSE = close = MathJax.HTML.addText(search.close.parentNode,"")} + search.close = close; + math = (search.opos ? search.open.splitText(search.opos) : search.open); + while ((next = math.nextSibling) && next !== close) { + if (next.nodeValue !== null) { + if (next.nodeName === "#comment") { + math.nodeValue += next.nodeValue.replace(/^\[CDATA\[((.|\n|\r)*)\]\]$/,"$1"); + } else { + math.nodeValue += math.nextSibling.nodeValue; + } + } else { + var ignore = this.ignoreTags[next.nodeName.toLowerCase()]; + math.nodeValue += (ignore == null ? " " : ignore); + } + math.parentNode.removeChild(next); + } + var AM = math.nodeValue.substr(search.olen,math.nodeValue.length-search.olen-search.clen); + math.parentNode.removeChild(math); + if (this.config.preview !== "none") {this.createPreview(search.mode,AM)} + math = this.createMathTag(search.mode,AM); + this.search = {}; this.pattern.lastIndex = 0; + if (CLOSE) {CLOSE.parentNode.removeChild(CLOSE)} + return math; + }, + + insertNode: function (node) { + var search = this.search; + search.close.parentNode.insertBefore(node,search.close); + }, + + createPreview: function (mode,asciimath) { + var previewClass = MathJax.Hub.config.preRemoveClass; + var preview = this.config.preview; + if (preview === "none") return; + if ((this.search.close.previousSibling||{}).className === previewClass) return; + if (preview === "AsciiMath") {preview = [this.filterPreview(asciimath)]} + if (preview) { + preview = MathJax.HTML.Element("span",{className:previewClass},preview); + this.insertNode(preview); + } + }, + + createMathTag: function (mode,asciimath) { + var script = document.createElement("script"); + script.type = "math/asciimath" + mode; + MathJax.HTML.setScript(script,asciimath); + this.insertNode(script); + return script; + }, + + filterPreview: function (asciimath) {return asciimath} + +}; + +// We register the preprocessors with the following priorities: +// - mml2jax.js: 5 +// - jsMath2jax.js: 8 +// - asciimath2jax.js, tex2jax.js: 10 (default) +// See issues 18 and 484 and the other *2jax.js files. +MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.asciimath2jax]); +MathJax.Ajax.loadComplete("[MathJax]/extensions/asciimath2jax.js"); +// @license-end diff --git a/js/mathjax/extensions/fast-preview.js b/js/mathjax/extensions/fast-preview.js new file mode 100644 index 0000000..34da2c3 --- /dev/null +++ b/js/mathjax/extensions/fast-preview.js @@ -0,0 +1,157 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/fast-preview.js + * + * Implements a fast preview using the PreviewHTML output jax + * and then a slower update to the more accurate HTML-CSS output + * (or whatever the user has selected). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2014-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (HUB,HTML,BROWSER) { + + var SETTINGS = HUB.config.menuSettings; + var JAX = MathJax.OutputJax; + var msieColorBug = BROWSER.isMSIE && (document.documentMode||0) < 8; + + var FastPreview = MathJax.Extension["fast-preview"] = { + version: "2.7.9", + enabled: true, + + // + // Configuration for the chunking of the main output + // after the previews have been created, and other configuration. + // + config: HUB.CombineConfig("fast-preview",{ + Chunks: {EqnChunk: 10000, EqnChunkFactor: 1, EqnChunkDelay: 0}, + color: "inherit!important", + updateTime: 30, updateDelay: 6, + messageStyle: "none", + disabled: BROWSER.isMSIE && !BROWSER.versionAtLeast("8.0") + }), + + // + // Ajust the chunking of the output jax + // + Config: function () { + if (HUB.config["CHTML-preview"]) + MathJax.Hub.Config({"fast-preview": HUB.config["CHTML-preview"]}); + var update, delay, style, done, saved; + var config = this.config; + + if (!config.disabled && SETTINGS.FastPreview == null) + HUB.Config({menuSettings:{FastPreview:true}}); + if (SETTINGS.FastPreview) { + MathJax.Ajax.Styles({".MathJax_Preview .MJXf-math":{color:config.color}}); + HUB.Config({"HTML-CSS": config.Chunks, CommonHTML: config.Chunks, SVG: config.Chunks}); + } + HUB.Register.MessageHook("Begin Math Output",function () { + if (!done && FastPreview.Active()) { + update = HUB.processUpdateTime; delay = HUB.processUpdateDelay; + style = HUB.config.messageStyle; + HUB.processUpdateTime = config.updateTime; + HUB.processUpdateDelay = config.updateDelay; + HUB.Config({messageStyle: config.messageStyle}); + MathJax.Message.Clear(0,0); + saved = true; + } + }); + HUB.Register.MessageHook("End Math Output",function () { + if (!done && saved) { + HUB.processUpdateTime = update; + HUB.processUpdateDelay = delay; + HUB.Config({messageStyle: style}); + done = true; + } + }); + }, + + // + // Allow page to override user settings (for things like editor previews) + // + Disable: function () {this.enabled = false}, + Enable: function () {this.enabled = true}, + + Active: function () { + return SETTINGS.FastPreview && this.enabled && + !(JAX[SETTINGS.renderer]||{}).noFastPreview; + }, + + // + // Insert a preview span, if there isn't one already, + // and call the PreviewHTML output jax to create the preview + // + Preview: function (data) { + if (!this.Active() || !data.script.parentNode) return; + var preview = data.script.MathJax.preview || data.script.previousSibling; + if (!preview || preview.className !== MathJax.Hub.config.preRemoveClass) { + preview = HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass}); + data.script.parentNode.insertBefore(preview,data.script); + data.script.MathJax.preview = preview; + } + preview.innerHTML = ""; + preview.style.color = (msieColorBug ? "black" : "inherit"); + return this.postFilter(preview,data); + }, + postFilter: function (preview,data) { + // + // Load the PreviewHTML jax if it is not already loaded + // + if (!data.math.root.toPreviewHTML) { + var queue = MathJax.Callback.Queue(); + queue.Push( + ["Require",MathJax.Ajax,"[MathJax]/jax/output/PreviewHTML/config.js"], + ["Require",MathJax.Ajax,"[MathJax]/jax/output/PreviewHTML/jax.js"] + ); + HUB.RestartAfter(queue.Push({})); + } + data.math.root.toPreviewHTML(preview); + }, + + // + // Hook into the input jax postFilter to create the previews as + // the input jax are processed. + // + Register: function (name) { + HUB.Register.StartupHook(name+" Jax Require",function () { + var jax = MathJax.InputJax[name]; + jax.postfilterHooks.Add(["Preview",MathJax.Extension["fast-preview"]],50); + }); + } + } + + // + // Hook into each input jax + // + FastPreview.Register("TeX"); + FastPreview.Register("MathML"); + FastPreview.Register("AsciiMath"); + + HUB.Register.StartupHook("End Config",["Config",FastPreview]); + + HUB.Startup.signal.Post("fast-preview Ready"); + +})(MathJax.Hub,MathJax.HTML,MathJax.Hub.Browser); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/fast-preview.js"); + +// @license-end diff --git a/js/mathjax/extensions/jsMath2jax.js b/js/mathjax/extensions/jsMath2jax.js new file mode 100644 index 0000000..2c75d4f --- /dev/null +++ b/js/mathjax/extensions/jsMath2jax.js @@ -0,0 +1,107 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/jsMath2jax.js + * + * Implements a jsMath to Jax preprocessor that locates jsMath-style + * ... and
...
tags + * and replaces them with SCRIPT tags for processing by MathJax. + * (Note: use the tex2jax preprocessor to convert TeX delimiters or + * custom delimiters to MathJax SCRIPT tags. This preprocessor is + * only for the SPAN and DIV form of jsMath delimiters). + * + * To use this preprocessor, include "jsMath2jax.js" in the extensions + * array in your config/MathJax.js file, or the MathJax.Hub.Config() call + * in your HTML document. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension.jsMath2jax = { + version: "2.7.9", + + config: { + preview: "TeX" // Set to "none" to prevent preview strings from being inserted + // or to an array that specifies an HTML snippet to use for + // the preview. + }, + + PreProcess: function (element) { + if (!this.configured) { + this.config = MathJax.Hub.CombineConfig("jsMath2jax",this.config); + if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)} + if (typeof(this.config.previewTeX) !== "undefined" && !this.config.previewTeX) + {this.config.preview = "none"} // backward compatibility for previewTeX parameter + this.previewClass = MathJax.Hub.config.preRemoveClass; + this.configured = true; + } + if (typeof(element) === "string") {element = document.getElementById(element)} + if (!element) {element = document.body} + var span = element.getElementsByTagName("span"), i; + for (i = span.length-1; i >= 0; i--) + {if (String(span[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(span[i],"")}} + var div = element.getElementsByTagName("div"); + for (i = div.length-1; i >= 0; i--) + {if (String(div[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(div[i],"; mode=display")}} + }, + + ConvertMath: function (node,mode) { + if (node.getElementsByTagName("script").length === 0) { + var parent = node.parentNode, + script = this.createMathTag(mode,node.innerHTML); + if (node.nextSibling) {parent.insertBefore(script,node.nextSibling)} + else {parent.appendChild(script)} + if (this.config.preview !== "none") {this.createPreview(node)} + parent.removeChild(node); + } + }, + + createPreview: function (node) { + var previewClass = MathJax.Hub.config.preRemoveClass; + var preview = this.config.preview; + if (preview === "none") return; + if ((node.previousSibling||{}).className === previewClass) return; + if (preview === "TeX") {preview = [this.filterPreview(node.innerHTML)]} + if (preview) { + preview = MathJax.HTML.Element("span",{className:previewClass},preview); + node.parentNode.insertBefore(preview,node); + } + }, + + createMathTag: function (mode,tex) { + tex = tex.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"); + var script = document.createElement("script"); + script.type = "math/tex" + mode; + MathJax.HTML.setScript(script,tex); + return script; + }, + + filterPreview: function (tex) {return tex} + +}; + +// We register the preprocessors with the following priorities: +// - mml2jax.js: 5 +// - jsMath2jax.js: 8 +// - asciimath2jax.js, tex2jax.js: 10 (default) +// See issues 18 and 484 and the other *2jax.js files. +MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax],8); +MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js"); +// @license-end diff --git a/js/mathjax/extensions/mml2jax.js b/js/mathjax/extensions/mml2jax.js new file mode 100644 index 0000000..cb23f0d --- /dev/null +++ b/js/mathjax/extensions/mml2jax.js @@ -0,0 +1,265 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/mml2jax.js + * + * Implements the MathML to Jax preprocessor that locates nodes + * within the text of a document and replaces them with SCRIPT tags + * for processing by MathJax. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension.mml2jax = { + version: "2.7.9", + config: { + preview: "mathml" // Use the element as the + // preview. Set to "none" for no preview, + // set to "alttext" to use the alttext attribute + // of the element, set to "altimg" to use + // an image described by the altimg* attributes + // or set to an array specifying an HTML snippet + // to use a fixed preview for all math + + }, + MMLnamespace: "http://www.w3.org/1998/Math/MathML", + + PreProcess: function (element) { + if (!this.configured) { + this.config = MathJax.Hub.CombineConfig("mml2jax",this.config); + if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)} + this.InitBrowser(); + this.configured = true; + } + if (typeof(element) === "string") {element = document.getElementById(element)} + if (!element) {element = document.body} + var mathArray = []; + // + // Handle all math tags with no namespaces + // + this.PushMathElements(mathArray,element,"math"); + // + // Handle math with namespaces in XHTML + // + this.PushMathElements(mathArray,element,"math",this.MMLnamespace); + // + // Handle math with namespaces in HTML + // + var i, m; + if (typeof(document.namespaces) !== "undefined") { + // + // IE namespaces are listed in document.namespaces + // + try { + for (i = 0, m = document.namespaces.length; i < m; i++) { + var ns = document.namespaces[i]; + if (ns.urn === this.MMLnamespace) + {this.PushMathElements(mathArray,element,ns.name+":math")} + } + } catch (err) {} + } else { + // + // Everybody else + // + var html = document.getElementsByTagName("html")[0]; + if (html) { + for (i = 0, m = html.attributes.length; i < m; i++) { + var attr = html.attributes[i]; + if (attr.nodeName.substr(0,6) === "xmlns:" && attr.nodeValue === this.MMLnamespace) + {this.PushMathElements(mathArray,element,attr.nodeName.substr(6)+":math")} + } + } + } + this.ProcessMathArray(mathArray); + }, + + PushMathElements: function (array,element,name,namespace) { + var math, preview = MathJax.Hub.config.preRemoveClass; + if (namespace) { + if (!element.getElementsByTagNameNS) return; + math = element.getElementsByTagNameNS(namespace,name); + } else { + math = element.getElementsByTagName(name); + } + for (var i = 0, m = math.length; i < m; i++) { + var parent = math[i].parentNode; + if (parent && parent.className !== preview && + !parent.isMathJax && !math[i].prefix === !namespace) array.push(math[i]); + } + }, + + ProcessMathArray: function (math) { + var i, m = math.length; + if (m) { + if (this.MathTagBug) { + for (i = 0; i < m; i++) { + if (math[i].nodeName === "MATH") {this.ProcessMathFlattened(math[i])} + else {this.ProcessMath(math[i])} + } + } else { + for (i = 0; i < m; i++) {this.ProcessMath(math[i])} + } + } + }, + + ProcessMath: function (math) { + var parent = math.parentNode; + if (!parent || parent.className === MathJax.Hub.config.preRemoveClass) return; + var script = document.createElement("script"); + script.type = "math/mml"; + parent.insertBefore(script,math); + if (this.AttributeBug) { + var html = this.OuterHTML(math); + if (this.CleanupHTML) { + html = html.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,""); + html = html.replace(/ /g," "); + } + MathJax.HTML.setScript(script,html); parent.removeChild(math); + } else { + var span = MathJax.HTML.Element("span"); span.appendChild(math); + MathJax.HTML.setScript(script,span.innerHTML); + } + if (this.config.preview !== "none") {this.createPreview(math,script)} + }, + + ProcessMathFlattened: function (math) { + var parent = math.parentNode; + if (!parent || parent.className === MathJax.Hub.config.preRemoveClass) return; + var script = document.createElement("script"); + script.type = "math/mml"; + parent.insertBefore(script,math); + var mml = "", node, MATH = math; + while (math && math.nodeName !== "/MATH") { + node = math; math = math.nextSibling; + mml += this.NodeHTML(node); + node.parentNode.removeChild(node); + } + if (math && math.nodeName === "/MATH") {math.parentNode.removeChild(math)} + script.text = mml + ""; + if (this.config.preview !== "none") {this.createPreview(MATH,script)} + }, + + NodeHTML: function (node) { + var html, i, m; + if (node.nodeName === "#text") { + html = this.quoteHTML(node.nodeValue); + } else if (node.nodeName === "#comment") { + html = "" + } else { + // In IE, outerHTML doesn't properly quote attributes, so quote them by hand + // In Opera, HTML special characters aren't quoted in attributes, so quote them + html = "<"+node.nodeName.toLowerCase(); + for (i = 0, m = node.attributes.length; i < m; i++) { + var attribute = node.attributes[i]; + if (attribute.specified && attribute.nodeName.substr(0,10) !== "_moz-math-") { + // Opera 11.5 beta turns xmlns into xmlns:xmlns, so put it back (*** check after 11.5 is out ***) + html += " "+attribute.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"="; + var value = attribute.nodeValue; // IE < 8 doesn't properly set style by setAttributes + if (value == null && attribute.nodeName === "style" && node.style) {value = node.style.cssText} + html += '"'+this.quoteHTML(value)+'"'; + } + } + html += ">"; + // Handle internal HTML (possibly due to annotation or missing ) + if (node.outerHTML != null && node.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)) { + for (i = 0, m = node.childNodes.length; i < m; i++) + {html += this.OuterHTML(node.childNodes[i])} + html += ""; + } + } + return html; + }, + OuterHTML: function (node) { + if (node.nodeName.charAt(0) === "#") {return this.NodeHTML(node)} + if (!this.AttributeBug) {return node.outerHTML} + var html = this.NodeHTML(node); + for (var i = 0, m = node.childNodes.length; i < m; i++) + {html += this.OuterHTML(node.childNodes[i]);} + html += ""; + return html; + }, + quoteHTML: function (string) { + if (string == null) {string = ""} + return string.replace(/&/g,"&").replace(//g,">").replace(/\"/g,"""); + }, + + createPreview: function (math,script) { + var preview = this.config.preview; + if (preview === "none") return; + var isNodePreview = false; + var previewClass = MathJax.Hub.config.preRemoveClass; + if ((script.previousSibling||{}).className === previewClass) return; + if (preview === "mathml") { + isNodePreview = true; + // mathml preview does not work with IE < 9, so fallback to alttext. + if (this.MathTagBug) {preview = "alttext"} else {preview = math.cloneNode(true)} + } + if (preview === "alttext" || preview === "altimg") { + isNodePreview = true; + var alttext = this.filterPreview(math.getAttribute("alttext")); + if (preview === "alttext") { + if (alttext != null) {preview = MathJax.HTML.TextNode(alttext)} else {preview = null} + } else { + var src = math.getAttribute("altimg"); + if (src != null) { + // FIXME: use altimg-valign when display="inline"? + var style = {width: math.getAttribute("altimg-width"), height: math.getAttribute("altimg-height")}; + preview = MathJax.HTML.Element("img",{src:src,alt:alttext,style:style}); + } else {preview = null} + } + } + if (preview) { + var span; + if (isNodePreview) { + span = MathJax.HTML.Element("span",{className:previewClass}); + span.appendChild(preview); + } else { + span = MathJax.HTML.Element("span",{className:previewClass},preview); + } + script.parentNode.insertBefore(span,script); + } + }, + + filterPreview: function (text) {return text}, + + InitBrowser: function () { + var test = MathJax.HTML.Element("span",{id:"<", className: "mathjax", innerHTML: "x"}); + var html = test.outerHTML || ""; + this.AttributeBug = html !== "" && !( + html.match(/id="<"/) && // "<" should convert to "<" + html.match(/class="mathjax"/) && // IE leaves out quotes + html.match(/<\/math>/) // Opera 9 drops tags after self-closing tags + ); + this.MathTagBug = test.childNodes.length > 1; // IE < 9 flattens unknown tags + this.CleanupHTML = MathJax.Hub.Browser.isMSIE; // remove namespace and other added tags + } + +}; + +// +// We register the preprocessors with the following priorities: +// - mml2jax.js: 5 +// - jsMath2jax.js: 8 +// - asciimath2jax.js, tex2jax.js: 10 (default) +// See issues 18 and 484 and the other *2jax.js files. +// +MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax],5); +MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js"); +// @license-end diff --git a/js/mathjax/extensions/tex2jax.js b/js/mathjax/extensions/tex2jax.js new file mode 100644 index 0000000..cfc3c0b --- /dev/null +++ b/js/mathjax/extensions/tex2jax.js @@ -0,0 +1,321 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/tex2jax.js + * + * Implements the TeX to Jax preprocessor that locates TeX code + * within the text of a document and replaces it with SCRIPT tags + * for processing by MathJax. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Extension.tex2jax = { + version: "2.7.9", + config: { + inlineMath: [ // The start/stop pairs for in-line math +// ['$','$'], // (comment out any you don't want, or add your own, but + ['\\(','\\)'] // be sure that you don't have an extra comma at the end) + ], + + displayMath: [ // The start/stop pairs for display math + ['$$','$$'], // (comment out any you don't want, or add your own, but + ['\\[','\\]'] // be sure that you don't have an extra comma at the end) + ], + + skipTags: ["script","noscript","style","textarea","pre","code","annotation","annotation-xml"], + // The names of the tags whose contents will not be + // scanned for math delimiters + + ignoreClass: "tex2jax_ignore", // the class name of elements whose contents should + // NOT be processed by tex2jax. Note that this + // is a regular expression, so be sure to quote any + // regexp special characters + + processClass: "tex2jax_process", // the class name of elements whose contents SHOULD + // be processed when they appear inside ones that + // are ignored. Note that this is a regular expression, + // so be sure to quote any regexp special characters + + processEscapes: false, // set to true to allow \$ to produce a dollar without + // starting in-line math mode + + processEnvironments: true, // set to true to process \begin{xxx}...\end{xxx} outside + // of math mode, false to prevent that + + processRefs: true, // set to true to process \ref{...} outside of math mode + + + preview: "TeX" // set to "none" to not insert MathJax_Preview spans + // or set to an array specifying an HTML snippet + // to use the same preview for every equation. + + }, + + // + // Tags to ignore when searching for TeX in the page + // + ignoreTags: { + br: (MathJax.Hub.Browser.isMSIE && document.documentMode < 9 ? "\n" : " "), + wbr: "", + "#comment": "" + }, + + PreProcess: function (element) { + if (!this.configured) { + this.config = MathJax.Hub.CombineConfig("tex2jax",this.config); + if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)} + if (typeof(this.config.previewTeX) !== "undefined" && !this.config.previewTeX) + {this.config.preview = "none"} // backward compatibility for previewTeX parameter + this.configured = true; + } + if (typeof(element) === "string") {element = document.getElementById(element)} + if (!element) {element = document.body} + if (this.createPatterns()) {this.scanElement(element,element.nextSibling)} + }, + + createPatterns: function () { + var starts = [], parts = [], i, m, config = this.config; + this.match = {}; + for (i = 0, m = config.inlineMath.length; i < m; i++) { + starts.push(this.patternQuote(config.inlineMath[i][0])); + this.match[config.inlineMath[i][0]] = { + mode: "", + end: config.inlineMath[i][1], + pattern: this.endPattern(config.inlineMath[i][1]) + }; + } + for (i = 0, m = config.displayMath.length; i < m; i++) { + starts.push(this.patternQuote(config.displayMath[i][0])); + this.match[config.displayMath[i][0]] = { + mode: "; mode=display", + end: config.displayMath[i][1], + pattern: this.endPattern(config.displayMath[i][1]) + }; + } + if (starts.length) {parts.push(starts.sort(this.sortLength).join("|"))} + if (config.processEnvironments) {parts.push("\\\\begin\\{([^}]*)\\}")} + if (config.processEscapes) {parts.push("\\\\*\\\\\\\$")} + if (config.processRefs) {parts.push("\\\\(eq)?ref\\{[^}]*\\}")} + this.start = new RegExp(parts.join("|"),"g"); + this.skipTags = new RegExp("^("+config.skipTags.join("|")+")$","i"); + var ignore = []; + if (MathJax.Hub.config.preRemoveClass) {ignore.push(MathJax.Hub.config.preRemoveClass)}; + if (config.ignoreClass) {ignore.push(config.ignoreClass)} + this.ignoreClass = (ignore.length ? new RegExp("(^| )("+ignore.join("|")+")( |$)") : /^$/); + this.processClass = new RegExp("(^| )("+config.processClass+")( |$)"); + return (parts.length > 0); + }, + + patternQuote: function (s) {return s.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,'\\$1')}, + + endPattern: function (end) { + return new RegExp(this.patternQuote(end)+"|\\\\.|[{}]","g"); + }, + + sortLength: function (a,b) { + if (a.length !== b.length) {return b.length - a.length} + return (a == b ? 0 : (a < b ? -1 : 1)); + }, + + scanElement: function (element,stop,ignore) { + var cname, tname, ignoreChild, process; + while (element && element != stop) { + if (element.nodeName.toLowerCase() === '#text') { + if (!ignore) {element = this.scanText(element)} + } else { + cname = (typeof(element.className) === "undefined" ? "" : element.className); + tname = (typeof(element.tagName) === "undefined" ? "" : element.tagName); + if (typeof(cname) !== "string") {cname = String(cname)} // jsxgraph uses non-string class names! + process = this.processClass.exec(cname); + if (element.firstChild && !cname.match(/(^| )MathJax/) && + (process || !this.skipTags.exec(tname))) { + ignoreChild = (ignore || this.ignoreClass.exec(cname)) && !process; + this.scanElement(element.firstChild,stop,ignoreChild); + } + } + if (element) {element = element.nextSibling} + } + }, + + scanText: function (element) { + if (element.nodeValue.replace(/\s+/,'') == '') {return element} + var match, prev, pos = 0, rescan; + this.search = {start: true}; + this.pattern = this.start; + while (element) { + rescan = null; + this.pattern.lastIndex = pos; pos = 0; + while (element && element.nodeName.toLowerCase() === '#text' && + (match = this.pattern.exec(element.nodeValue))) { + if (this.search.start) {element = this.startMatch(match,element)} + else {element = this.endMatch(match,element)} + } + if (this.search.matched) element = this.encloseMath(element); + else if (!this.search.start && !this.search.close) rescan = this.search; + if (element) { + do {prev = element; element = element.nextSibling} + while (element && this.ignoreTags[element.nodeName.toLowerCase()] != null); + if (!element || element.nodeName !== '#text') { + if (!rescan) return (this.search.close ? this.prevEndMatch() : prev); + element = rescan.open; + pos = rescan.opos + rescan.olen + (rescan.blen || 0); + this.search = {start: true}; + this.pattern = this.start; + } + } + } + return element; + }, + + startMatch: function (match,element) { + var delim = this.match[match[0]]; + if (delim != null) { // a start delimiter + this.search = { + end: delim.end, mode: delim.mode, pcount: 0, + open: element, olen: match[0].length, opos: this.pattern.lastIndex - match[0].length + }; + this.switchPattern(delim.pattern); + } else if (match[0].substr(0,6) === "\\begin") { // \begin{...} + this.search = { + end: "\\end{"+match[1]+"}", mode: "; mode=display", pcount: 0, + open: element, olen: 0, opos: this.pattern.lastIndex - match[0].length, + blen: match[1].length + 3, isBeginEnd: true + }; + this.switchPattern(this.endPattern(this.search.end)); + } else if (match[0].substr(0,4) === "\\ref" || match[0].substr(0,6) === "\\eqref") { + this.search = { + mode: "", end: "", open: element, pcount: 0, + olen: 0, opos: this.pattern.lastIndex - match[0].length + } + return this.endMatch([""],element); + } else { // escaped dollar signs + // put $ in a span so it doesn't get processed again + // split off backslashes so they don't get removed later + var slashes = match[0].substr(0,match[0].length-1), n, span; + if (slashes.length % 2 === 0) {span = [slashes.replace(/\\\\/g,"\\")]; n = 1} + else {span = [slashes.substr(1).replace(/\\\\/g,"\\"),"$"]; n = 0} + span = MathJax.HTML.Element("span",null,span); + var text = MathJax.HTML.TextNode(element.nodeValue.substr(0,match.index)); + element.nodeValue = element.nodeValue.substr(match.index + match[0].length - n); + element.parentNode.insertBefore(span,element); + element.parentNode.insertBefore(text,span); + this.pattern.lastIndex = n; + } + return element; + }, + + endMatch: function (match,element) { + var search = this.search; + if (match[0] == search.end) { + if (!search.close || search.pcount === 0) { + search.close = element; + search.cpos = this.pattern.lastIndex; + search.clen = (search.isBeginEnd ? 0 : match[0].length); + } + if (search.pcount === 0) { + search.matched = true; + element = this.encloseMath(element); + this.switchPattern(this.start); + } + } + if (match[0] === "{") {search.pcount++} + else if (match[0] === "}" && search.pcount) {search.pcount--} + return element; + }, + prevEndMatch: function () { + this.search.matched = true; + var element = this.encloseMath(this.search.close); + this.switchPattern(this.start); + return element; + }, + + switchPattern: function (pattern) { + pattern.lastIndex = this.pattern.lastIndex; + this.pattern = pattern; + this.search.start = (pattern === this.start); + }, + + encloseMath: function (element) { + var search = this.search, close = search.close, CLOSE, math, next; + if (search.cpos === close.length) {close = close.nextSibling} + else {close = close.splitText(search.cpos)} + if (!close) {CLOSE = close = MathJax.HTML.addText(search.close.parentNode,"")} + search.close = close; + math = (search.opos ? search.open.splitText(search.opos) : search.open); + while ((next = math.nextSibling) && next !== close) { + if (next.nodeValue !== null) { + if (next.nodeName === "#comment") { + math.nodeValue += next.nodeValue.replace(/^\[CDATA\[((.|\n|\r)*)\]\]$/,"$1"); + } else { + math.nodeValue += next.nodeValue; + } + } else { + var ignore = this.ignoreTags[next.nodeName.toLowerCase()]; + math.nodeValue += (ignore == null ? " " : ignore); + } + math.parentNode.removeChild(next); + } + var TeX = math.nodeValue.substr(search.olen,math.nodeValue.length-search.olen-search.clen); + math.parentNode.removeChild(math); + if (this.config.preview !== "none") {this.createPreview(search.mode,TeX)} + math = this.createMathTag(search.mode,TeX); + this.search = {}; this.pattern.lastIndex = 0; + if (CLOSE) {CLOSE.parentNode.removeChild(CLOSE)} + return math; + }, + + insertNode: function (node) { + var search = this.search; + search.close.parentNode.insertBefore(node,search.close); + }, + + createPreview: function (mode,tex) { + var previewClass = MathJax.Hub.config.preRemoveClass; + var preview = this.config.preview; + if (preview === "none") return; + if ((this.search.close.previousSibling||{}).className === previewClass) return; + if (preview === "TeX") {preview = [this.filterPreview(tex)]} + if (preview) { + preview = MathJax.HTML.Element("span",{className:previewClass},preview); + this.insertNode(preview); + } + }, + + createMathTag: function (mode,tex) { + var script = document.createElement("script"); + script.type = "math/tex" + mode; + MathJax.HTML.setScript(script,tex); + this.insertNode(script); + return script; + }, + + filterPreview: function (tex) {return tex} + +}; + +// We register the preprocessors with the following priorities: +// - mml2jax.js: 5 +// - jsMath2jax.js: 8 +// - asciimath2jax.js, tex2jax.js: 10 (default) +// See issues 18 and 484 and the other *2jax.js files. +MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.tex2jax]); +MathJax.Ajax.loadComplete("[MathJax]/extensions/tex2jax.js"); +// @license-end diff --git a/js/mathjax/extensions/toMathML.js b/js/mathjax/extensions/toMathML.js new file mode 100644 index 0000000..cb95c08 --- /dev/null +++ b/js/mathjax/extensions/toMathML.js @@ -0,0 +1,243 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/extensions/toMathML.js + * + * Implements a toMathML() method for the mml Element Jax that returns + * a MathML string from a given math expression. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () { + var VERSION = "2.7.9"; + + var MML = MathJax.ElementJax.mml, + SETTINGS = MathJax.Hub.config.menuSettings; + + MML.mbase.Augment({ + + toMathML: function (space) { + var inferred = (this.inferred && this.parent.inferRow); + if (space == null) {space = ""} + var tag = this.type, attr = this.toMathMLattributes(); + if (tag === "mspace") {return space + "<"+tag+attr+" />"} + var data = [], SPACE = (this.isToken ? "" : space+(inferred ? "" : " ")); + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {data.push(this.data[i].toMathML(SPACE))} + else if (!this.isToken && !this.isChars) {data.push(SPACE+"")} + } + if (this.isToken || this.isChars) {return space + "<"+tag+attr+">"+data.join("")+""} + if (inferred) {return data.join("\n")} + if (data.length === 0 || (data.length === 1 && data[0] === "")) + {return space + "<"+tag+attr+" />"} + return space + "<"+tag+attr+">\n"+data.join("\n")+"\n"+ space +""; + }, + + toMathMLattributes: function () { + var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults); + var names = (this.attrNames||MML.copyAttributeNames), + skip = MML.skipAttributes, copy = MML.copyAttributes; + var attr = []; + + if (this.type === "math" && (!this.attr || !('xmlns' in this.attr))) + {attr.push('xmlns="http://www.w3.org/1998/Math/MathML"')} + if (!this.attrNames) { + for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) { + if (this[id] != null && this[id] !== defaults[id]) { + if (this.Get(id,null,1) !== this[id]) + attr.push(id+'="'+this.toMathMLattribute(this[id])+'"'); + } + }} + } + for (var i = 0, m = names.length; i < m; i++) { + if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue; + value = (this.attr||{})[names[i]]; if (value == null) {value = this[names[i]]} + if (value != null) {attr.push(names[i]+'="'+this.toMathMLquote(value)+'"')} + } + this.toMathMLclass(attr); + if (attr.length) {return " "+attr.join(" ")} else {return ""} + }, + toMathMLclass: function (attr) { + var CLASS = []; if (this["class"]) {CLASS.push(this["class"])} + if (this.isa(MML.TeXAtom) && SETTINGS.texHints) { + var TEXCLASS = ["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"][this.texClass]; + if (TEXCLASS) { + CLASS.push("MJX-TeXAtom-"+TEXCLASS) + if (TEXCLASS === "OP" && !this.movablelimits) CLASS.push("MJX-fixedlimits"); + } + } + if (this.mathvariant && this.toMathMLvariants[this.mathvariant]) + {CLASS.push("MJX"+this.mathvariant)} + if (this.variantForm) {CLASS.push("MJX-variant")} + if (CLASS.length) {attr.unshift('class="'+this.toMathMLquote(CLASS.join(" "))+'"')} + }, + toMathMLattribute: function (value) { + if (typeof(value) === "string" && + value.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)) { + // FIXME: should take scriptlevel into account + return (RegExp.$2||"")+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"; + } + else if (this.toMathMLvariants[value]) {return this.toMathMLvariants[value]} + return this.toMathMLquote(value); + }, + toMathMLvariants: { + "-tex-caligraphic": MML.VARIANT.SCRIPT, + "-tex-caligraphic-bold": MML.VARIANT.BOLDSCRIPT, + "-tex-oldstyle": MML.VARIANT.NORMAL, + "-tex-oldstyle-bold": MML.VARIANT.BOLD, + "-tex-mathit": MML.VARIANT.ITALIC + }, + + toMathMLquote: function (string) { + string = String(string).split(""); + for (var i = 0, m = string.length; i < m; i++) { + var n = string[i].charCodeAt(0); + if (n <= 0xD7FF || 0xE000 <= n) { + // Code points U+0000 to U+D7FF and U+E000 to U+FFFF. + // They are directly represented by n. + if (n > 0x7E || (n < 0x20 && n !== 0x0A && n !== 0x0D && n !== 0x09)) { + string[i] = "&#x"+n.toString(16).toUpperCase()+";"; + } else { + var c = + {'&':'&', '<':'<', '>':'>', '"':'"'}[string[i]]; + if (c) {string[i] = c} + } + } else if (i+1 < m) { + // Code points U+10000 to U+10FFFF. + // n is the lead surrogate, let's read the trail surrogate. + var trailSurrogate = string[i+1].charCodeAt(0); + var codePoint = (((n-0xD800)<<10)+(trailSurrogate-0xDC00)+0x10000); + string[i] = "&#x"+codePoint.toString(16).toUpperCase()+";"; + string[i+1] = ""; + i++; + } else { + // n is a lead surrogate without corresponding trail surrogate: + // remove that character. + string[i] = ""; + } + } + return string.join(""); + } + }); + + // + // Override math.toMathML in order to add semantics tag + // for the input format, if the user requests that in the + // Show As menu. + // + MML.math.Augment({ + toMathML: function (space,jax) { + var annotation; + if (space == null) {space = ""} + if (jax && jax.originalText && SETTINGS.semantics) + {annotation = MathJax.InputJax[jax.inputJax].annotationEncoding} + var nested = (this.data[0] && this.data[0].data.length > 1); + var tag = this.type, attr = this.toMathMLattributes(); + var data = [], SPACE = space + (annotation ? " " + (nested ? " " : "") : "") + " "; + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {data.push(this.data[i].toMathML(SPACE))} + else {data.push(SPACE+"")} + } + if (data.length === 0 || (data.length === 1 && data[0] === "")) { + if (!annotation) {return "<"+tag+attr+" />"} + data.push(SPACE+""); + } + if (annotation) { + if (nested) {data.unshift(space+" "); data.push(space+" ")} + data.unshift(space+" "); + var xmlEscapedTex = jax.originalText.replace(/[&<>]/g, function(item) { + return { '>': '>', '<': '<','&': '&' }[item] + }); + data.push(space+' '+xmlEscapedTex+""); + data.push(space+" "); + } + return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+""; + } + }); + + MML.msubsup.Augment({ + toMathML: function (space) { + var tag = this.type; + if (this.data[this.sup] == null) {tag = "msub"} + if (this.data[this.sub] == null) {tag = "msup"} + var attr = this.toMathMLattributes(); + delete this.data[0].inferred; + var data = []; + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i]) {data.push(this.data[i].toMathML(space+" "))}} + return space + "<"+tag+attr+">\n" + data.join("\n") + "\n" + space + ""; + } + }); + + MML.munderover.Augment({ + toMathML: function (space) { + var tag = this.type; + var base = this.data[this.base]; + if (base && base.isa(MML.TeXAtom) && base.movablelimits && !base.Get("displaystyle")) { + type = "msubsup"; + if (this.data[this.under] == null) {tag = "msup"} + if (this.data[this.over] == null) {tag = "msub"} + } else { + if (this.data[this.under] == null) {tag = "mover"} + if (this.data[this.over] == null) {tag = "munder"} + } + var attr = this.toMathMLattributes(); + delete this.data[0].inferred; + var data = []; + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i]) {data.push(this.data[i].toMathML(space+" "))}} + return space + "<"+tag+attr+">\n" + data.join("\n") + "\n" + space + ""; + } + }); + + MML.TeXAtom.Augment({ + toMathML: function (space) { + // FIXME: Handle spacing using mpadded? + var attr = this.toMathMLattributes(); + if (!attr && this.data[0].data.length === 1) {return space.substr(2) + this.data[0].toMathML(space)} + return space+"\n" + this.data[0].toMathML(space+" ")+"\n"+space+""; + } + }); + + MML.chars.Augment({ + toMathML: function (space) {return (space||"") + this.toMathMLquote(this.toString())} + }); + + MML.entity.Augment({ + toMathML: function (space) {return (space||"") + "&"+this.toMathMLquote(this.data[0])+";"} + }); + + MML.xml.Augment({ + toMathML: function (space) {return (space||"") + this.toString()} + }); + + MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function () { + MML.TeXmathchoice.Augment({ + toMathML: function (space) {return this.Core().toMathML(space)} + }); + }); + + MathJax.Hub.Startup.signal.Post("toMathML Ready"); + +}); + +MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js"); +// @license-end diff --git a/js/mathjax/jax/element/mml/jax.js b/js/mathjax/jax/element/mml/jax.js new file mode 100644 index 0000000..e70bbbb --- /dev/null +++ b/js/mathjax/jax/element/mml/jax.js @@ -0,0 +1,1815 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/element/mml/jax.js + * + * Implements the MML ElementJax that holds the internal represetation + * of the mathematics on the page. Various InputJax will produce this + * format, and the OutputJax will display it in various formats. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.ElementJax.mml = MathJax.ElementJax({ + mimeType: "jax/mml" +},{ + id: "mml", + version: "2.7.9", + directory: MathJax.ElementJax.directory + "/mml", + extensionDir: MathJax.ElementJax.extensionDir + "/mml", + optableDir: MathJax.ElementJax.directory + "/mml/optable" +}); + +MathJax.ElementJax.mml.Augment({ + Init: function () { + if (arguments.length === 1 && arguments[0].type === "math") {this.root = arguments[0]} + else {this.root = MathJax.ElementJax.mml.math.apply(this,arguments)} + if (this.root.attr && this.root.attr.mode) { + if (!this.root.display && this.root.attr.mode === "display") { + this.root.display = "block"; + this.root.attrNames.push("display"); + } + delete this.root.attr.mode; + for (var i = 0, m = this.root.attrNames.length; i < m; i++) { + if (this.root.attrNames[i] === "mode") {this.root.attrNames.splice(i,1); break} + } + } + } +},{ + INHERIT: "_inherit_", + AUTO: "_auto_", + SIZE: { + INFINITY: "infinity", + SMALL: "small", + NORMAL: "normal", + BIG: "big" + }, + COLOR: { + TRANSPARENT: "transparent" + }, + VARIANT: { + NORMAL: "normal", + BOLD: "bold", + ITALIC: "italic", + BOLDITALIC: "bold-italic", + DOUBLESTRUCK: "double-struck", + FRAKTUR: "fraktur", + BOLDFRAKTUR: "bold-fraktur", + SCRIPT: "script", + BOLDSCRIPT: "bold-script", + SANSSERIF: "sans-serif", + BOLDSANSSERIF: "bold-sans-serif", + SANSSERIFITALIC: "sans-serif-italic", + SANSSERIFBOLDITALIC: "sans-serif-bold-italic", + MONOSPACE: "monospace", + INITIAL: "initial", + TAILED: "tailed", + LOOPED: "looped", + STRETCHED: "stretched", + CALIGRAPHIC: "-tex-caligraphic", + OLDSTYLE: "-tex-oldstyle" + }, + FORM: { + PREFIX: "prefix", + INFIX: "infix", + POSTFIX: "postfix" + }, + LINEBREAK: { + AUTO: "auto", + NEWLINE: "newline", + NOBREAK: "nobreak", + GOODBREAK: "goodbreak", + BADBREAK: "badbreak" + }, + LINEBREAKSTYLE: { + BEFORE: "before", + AFTER: "after", + DUPLICATE: "duplicate", + INFIXLINBREAKSTYLE: "infixlinebreakstyle" + }, + INDENTALIGN: { + LEFT: "left", + CENTER: "center", + RIGHT: "right", + AUTO: "auto", + ID: "id", + INDENTALIGN: "indentalign" + }, + INDENTSHIFT: { + INDENTSHIFT: "indentshift" + }, + LINETHICKNESS: { + THIN: "thin", + MEDIUM: "medium", + THICK: "thick" + }, + NOTATION: { + LONGDIV: "longdiv", + ACTUARIAL: "actuarial", + RADICAL: "radical", + BOX: "box", + ROUNDEDBOX: "roundedbox", + CIRCLE: "circle", + LEFT: "left", + RIGHT: "right", + TOP: "top", + BOTTOM: "bottom", + UPDIAGONALSTRIKE: "updiagonalstrike", + DOWNDIAGONALSTRIKE: "downdiagonalstrike", + UPDIAGONALARROW: "updiagonalarrow", + VERTICALSTRIKE: "verticalstrike", + HORIZONTALSTRIKE: "horizontalstrike", + PHASORANGLE: "phasorangle", + MADRUWB: "madruwb" + }, + ALIGN: { + TOP: "top", + BOTTOM: "bottom", + CENTER: "center", + BASELINE: "baseline", + AXIS: "axis", + LEFT: "left", + RIGHT: "right" + }, + LINES: { + NONE: "none", + SOLID: "solid", + DASHED: "dashed" + }, + SIDE: { + LEFT: "left", + RIGHT: "right", + LEFTOVERLAP: "leftoverlap", + RIGHTOVERLAP: "rightoverlap" + }, + WIDTH: { + AUTO: "auto", + FIT: "fit" + }, + ACTIONTYPE: { + TOGGLE: "toggle", + STATUSLINE: "statusline", + TOOLTIP: "tooltip", + INPUT: "input" + }, + LENGTH: { + VERYVERYTHINMATHSPACE: "veryverythinmathspace", + VERYTHINMATHSPACE: "verythinmathspace", + THINMATHSPACE: "thinmathspace", + MEDIUMMATHSPACE: "mediummathspace", + THICKMATHSPACE: "thickmathspace", + VERYTHICKMATHSPACE: "verythickmathspace", + VERYVERYTHICKMATHSPACE: "veryverythickmathspace", + NEGATIVEVERYVERYTHINMATHSPACE: "negativeveryverythinmathspace", + NEGATIVEVERYTHINMATHSPACE: "negativeverythinmathspace", + NEGATIVETHINMATHSPACE: "negativethinmathspace", + NEGATIVEMEDIUMMATHSPACE: "negativemediummathspace", + NEGATIVETHICKMATHSPACE: "negativethickmathspace", + NEGATIVEVERYTHICKMATHSPACE: "negativeverythickmathspace", + NEGATIVEVERYVERYTHICKMATHSPACE: "negativeveryverythickmathspace" + }, + OVERFLOW: { + LINBREAK: "linebreak", + SCROLL: "scroll", + ELIDE: "elide", + TRUNCATE: "truncate", + SCALE: "scale" + }, + UNIT: { + EM: "em", + EX: "ex", + PX: "px", + IN: "in", + CM: "cm", + MM: "mm", + PT: "pt", + PC: "pc" + }, + TEXCLASS: { + ORD: 0, + OP: 1, + BIN: 2, + REL: 3, + OPEN: 4, + CLOSE: 5, + PUNCT: 6, + INNER: 7, + VCENTER: 8, + NONE: -1 + }, + TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", "INNER", "VCENTER"], + skipAttributes: { + texClass:true, useHeight:true, texprimestyle:true + }, + copyAttributes: { + displaystyle:1, scriptlevel:1, open:1, close:1, form:1, + actiontype: 1, + fontfamily:true, fontsize:true, fontweight:true, fontstyle:true, + color:true, background:true, + id:true, "class":1, href:true, style:true + }, + copyAttributeNames: [ + "displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied + "actiontype", + "fontfamily", "fontsize", "fontweight", "fontstyle", + "color", "background", + "id", "class", "href", "style" + ], + nocopyAttributes: { + fontfamily: true, fontsize: true, fontweight: true, fontstyle: true, + color: true, background: true, + id: true, 'class': true, href: true, style: true, + xmlns: true + }, + Error: function (message,def) { + var mml = this.merror(message), + dir = MathJax.Localization.fontDirection(), + font = MathJax.Localization.fontFamily(); + if (def) {mml = mml.With(def)} + if (dir || font) { + mml = this.mstyle(mml); + if (dir) {mml.dir = dir} + if (font) {mml.style.fontFamily = "font-family: "+font} + } + return mml; + } +}); + +(function (MML) { + + MML.mbase = MathJax.Object.Subclass({ + type: "base", isToken: false, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT + }, + noInherit: {}, + noInheritAttribute: { + texClass: true + }, + getRemoved: {}, + linebreakContainer: false, + + Init: function () { + this.data = []; + if (this.inferRow && !(arguments.length === 1 && arguments[0].inferred)) + {this.Append(MML.mrow().With({inferred: true, notParent: true}))} + this.Append.apply(this,arguments); + }, + With: function (def) { + for (var id in def) {if (def.hasOwnProperty(id)) {this[id] = def[id]}} + return this; + }, + Append: function () { + if (this.inferRow && this.data.length) { + this.data[0].Append.apply(this.data[0],arguments); + } else { + for (var i = 0, m = arguments.length; i < m; i++) + {this.SetData(this.data.length,arguments[i])} + } + }, + SetData: function (i,item) { + if (item != null) { + if (!(item instanceof MML.mbase)) + {item = (this.isToken || this.isChars ? MML.chars(item) : MML.mtext(item))} + item.parent = this; + item.setInherit(this.inheritFromMe ? this : this.inherit); + } + this.data[i] = item; + }, + Parent: function () { + var parent = this.parent; + while (parent && parent.notParent) {parent = parent.parent} + return parent; + }, + Get: function (name,nodefault,noself) { + if (!noself) { + if (this[name] != null) {return this[name]} + if (this.attr && this.attr[name] != null) {return this.attr[name]} + } + // FIXME: should cache these values and get from cache + // (clear cache when appended to a new object?) + var parent = this.Parent(); + if (parent && parent["adjustChild_"+name] != null) { + return (parent["adjustChild_"+name])(this.childPosition(),nodefault); + } + var obj = this.inherit; var root = obj; + while (obj) { + var value = obj[name]; if (value == null && obj.attr) {value = obj.attr[name]} + if (obj.removedStyles && obj.getRemoved[name] && value == null) value = obj.removedStyles[obj.getRemoved[name]]; + if (value != null && obj.noInheritAttribute && !obj.noInheritAttribute[name]) { + var noInherit = obj.noInherit[this.type]; + if (!(noInherit && noInherit[name])) {return value} + } + root = obj; obj = obj.inherit; + } + if (!nodefault) { + if (this.defaults[name] === MML.AUTO) {return this.autoDefault(name)} + if (this.defaults[name] !== MML.INHERIT && this.defaults[name] != null) + {return this.defaults[name]} + if (root) {return root.defaults[name]} + } + return null; + }, + hasValue: function (name) {return (this.Get(name,true) != null)}, + getValues: function () { + var values = {}; + for (var i = 0, m = arguments.length; i < m; i++) + {values[arguments[i]] = this.Get(arguments[i])} + return values; + }, + adjustChild_scriptlevel: function (i,nodef) {return this.Get("scriptlevel",nodef)}, // always inherit from parent + adjustChild_displaystyle: function (i,nodef) {return this.Get("displaystyle",nodef)}, // always inherit from parent + adjustChild_texprimestyle: function (i,nodef) {return this.Get("texprimestyle",nodef)}, // always inherit from parent + hasMMLspacing: function () {return false}, + childPosition: function () { + var child = this, parent = child.parent; + while (parent.notParent) {child = parent; parent = child.parent} + for (var i = 0, m = parent.data.length; i < m; i++) {if (parent.data[i] === child) {return i}} + return null; + }, + setInherit: function (obj) { + if (obj !== this.inherit && this.inherit == null) { + this.inherit = obj; + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i] && this.data[i].setInherit) {this.data[i].setInherit(obj)} + } + } + }, + setTeXclass: function (prev) { + this.getPrevClass(prev); + return (typeof(this.texClass) !== "undefined" ? this : prev); + }, + getPrevClass: function (prev) { + if (prev) { + this.prevClass = prev.Get("texClass"); + this.prevLevel = prev.Get("scriptlevel"); + } + }, + updateTeXclass: function (core) { + if (core) { + this.prevClass = core.prevClass; delete core.prevClass; + this.prevLevel = core.prevLevel; delete core.prevLevel; + this.texClass = core.Get("texClass"); + } + }, + texSpacing: function () { + var prev = (this.prevClass != null ? this.prevClass : MML.TEXCLASS.NONE); + var tex = (this.Get("texClass") || MML.TEXCLASS.ORD); + if (prev === MML.TEXCLASS.NONE || tex === MML.TEXCLASS.NONE) {return ""} + if (prev === MML.TEXCLASS.VCENTER) {prev = MML.TEXCLASS.ORD} + if (tex === MML.TEXCLASS.VCENTER) {tex = MML.TEXCLASS.ORD} + var space = this.TEXSPACE[prev][tex]; + if ((this.prevLevel > 0 || this.Get("scriptlevel") > 0) && space >= 0) {return ""} + return this.TEXSPACELENGTH[Math.abs(space)]; + }, + TEXSPACELENGTH:[ + "", + MML.LENGTH.THINMATHSPACE, + MML.LENGTH.MEDIUMMATHSPACE, + MML.LENGTH.THICKMATHSPACE + ], + // See TeXBook Chapter 18 (p. 170) + TEXSPACE: [ + [ 0,-1, 2, 3, 0, 0, 0, 1], // ORD + [-1,-1, 0, 3, 0, 0, 0, 1], // OP + [ 2, 2, 0, 0, 2, 0, 0, 2], // BIN + [ 3, 3, 0, 0, 3, 0, 0, 3], // REL + [ 0, 0, 0, 0, 0, 0, 0, 0], // OPEN + [ 0,-1, 2, 3, 0, 0, 0, 1], // CLOSE + [ 1, 1, 0, 1, 1, 1, 1, 1], // PUNCT + [ 1,-1, 2, 3, 1, 0, 1, 1] // INNER + ], + autoDefault: function (name) {return ""}, + isSpacelike: function () {return false}, + isEmbellished: function () {return false}, + Core: function () {return this}, + CoreMO: function () {return this}, + childIndex: function(child) { + if (child == null) return; + for (var i = 0, m = this.data.length; i < m; i++) if (child === this.data[i]) return i; + }, + CoreIndex: function () { + return (this.inferRow ? this.data[0]||this : this).childIndex(this.Core()); + }, + hasNewline: function () { + if (this.isEmbellished()) {return this.CoreMO().hasNewline()} + if (this.isToken || this.linebreakContainer) {return false} + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i] && this.data[i].hasNewline()) {return true} + } + return false; + }, + array: function () {if (this.inferred) {return this.data} else {return [this]}}, + toString: function () {return this.type+"("+this.data.join(",")+")"}, + getAnnotation: function () {return null} + },{ + childrenSpacelike: function () { + for (var i = 0, m = this.data.length; i < m; i++) + {if (!this.data[i].isSpacelike()) {return false}} + return true; + }, + childEmbellished: function () { + return (this.data[0] && this.data[0].isEmbellished()); + }, + childCore: function () {return (this.inferRow && this.data[0] ? this.data[0].Core() : this.data[0])}, + childCoreMO: function () {return (this.data[0] ? this.data[0].CoreMO() : null)}, + setChildTeXclass: function (prev) { + if (this.data[0]) { + prev = this.data[0].setTeXclass(prev); + this.updateTeXclass(this.data[0]); + } + return prev; + }, + setBaseTeXclasses: function (prev) { + this.getPrevClass(prev); this.texClass = null; + if (this.data[0]) { + if (this.isEmbellished() || this.data[0].isa(MML.mi)) { + prev = this.data[0].setTeXclass(prev); + this.updateTeXclass(this.Core()); + } else {this.data[0].setTeXclass(); prev = this} + } else {prev = this} + for (var i = 1, m = this.data.length; i < m; i++) + {if (this.data[i]) {this.data[i].setTeXclass()}} + return prev; + }, + setSeparateTeXclasses: function (prev) { + this.getPrevClass(prev); + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i]) {this.data[i].setTeXclass()}} + if (this.isEmbellished()) {this.updateTeXclass(this.Core())} + return this; + } + }); + + MML.mi = MML.mbase.Subclass({ + type: "mi", isToken: true, + texClass: MML.TEXCLASS.ORD, + defaults: { + mathvariant: MML.AUTO, + mathsize: MML.INHERIT, + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT + }, + autoDefault: function (name) { + if (name === "mathvariant") { + var mi = (this.data[0]||"").toString(); + return (mi.length === 1 || + (mi.length === 2 && mi.charCodeAt(0) >= 0xD800 && mi.charCodeAt(0) < 0xDC00) ? + MML.VARIANT.ITALIC : MML.VARIANT.NORMAL); + } + return ""; + }, + setTeXclass: function (prev) { + this.getPrevClass(prev); + var name = this.data.join(""); + if (name.length > 1 && name.match(/^[a-z][a-z0-9]*$/i) && + this.texClass === MML.TEXCLASS.ORD) { + this.texClass = MML.TEXCLASS.OP; + this.autoOP = true; + } + return this; + } + }); + + MML.mn = MML.mbase.Subclass({ + type: "mn", isToken: true, + texClass: MML.TEXCLASS.ORD, + defaults: { + mathvariant: MML.INHERIT, + mathsize: MML.INHERIT, + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT + } + }); + + MML.mo = MML.mbase.Subclass({ + type: "mo", isToken: true, + defaults: { + mathvariant: MML.INHERIT, + mathsize: MML.INHERIT, + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT, + form: MML.AUTO, + fence: MML.AUTO, + separator: MML.AUTO, + lspace: MML.AUTO, + rspace: MML.AUTO, + stretchy: MML.AUTO, + symmetric: MML.AUTO, + maxsize: MML.AUTO, + minsize: MML.AUTO, + largeop: MML.AUTO, + movablelimits: MML.AUTO, + accent: MML.AUTO, + linebreak: MML.LINEBREAK.AUTO, + lineleading: MML.INHERIT, + linebreakstyle: MML.AUTO, + linebreakmultchar: MML.INHERIT, + indentalign: MML.INHERIT, + indentshift: MML.INHERIT, + indenttarget: MML.INHERIT, + indentalignfirst: MML.INHERIT, + indentshiftfirst: MML.INHERIT, + indentalignlast: MML.INHERIT, + indentshiftlast: MML.INHERIT, + texClass: MML.AUTO + }, + defaultDef: { + form: MML.FORM.INFIX, + fence: false, + separator: false, + lspace: MML.LENGTH.THICKMATHSPACE, + rspace: MML.LENGTH.THICKMATHSPACE, + stretchy: false, + symmetric: false, + maxsize: MML.SIZE.INFINITY, + minsize: '0em', //'1em', + largeop: false, + movablelimits: false, + accent: false, + linebreak: MML.LINEBREAK.AUTO, + lineleading: "1ex", + linebreakstyle: "before", + indentalign: MML.INDENTALIGN.AUTO, + indentshift: "0", + indenttarget: "", + indentalignfirst: MML.INDENTALIGN.INDENTALIGN, + indentshiftfirst: MML.INDENTSHIFT.INDENTSHIFT, + indentalignlast: MML.INDENTALIGN.INDENTALIGN, + indentshiftlast: MML.INDENTSHIFT.INDENTSHIFT, + texClass: MML.TEXCLASS.REL // for MML, but TeX sets ORD explicitly + }, + SPACE_ATTR: {lspace: 0x01, rspace: 0x02}, + useMMLspacing: 0x03, + hasMMLspacing: function () { + if (this.useMMLspacing) return true; + return this.form && (this.OPTABLE[this.form]||{})[this.data.join('')]; + }, + autoDefault: function (name,nodefault) { + var def = this.def; + if (!def) { + if (name === "form") {return this.getForm()} + var mo = this.data.join(""); + var forms = [this.Get("form"),MML.FORM.INFIX,MML.FORM.POSTFIX,MML.FORM.PREFIX]; + for (var i = 0, m = forms.length; i < m; i++) { + var data = this.OPTABLE[forms[i]][mo]; + if (data) {def = this.makeDef(data); break} + } + if (!def) {def = this.CheckRange(mo)} + if (!def && nodefault) {def = {}} else { + if (!def) {def = MathJax.Hub.Insert({},this.defaultDef)} + if (this.parent) {this.def = def} else {def = MathJax.Hub.Insert({},def)} + def.form = forms[0]; + } + } + this.useMMLspacing &= ~(this.SPACE_ATTR[name] || 0); + if (def[name] != null) {return def[name]} + else if (!nodefault) {return this.defaultDef[name]} + return ""; + }, + CheckRange: function (mo) { + var n = mo.charCodeAt(0); + if (n >= 0xD800 && n < 0xDC00) {n = (((n-0xD800)<<10)+(mo.charCodeAt(1)-0xDC00))+0x10000} + for (var i = 0, m = this.RANGES.length; i < m && this.RANGES[i][0] <= n; i++) { + if (n <= this.RANGES[i][1]) { + if (this.RANGES[i][3]) { + var file = MML.optableDir+"/"+this.RANGES[i][3]+".js"; + this.RANGES[i][3] = null; + MathJax.Hub.RestartAfter(MathJax.Ajax.Require(file)); + } + var data = MML.TEXCLASSNAMES[this.RANGES[i][2]]; + data = this.OPTABLE.infix[mo] = MML.mo.OPTYPES[data === "BIN" ? "BIN3" : data]; + return this.makeDef(data); + } + } + return null; + }, + makeDef: function (data) { + if (data[2] == null) {data[2] = this.defaultDef.texClass} + if (!data[3]) {data[3] = {}} + var def = MathJax.Hub.Insert({},data[3]); + def.lspace = this.SPACE[data[0]]; def.rspace = this.SPACE[data[1]]; + def.texClass = data[2]; + if (def.texClass === MML.TEXCLASS.REL && + (this.movablelimits || this.data.join("").match(/^[a-z]+$/i))) + {def.texClass = MML.TEXCLASS.OP} // mark named operators as OP + return def; + }, + getForm: function () { + var core = this, parent = this.parent, Parent = this.Parent(); + while (Parent && Parent.isEmbellished()) + {core = parent; parent = Parent.parent; Parent = Parent.Parent()} + if (parent && parent.type === "mrow" && parent.NonSpaceLength() !== 1) { + if (parent.FirstNonSpace() === core) {return MML.FORM.PREFIX} + if (parent.LastNonSpace() === core) {return MML.FORM.POSTFIX} + } + return MML.FORM.INFIX; + }, + isEmbellished: function () {return true}, + hasNewline: function () {return (this.Get("linebreak") === MML.LINEBREAK.NEWLINE)}, + CoreParent: function () { + var parent = this; + while (parent && parent.isEmbellished() && + parent.CoreMO() === this && !parent.isa(MML.math)) {parent = parent.Parent()} + return parent; + }, + CoreText: function (parent) { + if (!parent) {return ""} + if (parent.isEmbellished()) {return parent.CoreMO().data.join("")} + while ((((parent.isa(MML.mrow) || parent.isa(MML.TeXAtom) || + parent.isa(MML.mstyle) || parent.isa(MML.mphantom)) && + parent.data.length === 1) || parent.isa(MML.munderover)) && + parent.data[0]) {parent = parent.data[0]} + if (!parent.isToken) {return ""} else {return parent.data.join("")} + }, + remapChars: { + '*':"\u2217", + '"':"\u2033", + "\u00B0":"\u2218", + "\u00B2":"2", + "\u00B3":"3", + "\u00B4":"\u2032", + "\u00B9":"1" + }, + remap: function (text,map) { + text = text.replace(/-/g,"\u2212"); + if (map) { + text = text.replace(/'/g,"\u2032").replace(/`/g,"\u2035"); + if (text.length === 1) {text = map[text]||text} + } + return text; + }, + setTeXclass: function (prev) { + var values = this.getValues("form","lspace","rspace","fence"); // sets useMMLspacing + if (this.hasMMLspacing()) {this.texClass = MML.TEXCLASS.NONE; return this} + if (values.fence && !this.texClass) { + if (values.form === MML.FORM.PREFIX) {this.texClass = MML.TEXCLASS.OPEN} + if (values.form === MML.FORM.POSTFIX) {this.texClass = MML.TEXCLASS.CLOSE} + } + this.texClass = this.Get("texClass"); + if (this.data.join("") === "\u2061") { + // force previous node to be texClass OP, and skip this node + if (prev) {prev.texClass = MML.TEXCLASS.OP; prev.fnOP = true} + this.texClass = this.prevClass = MML.TEXCLASS.NONE; + return prev; + } + return this.adjustTeXclass(prev); + }, + adjustTeXclass: function (prev) { + if (this.texClass === MML.TEXCLASS.NONE) {return prev} + if (prev) { + if (prev.autoOP && (this.texClass === MML.TEXCLASS.BIN || + this.texClass === MML.TEXCLASS.REL)) + {prev.texClass = MML.TEXCLASS.ORD} + this.prevClass = prev.texClass || MML.TEXCLASS.ORD; + this.prevLevel = prev.Get("scriptlevel") + } else {this.prevClass = MML.TEXCLASS.NONE} + if (this.texClass === MML.TEXCLASS.BIN && + (this.prevClass === MML.TEXCLASS.NONE || + this.prevClass === MML.TEXCLASS.BIN || + this.prevClass === MML.TEXCLASS.OP || + this.prevClass === MML.TEXCLASS.REL || + this.prevClass === MML.TEXCLASS.OPEN || + this.prevClass === MML.TEXCLASS.PUNCT)) { + this.texClass = MML.TEXCLASS.ORD; + } else if (this.prevClass === MML.TEXCLASS.BIN && + (this.texClass === MML.TEXCLASS.REL || + this.texClass === MML.TEXCLASS.CLOSE || + this.texClass === MML.TEXCLASS.PUNCT)) { + prev.texClass = this.prevClass = MML.TEXCLASS.ORD; + } else if (this.texClass === MML.TEXCLASS.BIN) { + // + // Check if node is the last one in its container since the rule + // above only takes effect if there is a node that follows. + // + var child = this, parent = this.parent; + while (parent && parent.parent && parent.isEmbellished() && + (parent.data.length === 1 || + (parent.type !== "mrow" && parent.Core() === child))) // handles msubsup and munderover + {child = parent; parent = parent.parent} + if (parent.data[parent.data.length-1] === child) this.texClass = MML.TEXCLASS.ORD; + } + return this; + } + }); + + MML.mtext = MML.mbase.Subclass({ + type: "mtext", isToken: true, + isSpacelike: function () {return true}, + texClass: MML.TEXCLASS.ORD, + defaults: { + mathvariant: MML.INHERIT, + mathsize: MML.INHERIT, + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT + } + }); + + MML.mspace = MML.mbase.Subclass({ + type: "mspace", isToken: true, + isSpacelike: function () {return true}, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + width: "0em", + height: "0ex", + depth: "0ex", + linebreak: MML.LINEBREAK.AUTO + }, + hasDimAttr: function () { + return (this.hasValue("width") || this.hasValue("height") || + this.hasValue("depth")); + }, + hasNewline: function () { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + return (!this.hasDimAttr() && + this.Get("linebreak") === MML.LINEBREAK.NEWLINE); + } + }); + + MML.ms = MML.mbase.Subclass({ + type: "ms", isToken: true, + texClass: MML.TEXCLASS.ORD, + defaults: { + mathvariant: MML.INHERIT, + mathsize: MML.INHERIT, + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT, + lquote: '"', + rquote: '"' + } + }); + + MML.mglyph = MML.mbase.Subclass({ + type: "mglyph", isToken: true, + texClass: MML.TEXCLASS.ORD, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + alt: "", + src: "", + width: MML.AUTO, + height: MML.AUTO, + valign: "0em" + } + }); + + MML.mrow = MML.mbase.Subclass({ + type: "mrow", + isSpacelike: MML.mbase.childrenSpacelike, + inferred: false, notParent: false, + isEmbellished: function () { + var isEmbellished = false; + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i] == null) continue; + if (this.data[i].isEmbellished()) { + if (isEmbellished) {return false} + isEmbellished = true; this.core = i; + } else if (!this.data[i].isSpacelike()) {return false} + } + return isEmbellished; + }, + NonSpaceLength: function () { + var n = 0; + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i] && !this.data[i].isSpacelike()) {n++}} + return n; + }, + FirstNonSpace: function () { + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i] && !this.data[i].isSpacelike()) {return this.data[i]}} + return null; + }, + LastNonSpace: function () { + for (var i = this.data.length-1; i >= 0; i--) + {if (this.data[0] && !this.data[i].isSpacelike()) {return this.data[i]}} + return null; + }, + Core: function () { + if (!(this.isEmbellished()) || typeof(this.core) === "undefined") {return this} + return this.data[this.core]; + }, + CoreMO: function () { + if (!(this.isEmbellished()) || typeof(this.core) === "undefined") {return this} + return this.data[this.core].CoreMO(); + }, + toString: function () { + if (this.inferred) {return '[' + this.data.join(',') + ']'} + return this.SUPER(arguments).toString.call(this); + }, + setTeXclass: function (prev) { + var i, m = this.data.length; + if ((this.open || this.close) && (!prev || !prev.fnOP)) { + // + // came from \left...\right + // so treat as subexpression (tex class INNER) + // + this.getPrevClass(prev); prev = null; + for (i = 0; i < m; i++) + {if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}} + if (!this.hasOwnProperty("texClass")) this.texClass = MML.TEXCLASS.INNER; + return this; + } else { + // + // Normal , so treat as + // thorugh mrow is not there + // + for (i = 0; i < m; i++) + {if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}} + if (this.data[0]) {this.updateTeXclass(this.data[0])} + return prev; + } + }, + getAnnotation: function (name) { + if (this.data.length != 1) return null; + return this.data[0].getAnnotation(name); + } + }); + + MML.mfrac = MML.mbase.Subclass({ + type: "mfrac", num: 0, den: 1, + linebreakContainer: true, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + linethickness: MML.LINETHICKNESS.MEDIUM, + numalign: MML.ALIGN.CENTER, + denomalign: MML.ALIGN.CENTER, + bevelled: false + }, + adjustChild_displaystyle: function (n) {return false}, + adjustChild_scriptlevel: function (n) { + var level = this.Get("scriptlevel"); + if (!this.Get("displaystyle") || level > 0) {level++} + return level; + }, + adjustChild_texprimestyle: function (n) { + if (n == this.den) {return true} + return this.Get("texprimestyle"); + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.msqrt = MML.mbase.Subclass({ + type: "msqrt", + inferRow: true, + linebreakContainer: true, + texClass: MML.TEXCLASS.ORD, + setTeXclass: MML.mbase.setSeparateTeXclasses, + adjustChild_texprimestyle: function (n) {return true} + }); + + MML.mroot = MML.mbase.Subclass({ + type: "mroot", + linebreakContainer: true, + texClass: MML.TEXCLASS.ORD, + adjustChild_displaystyle: function (n) { + if (n === 1) {return false} + return this.Get("displaystyle"); + }, + adjustChild_scriptlevel: function (n) { + var level = this.Get("scriptlevel"); + if (n === 1) {level += 2} + return level; + }, + adjustChild_texprimestyle: function (n) { + if (n === 0) {return true}; + return this.Get("texprimestyle"); + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.mstyle = MML.mbase.Subclass({ + type: "mstyle", + isSpacelike: MML.mbase.childrenSpacelike, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + inferRow: true, + defaults: { + scriptlevel: MML.INHERIT, + displaystyle: MML.INHERIT, + scriptsizemultiplier: Math.sqrt(1/2), + scriptminsize: "8pt", + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + dir: MML.INHERIT, + infixlinebreakstyle: MML.LINEBREAKSTYLE.BEFORE, + decimalseparator: "." + }, + adjustChild_scriptlevel: function (n) { + var level = this.scriptlevel; + if (level == null) { + level = this.Get("scriptlevel"); + } else if (String(level).match(/^ *[-+]/)) { + var LEVEL = this.Get("scriptlevel",null,true); + level = LEVEL + parseInt(level); + } + return level; + }, + inheritFromMe: true, + noInherit: { + mpadded: {width: true, height: true, depth: true, lspace: true, voffset: true}, + mtable: {width: true, height: true, depth: true, align: true} + }, + getRemoved: {fontfamily:"fontFamily", fontweight:"fontWeight", fontstyle:"fontStyle", fontsize:"fontSize"}, + setTeXclass: MML.mbase.setChildTeXclass + }); + + MML.merror = MML.mbase.Subclass({ + type: "merror", + inferRow: true, + linebreakContainer: true, + texClass: MML.TEXCLASS.ORD + }); + + MML.mpadded = MML.mbase.Subclass({ + type: "mpadded", + inferRow: true, + isSpacelike: MML.mbase.childrenSpacelike, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + width: "", + height: "", + depth: "", + lspace: 0, + voffset: 0 + }, + setTeXclass: MML.mbase.setChildTeXclass + }); + + MML.mphantom = MML.mbase.Subclass({ + type: "mphantom", + texClass: MML.TEXCLASS.ORD, + inferRow: true, + isSpacelike: MML.mbase.childrenSpacelike, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + setTeXclass: MML.mbase.setChildTeXclass + }); + + MML.mfenced = MML.mbase.Subclass({ + type: "mfenced", + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + open: '(', + close: ')', + separators: ',' + }, + addFakeNodes: function () { + var values = this.getValues("open","close","separators"); + values.open = values.open.replace(/[ \t\n\r]/g,""); + values.close = values.close.replace(/[ \t\n\r]/g,""); + values.separators = values.separators.replace(/[ \t\n\r]/g,""); + // + // Create a fake node for the open item + // + if (values.open !== "") { + this.SetData("open",MML.mo(values.open).With({ + fence:true, form:MML.FORM.PREFIX, texClass:MML.TEXCLASS.OPEN + })); + } + // + // Create fake nodes for the separators + // + if (values.separators !== "") { + while (values.separators.length < this.data.length) + {values.separators += values.separators.charAt(values.separators.length-1)} + for (var i = 1, m = this.data.length; i < m; i++) { + if (this.data[i]) + {this.SetData("sep"+i,MML.mo(values.separators.charAt(i-1)).With({separator:true}))} + } + } + // + // Create fake node for the close item + // + if (values.close !== "") { + this.SetData("close",MML.mo(values.close).With({ + fence:true, form:MML.FORM.POSTFIX, texClass:MML.TEXCLASS.CLOSE + })); + } + }, + texClass: MML.TEXCLASS.OPEN, + setTeXclass: function (prev) { + this.addFakeNodes(); + this.getPrevClass(prev); + if (this.data.open) {prev = this.data.open.setTeXclass(prev)} + if (this.data[0]) {prev = this.data[0].setTeXclass(prev)} + for (var i = 1, m = this.data.length; i < m; i++) { + if (this.data["sep"+i]) {prev = this.data["sep"+i].setTeXclass(prev)} + if (this.data[i]) {prev = this.data[i].setTeXclass(prev)} + } + if (this.data.close) {prev = this.data.close.setTeXclass(prev)} + this.updateTeXclass(this.data.open); + this.texClass = MML.TEXCLASS.INNER; + return prev; + } + }); + + MML.menclose = MML.mbase.Subclass({ + type: "menclose", + inferRow: true, + linebreakContainer: true, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + notation: MML.NOTATION.LONGDIV, + texClass: MML.TEXCLASS.ORD + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.msubsup = MML.mbase.Subclass({ + type: "msubsup", base: 0, sub: 1, sup: 2, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + subscriptshift: "", + superscriptshift: "", + texClass: MML.AUTO + }, + autoDefault: function (name) { + if (name === "texClass") + {return (this.isEmbellished() ? this.CoreMO().Get(name) : MML.TEXCLASS.ORD)} + return 0; + }, + adjustChild_displaystyle: function (n) { + if (n > 0) {return false} + return this.Get("displaystyle"); + }, + adjustChild_scriptlevel: function (n) { + var level = this.Get("scriptlevel"); + if (n > 0) {level++} + return level; + }, + adjustChild_texprimestyle: function (n) { + if (n === this.sub) {return true} + return this.Get("texprimestyle"); + }, + setTeXclass: MML.mbase.setBaseTeXclasses + }); + + MML.msub = MML.msubsup.Subclass({type: "msub"}); + MML.msup = MML.msubsup.Subclass({type: "msup", sub:2, sup:1}); + MML.mmultiscripts = MML.msubsup.Subclass({ + type: "mmultiscripts", + adjustChild_texprimestyle: function (n) { + if (n % 2 === 1) {return true} + return this.Get("texprimestyle"); + } + }); + MML.mprescripts = MML.mbase.Subclass({type: "mprescripts"}); + MML.none = MML.mbase.Subclass({type: "none"}); + + MML.munderover = MML.mbase.Subclass({ + type: "munderover", + base: 0, under: 1, over: 2, sub: 1, sup: 2, + ACCENTS: ["", "accentunder", "accent"], + linebreakContainer: true, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + accent: MML.AUTO, + accentunder: MML.AUTO, + align: MML.ALIGN.CENTER, + texClass: MML.AUTO, + subscriptshift: "", // when converted to msubsup by moveablelimits + superscriptshift: "" // when converted to msubsup by moveablelimits + }, + autoDefault: function (name) { + if (name === "texClass") + {return (this.isEmbellished() ? this.CoreMO().Get(name) : MML.TEXCLASS.ORD)} + if (name === "accent" && this.data[this.over]) {return this.data[this.over].CoreMO().Get("accent")} + if (name === "accentunder" && this.data[this.under]) {return this.data[this.under].CoreMO().Get("accent")} + return false; + }, + adjustChild_displaystyle: function (n) { + if (n > 0) {return false} + return this.Get("displaystyle"); + }, + adjustChild_scriptlevel: function (n) { + var level = this.Get("scriptlevel"); + var force = (this.data[this.base] && !this.Get("displaystyle") && + this.data[this.base].CoreMO().Get("movablelimits")); + if (n == this.under && (force || !this.Get("accentunder"))) {level++} + if (n == this.over && (force || !this.Get("accent"))) {level++} + return level; + }, + adjustChild_texprimestyle: function (n) { + if (n === this.base && this.data[this.over]) {return true} + return this.Get("texprimestyle"); + }, + setTeXclass: MML.mbase.setBaseTeXclasses + }); + + MML.munder = MML.munderover.Subclass({type: "munder"}); + MML.mover = MML.munderover.Subclass({ + type: "mover", over: 1, under: 2, sup: 1, sub: 2, + ACCENTS: ["", "accent", "accentunder"] + }); + + MML.mtable = MML.mbase.Subclass({ + type: "mtable", + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + align: MML.ALIGN.AXIS, + rowalign: MML.ALIGN.BASELINE, + columnalign: MML.ALIGN.CENTER, + groupalign: "{left}", + alignmentscope: true, + columnwidth: MML.WIDTH.AUTO, + width: MML.WIDTH.AUTO, + rowspacing: "1ex", + columnspacing: ".8em", + rowlines: MML.LINES.NONE, + columnlines: MML.LINES.NONE, + frame: MML.LINES.NONE, + framespacing: "0.4em 0.5ex", + equalrows: false, + equalcolumns: false, + displaystyle: false, + side: MML.SIDE.RIGHT, + minlabelspacing: "0.8em", + texClass: MML.TEXCLASS.ORD, + useHeight: 1 + }, + adjustChild_displaystyle: function () { + return (this.displaystyle != null ? this.displaystyle : this.defaults.displaystyle); + }, + inheritFromMe: true, + noInherit: { + mover: {align: true}, + munder: {align: true}, + munderover: {align: true}, + mtable: { + align: true, rowalign: true, columnalign: true, groupalign: true, + alignmentscope: true, columnwidth: true, width: true, rowspacing: true, + columnspacing: true, rowlines: true, columnlines: true, frame: true, + framespacing: true, equalrows: true, equalcolumns: true, displaystyle: true, + side: true, minlabelspacing: true, texClass: true, useHeight: 1 + } + }, + linebreakContainer: true, + Append: function () { + for (var i = 0, m = arguments.length; i < m; i++) { + if (!((arguments[i] instanceof MML.mtr) || + (arguments[i] instanceof MML.mlabeledtr))) {arguments[i] = MML.mtr(arguments[i])} + } + this.SUPER(arguments).Append.apply(this,arguments); + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.mtr = MML.mbase.Subclass({ + type: "mtr", + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + rowalign: MML.INHERIT, + columnalign: MML.INHERIT, + groupalign: MML.INHERIT + }, + inheritFromMe: true, + noInherit: { + mrow: {rowalign: true, columnalign: true, groupalign: true}, + mtable: {rowalign: true, columnalign: true, groupalign: true} + }, + linebreakContainer: true, + Append: function () { + for (var i = 0, m = arguments.length; i < m; i++) { + if (!(arguments[i] instanceof MML.mtd)) {arguments[i] = MML.mtd(arguments[i])} + } + this.SUPER(arguments).Append.apply(this,arguments); + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.mtd = MML.mbase.Subclass({ + type: "mtd", + inferRow: true, + linebreakContainer: true, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + rowspan: 1, + columnspan: 1, + rowalign: MML.INHERIT, + columnalign: MML.INHERIT, + groupalign: MML.INHERIT + }, + setTeXclass: MML.mbase.setSeparateTeXclasses + }); + + MML.maligngroup = MML.mbase.Subclass({ + type: "maligngroup", + isSpacelike: function () {return true}, + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + groupalign: MML.INHERIT + }, + inheritFromMe: true, + noInherit: { + mrow: {groupalign: true}, + mtable: {groupalign: true} + } + }); + + MML.malignmark = MML.mbase.Subclass({ + type: "malignmark", + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + edge: MML.SIDE.LEFT + }, + isSpacelike: function () {return true} + }); + + MML.mlabeledtr = MML.mtr.Subclass({ + type: "mlabeledtr" + }); + + MML.maction = MML.mbase.Subclass({ + type: "maction", + defaults: { + mathbackground: MML.INHERIT, + mathcolor: MML.INHERIT, + actiontype: MML.ACTIONTYPE.TOGGLE, + selection: 1 + }, + selected: function () {return this.data[this.Get("selection")-1] || MML.NULL}, + isEmbellished: function () {return this.selected().isEmbellished()}, + isSpacelike: function () {return this.selected().isSpacelike()}, + Core: function () {return this.selected().Core()}, + CoreMO: function () {return this.selected().CoreMO()}, + setTeXclass: function (prev) { + if (this.Get("actiontype") === MML.ACTIONTYPE.TOOLTIP && this.data[1]) { + // Make sure tooltip has proper spacing when typeset (see issue #412) + this.data[1].setTeXclass(); + } + var selected = this.selected(); + prev = selected.setTeXclass(prev); + this.updateTeXclass(selected); + return prev; + } + }); + + MML.semantics = MML.mbase.Subclass({ + type: "semantics", notParent: true, + isEmbellished: MML.mbase.childEmbellished, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + defaults: { + definitionURL: null, + encoding: null + }, + setTeXclass: MML.mbase.setChildTeXclass, + getAnnotation: function (name) { + var encodingList = MathJax.Hub.config.MathMenu.semanticsAnnotations[name]; + if (encodingList) { + for (var i = 0, m = this.data.length; i < m; i++) { + var encoding = this.data[i].Get("encoding"); + if (encoding) { + for (var j = 0, n = encodingList.length; j < n; j++) { + if (encodingList[j] === encoding) return this.data[i]; + } + } + } + } + return null; + } + }); + MML.annotation = MML.mbase.Subclass({ + type: "annotation", isChars: true, + linebreakContainer: true, + defaults: { + definitionURL: null, + encoding: null, + cd: "mathmlkeys", + name: "", + src: null + } + }); + MML["annotation-xml"] = MML.mbase.Subclass({ + type: "annotation-xml", + linebreakContainer: true, + defaults: { + definitionURL: null, + encoding: null, + cd: "mathmlkeys", + name: "", + src: null + } + }); + + MML.math = MML.mstyle.Subclass({ + type: "math", + defaults: { + mathvariant: MML.VARIANT.NORMAL, + mathsize: MML.SIZE.NORMAL, + mathcolor: "", // should be "black", but allow it to inherit from surrounding text + mathbackground: MML.COLOR.TRANSPARENT, + dir: "ltr", + scriptlevel: 0, + displaystyle: MML.AUTO, + display: "inline", + maxwidth: "", + overflow: MML.OVERFLOW.LINEBREAK, + altimg: "", + 'altimg-width': "", + 'altimg-height': "", + 'altimg-valign': "", + alttext: "", + cdgroup: "", + scriptsizemultiplier: Math.sqrt(1/2), + scriptminsize: "8px", // should be 8pt, but that's too big + infixlinebreakstyle: MML.LINEBREAKSTYLE.BEFORE, + lineleading: "1ex", + indentshift: "auto", // use user configuration + indentalign: MML.INDENTALIGN.AUTO, + indentalignfirst: MML.INDENTALIGN.INDENTALIGN, + indentshiftfirst: MML.INDENTSHIFT.INDENTSHIFT, + indentalignlast: MML.INDENTALIGN.INDENTALIGN, + indentshiftlast: MML.INDENTSHIFT.INDENTSHIFT, + decimalseparator: ".", + texprimestyle: false // is it in TeX's C' style? + }, + autoDefault: function (name) { + if (name === "displaystyle") {return this.Get("display") === "block"} + return ""; + }, + linebreakContainer: true, + setTeXclass: MML.mbase.setChildTeXclass, + getAnnotation: function (name) { + if (this.data.length != 1) return null; + return this.data[0].getAnnotation(name); + } + }); + + MML.chars = MML.mbase.Subclass({ + type: "chars", + Append: function () {this.data.push.apply(this.data,arguments)}, + value: function () {return this.data.join("")}, + toString: function () {return this.data.join("")} + }); + + MML.entity = MML.mbase.Subclass({ + type: "entity", + Append: function () {this.data.push.apply(this.data,arguments)}, + value: function () { + if (this.data[0].substr(0,2) === "#x") {return parseInt(this.data[0].substr(2),16)} + else if (this.data[0].substr(0,1) === "#") {return parseInt(this.data[0].substr(1))} + else {return 0} // FIXME: look up named entities from table + }, + toString: function () { + var n = this.value(); + if (n <= 0xFFFF) {return String.fromCharCode(n)} + n -= 0x10000; + return String.fromCharCode((n>>10)+0xD800) + + String.fromCharCode((n&0x3FF)+0xDC00); + } + }); + + MML.xml = MML.mbase.Subclass({ + type: "xml", + Init: function () { + this.div = document.createElement("div"); + return this.SUPER(arguments).Init.apply(this,arguments); + }, + Append: function () { + for (var i = 0, m = arguments.length; i < m; i++) { + var node = this.Import(arguments[i]); + this.data.push(node); + this.div.appendChild(node); + } + }, + Import: function (node) { + if (document.importNode) {return document.importNode(node,true)} + // + // IE < 9 doesn't have importNode, so fake it. + // + var nNode, i, m; + if (node.nodeType === 1) { // ELEMENT_NODE + nNode = document.createElement(node.nodeName); + for (i = 0, m = node.attributes.length; i < m; i++) { + var attribute = node.attributes[i]; + if (attribute.specified && attribute.nodeValue != null && attribute.nodeValue != '') + {nNode.setAttribute(attribute.nodeName,attribute.nodeValue)} + if (attribute.nodeName === "style") {nNode.style.cssText = attribute.nodeValue} + } + if (node.className) {nNode.className = node.className} + } else if (node.nodeType === 3 || node.nodeType === 4) { // TEXT_NODE or CDATA_SECTION_NODE + nNode = document.createTextNode(node.nodeValue); + } else if (node.nodeType === 8) { // COMMENT_NODE + nNode = document.createComment(node.nodeValue); + } else { + return document.createTextNode(''); + } + for (i = 0, m = node.childNodes.length; i < m; i++) + {nNode.appendChild(this.Import(node.childNodes[i]))} + return nNode; + }, + value: function () {return this.div}, + toString: function () {return this.div.innerHTML} + }); + + MML.TeXAtom = MML.mbase.Subclass({ + type: "texatom", + linebreakContainer: true, + inferRow: true, notParent: true, + texClass: MML.TEXCLASS.ORD, + Core: MML.mbase.childCore, + CoreMO: MML.mbase.childCoreMO, + isEmbellished: MML.mbase.childEmbellished, + setTeXclass: function (prev) { + this.data[0].setTeXclass(); + return this.adjustTeXclass(prev); + }, + adjustTeXclass: MML.mo.prototype.adjustTeXclass + }); + + MML.NULL = MML.mbase().With({type:"null"}); + + var TEXCLASS = MML.TEXCLASS; + + var MO = { + ORD: [0,0,TEXCLASS.ORD], + ORD11: [1,1,TEXCLASS.ORD], + ORD21: [2,1,TEXCLASS.ORD], + ORD02: [0,2,TEXCLASS.ORD], + ORD55: [5,5,TEXCLASS.ORD], + OP: [1,2,TEXCLASS.OP,{largeop: true, movablelimits: true, symmetric: true}], + OPFIXED: [1,2,TEXCLASS.OP,{largeop: true, movablelimits: true}], + INTEGRAL: [0,1,TEXCLASS.OP,{largeop: true, symmetric: true}], + INTEGRAL2: [1,2,TEXCLASS.OP,{largeop: true, symmetric: true}], + BIN3: [3,3,TEXCLASS.BIN], + BIN4: [4,4,TEXCLASS.BIN], + BIN01: [0,1,TEXCLASS.BIN], + BIN5: [5,5,TEXCLASS.BIN], + TALLBIN: [4,4,TEXCLASS.BIN,{stretchy: true}], + BINOP: [4,4,TEXCLASS.BIN,{largeop: true, movablelimits: true}], + REL: [5,5,TEXCLASS.REL], + REL1: [1,1,TEXCLASS.REL,{stretchy: true}], + REL4: [4,4,TEXCLASS.REL], + RELSTRETCH: [5,5,TEXCLASS.REL,{stretchy: true}], + RELACCENT: [5,5,TEXCLASS.REL,{accent: true}], + WIDEREL: [5,5,TEXCLASS.REL,{accent: true, stretchy: true}], + OPEN: [0,0,TEXCLASS.OPEN,{fence: true, stretchy: true, symmetric: true}], + CLOSE: [0,0,TEXCLASS.CLOSE,{fence: true, stretchy: true, symmetric: true}], + INNER: [0,0,TEXCLASS.INNER], + PUNCT: [0,3,TEXCLASS.PUNCT], + ACCENT: [0,0,TEXCLASS.ORD,{accent: true}], + WIDEACCENT: [0,0,TEXCLASS.ORD,{accent: true, stretchy: true}] + }; + + MML.mo.Augment({ + SPACE: [ + '0em', + '0.1111em', + '0.1667em', + '0.2222em', + '0.2667em', + '0.3333em' + ], + RANGES: [ + [0x20,0x7F,TEXCLASS.REL,"BasicLatin"], + [0xA0,0xFF,TEXCLASS.ORD,"Latin1Supplement"], + [0x100,0x17F,TEXCLASS.ORD], + [0x180,0x24F,TEXCLASS.ORD], + [0x2B0,0x2FF,TEXCLASS.ORD,"SpacingModLetters"], + [0x300,0x36F,TEXCLASS.ORD,"CombDiacritMarks"], + [0x370,0x3FF,TEXCLASS.ORD,"GreekAndCoptic"], + [0x1E00,0x1EFF,TEXCLASS.ORD], + [0x2000,0x206F,TEXCLASS.PUNCT,"GeneralPunctuation"], + [0x2070,0x209F,TEXCLASS.ORD], + [0x20A0,0x20CF,TEXCLASS.ORD], + [0x20D0,0x20FF,TEXCLASS.ORD,"CombDiactForSymbols"], + [0x2100,0x214F,TEXCLASS.ORD,"LetterlikeSymbols"], + [0x2150,0x218F,TEXCLASS.ORD], + [0x2190,0x21FF,TEXCLASS.REL,"Arrows"], + [0x2200,0x22FF,TEXCLASS.BIN,"MathOperators"], + [0x2300,0x23FF,TEXCLASS.ORD,"MiscTechnical"], + [0x2460,0x24FF,TEXCLASS.ORD], + [0x2500,0x259F,TEXCLASS.ORD], + [0x25A0,0x25FF,TEXCLASS.ORD,"GeometricShapes"], + [0x2700,0x27BF,TEXCLASS.ORD,"Dingbats"], + [0x27C0,0x27EF,TEXCLASS.ORD,"MiscMathSymbolsA"], + [0x27F0,0x27FF,TEXCLASS.REL,"SupplementalArrowsA"], + [0x2900,0x297F,TEXCLASS.REL,"SupplementalArrowsB"], + [0x2980,0x29FF,TEXCLASS.ORD,"MiscMathSymbolsB"], + [0x2A00,0x2AFF,TEXCLASS.BIN,"SuppMathOperators"], + [0x2B00,0x2BFF,TEXCLASS.ORD,"MiscSymbolsAndArrows"], + [0x1D400,0x1D7FF,TEXCLASS.ORD] + ], + OPTABLE: { + prefix: { + '\u2200': MO.ORD21, // for all + '\u2202': MO.ORD21, // partial differential + '\u2203': MO.ORD21, // there exists + '\u2207': MO.ORD21, // nabla + '\u220F': MO.OP, // n-ary product + '\u2210': MO.OP, // n-ary coproduct + '\u2211': MO.OP, // n-ary summation + '\u2212': MO.BIN01, // minus sign + '\u2213': MO.BIN01, // minus-or-plus sign + '\u221A': [1,1,TEXCLASS.ORD,{stretchy: true}], // square root + '\u2220': MO.ORD, // angle + '\u222B': MO.INTEGRAL, // integral + '\u222E': MO.INTEGRAL, // contour integral + '\u22C0': MO.OP, // n-ary logical and + '\u22C1': MO.OP, // n-ary logical or + '\u22C2': MO.OP, // n-ary intersection + '\u22C3': MO.OP, // n-ary union + '\u2308': MO.OPEN, // left ceiling + '\u230A': MO.OPEN, // left floor + '\u27E8': MO.OPEN, // mathematical left angle bracket + '\u27EE': MO.OPEN, // mathematical left flattened parenthesis + '\u2A00': MO.OP, // n-ary circled dot operator + '\u2A01': MO.OP, // n-ary circled plus operator + '\u2A02': MO.OP, // n-ary circled times operator + '\u2A04': MO.OP, // n-ary union operator with plus + '\u2A06': MO.OP, // n-ary square union operator + '\u00AC': MO.ORD21, // not sign + '\u00B1': MO.BIN01, // plus-minus sign + '(': MO.OPEN, // left parenthesis + '+': MO.BIN01, // plus sign + '-': MO.BIN01, // hyphen-minus + '[': MO.OPEN, // left square bracket + '{': MO.OPEN, // left curly bracket + '|': MO.OPEN // vertical line + }, + postfix: { + '!': [1,0,TEXCLASS.CLOSE], // exclamation mark + '&': MO.ORD, // ampersand + '\u2032': MO.ORD02, // prime + '\u203E': MO.WIDEACCENT, // overline + '\u2309': MO.CLOSE, // right ceiling + '\u230B': MO.CLOSE, // right floor + '\u23DE': MO.WIDEACCENT, // top curly bracket + '\u23DF': MO.WIDEACCENT, // bottom curly bracket + '\u266D': MO.ORD02, // music flat sign + '\u266E': MO.ORD02, // music natural sign + '\u266F': MO.ORD02, // music sharp sign + '\u27E9': MO.CLOSE, // mathematical right angle bracket + '\u27EF': MO.CLOSE, // mathematical right flattened parenthesis + '\u02C6': MO.WIDEACCENT, // modifier letter circumflex accent + '\u02C7': MO.WIDEACCENT, // caron + '\u02C9': MO.WIDEACCENT, // modifier letter macron + '\u02CA': MO.ACCENT, // modifier letter acute accent + '\u02CB': MO.ACCENT, // modifier letter grave accent + '\u02D8': MO.ACCENT, // breve + '\u02D9': MO.ACCENT, // dot above + '\u02DC': MO.WIDEACCENT, // small tilde + '\u0302': MO.WIDEACCENT, // combining circumflex accent + '\u00A8': MO.ACCENT, // diaeresis + '\u00AF': MO.WIDEACCENT, // macron + ')': MO.CLOSE, // right parenthesis + ']': MO.CLOSE, // right square bracket + '^': MO.WIDEACCENT, // circumflex accent + '_': MO.WIDEACCENT, // low line + '`': MO.ACCENT, // grave accent + '|': MO.CLOSE, // vertical line + '}': MO.CLOSE, // right curly bracket + '~': MO.WIDEACCENT // tilde + }, + infix: { + '': MO.ORD, // empty + '%': [3,3,TEXCLASS.ORD], // percent sign + '\u2022': MO.BIN4, // bullet + '\u2026': MO.INNER, // horizontal ellipsis + '\u2044': MO.TALLBIN, // fraction slash + '\u2061': MO.ORD, // function application + '\u2062': MO.ORD, // invisible times + '\u2063': [0,0,TEXCLASS.ORD,{linebreakstyle:"after", separator: true}], // invisible separator + '\u2064': MO.ORD, // invisible plus + '\u2190': MO.WIDEREL, // leftwards arrow + '\u2191': MO.RELSTRETCH, // upwards arrow + '\u2192': MO.WIDEREL, // rightwards arrow + '\u2193': MO.RELSTRETCH, // downwards arrow + '\u2194': MO.WIDEREL, // left right arrow + '\u2195': MO.RELSTRETCH, // up down arrow + '\u2196': MO.RELSTRETCH, // north west arrow + '\u2197': MO.RELSTRETCH, // north east arrow + '\u2198': MO.RELSTRETCH, // south east arrow + '\u2199': MO.RELSTRETCH, // south west arrow + '\u21A6': MO.WIDEREL, // rightwards arrow from bar + '\u21A9': MO.WIDEREL, // leftwards arrow with hook + '\u21AA': MO.WIDEREL, // rightwards arrow with hook + '\u21BC': MO.WIDEREL, // leftwards harpoon with barb upwards + '\u21BD': MO.WIDEREL, // leftwards harpoon with barb downwards + '\u21C0': MO.WIDEREL, // rightwards harpoon with barb upwards + '\u21C1': MO.WIDEREL, // rightwards harpoon with barb downwards + '\u21CC': MO.WIDEREL, // rightwards harpoon over leftwards harpoon + '\u21D0': MO.WIDEREL, // leftwards double arrow + '\u21D1': MO.RELSTRETCH, // upwards double arrow + '\u21D2': MO.WIDEREL, // rightwards double arrow + '\u21D3': MO.RELSTRETCH, // downwards double arrow + '\u21D4': MO.WIDEREL, // left right double arrow + '\u21D5': MO.RELSTRETCH, // up down double arrow + '\u2208': MO.REL, // element of + '\u2209': MO.REL, // not an element of + '\u220B': MO.REL, // contains as member + '\u2212': MO.BIN4, // minus sign + '\u2213': MO.BIN4, // minus-or-plus sign + '\u2215': MO.TALLBIN, // division slash + '\u2216': MO.BIN4, // set minus + '\u2217': MO.BIN4, // asterisk operator + '\u2218': MO.BIN4, // ring operator + '\u2219': MO.BIN4, // bullet operator + '\u221D': MO.REL, // proportional to + '\u2223': MO.REL, // divides + '\u2225': MO.REL, // parallel to + '\u2227': MO.BIN4, // logical and + '\u2228': MO.BIN4, // logical or + '\u2229': MO.BIN4, // intersection + '\u222A': MO.BIN4, // union + '\u223C': MO.REL, // tilde operator + '\u2240': MO.BIN4, // wreath product + '\u2243': MO.REL, // asymptotically equal to + '\u2245': MO.REL, // approximately equal to + '\u2248': MO.REL, // almost equal to + '\u224D': MO.REL, // equivalent to + '\u2250': MO.REL, // approaches the limit + '\u2260': MO.REL, // not equal to + '\u2261': MO.REL, // identical to + '\u2264': MO.REL, // less-than or equal to + '\u2265': MO.REL, // greater-than or equal to + '\u226A': MO.REL, // much less-than + '\u226B': MO.REL, // much greater-than + '\u227A': MO.REL, // precedes + '\u227B': MO.REL, // succeeds + '\u2282': MO.REL, // subset of + '\u2283': MO.REL, // superset of + '\u2286': MO.REL, // subset of or equal to + '\u2287': MO.REL, // superset of or equal to + '\u228E': MO.BIN4, // multiset union + '\u2291': MO.REL, // square image of or equal to + '\u2292': MO.REL, // square original of or equal to + '\u2293': MO.BIN4, // square cap + '\u2294': MO.BIN4, // square cup + '\u2295': MO.BIN4, // circled plus + '\u2296': MO.BIN4, // circled minus + '\u2297': MO.BIN4, // circled times + '\u2298': MO.BIN4, // circled division slash + '\u2299': MO.BIN4, // circled dot operator + '\u22A2': MO.REL, // right tack + '\u22A3': MO.REL, // left tack + '\u22A4': MO.ORD55, // down tack + '\u22A5': MO.REL, // up tack + '\u22A8': MO.REL, // true + '\u22C4': MO.BIN4, // diamond operator + '\u22C5': MO.BIN4, // dot operator + '\u22C6': MO.BIN4, // star operator + '\u22C8': MO.REL, // bowtie + '\u22EE': MO.ORD55, // vertical ellipsis + '\u22EF': MO.INNER, // midline horizontal ellipsis + '\u22F1': [5,5,TEXCLASS.INNER], // down right diagonal ellipsis + '\u25B3': MO.BIN4, // white up-pointing triangle + '\u25B5': MO.BIN4, // white up-pointing small triangle + '\u25B9': MO.BIN4, // white right-pointing small triangle + '\u25BD': MO.BIN4, // white down-pointing triangle + '\u25BF': MO.BIN4, // white down-pointing small triangle + '\u25C3': MO.BIN4, // white left-pointing small triangle + '\u2758': MO.REL, // light vertical bar + '\u27F5': MO.WIDEREL, // long leftwards arrow + '\u27F6': MO.WIDEREL, // long rightwards arrow + '\u27F7': MO.WIDEREL, // long left right arrow + '\u27F8': MO.WIDEREL, // long leftwards double arrow + '\u27F9': MO.WIDEREL, // long rightwards double arrow + '\u27FA': MO.WIDEREL, // long left right double arrow + '\u27FC': MO.WIDEREL, // long rightwards arrow from bar + '\u2A2F': MO.BIN4, // vector or cross product + '\u2A3F': MO.BIN4, // amalgamation or coproduct + '\u2AAF': MO.REL, // precedes above single-line equals sign + '\u2AB0': MO.REL, // succeeds above single-line equals sign + '\u00B1': MO.BIN4, // plus-minus sign + '\u00B7': MO.BIN4, // middle dot + '\u00D7': MO.BIN4, // multiplication sign + '\u00F7': MO.BIN4, // division sign + '*': MO.BIN3, // asterisk + '+': MO.BIN4, // plus sign + ',': [0,3,TEXCLASS.PUNCT,{linebreakstyle:"after", separator: true}], // comma + '-': MO.BIN4, // hyphen-minus + '.': [3,3,TEXCLASS.ORD], // full stop + '/': MO.ORD11, // solidus + ':': [1,2,TEXCLASS.REL], // colon + ';': [0,3,TEXCLASS.PUNCT,{linebreakstyle:"after", separator: true}], // semicolon + '<': MO.REL, // less-than sign + '=': MO.REL, // equals sign + '>': MO.REL, // greater-than sign + '?': [1,1,TEXCLASS.CLOSE], // question mark + '\\': MO.ORD, // reverse solidus + '^': MO.ORD11, // circumflex accent + '_': MO.ORD11, // low line + '|': [2,2,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}], // vertical line + '#': MO.ORD, // # + '$': MO.ORD, // $ + '\u002E': [0,3,TEXCLASS.PUNCT,{separator: true}], // \ldotp + '\u02B9': MO.ORD, // prime + '\u0300': MO.ACCENT, // \grave + '\u0301': MO.ACCENT, // \acute + '\u0303': MO.WIDEACCENT, // \tilde + '\u0304': MO.ACCENT, // \bar + '\u0306': MO.ACCENT, // \breve + '\u0307': MO.ACCENT, // \dot + '\u0308': MO.ACCENT, // \ddot + '\u030C': MO.ACCENT, // \check + '\u0332': MO.WIDEACCENT, // horizontal line + '\u0338': MO.REL4, // \not + '\u2015': [0,0,TEXCLASS.ORD,{stretchy: true}], // horizontal line + '\u2017': [0,0,TEXCLASS.ORD,{stretchy: true}], // horizontal line + '\u2020': MO.BIN3, // \dagger + '\u2021': MO.BIN3, // \ddagger + '\u20D7': MO.ACCENT, // \vec + '\u2111': MO.ORD, // \Im + '\u2113': MO.ORD, // \ell + '\u2118': MO.ORD, // \wp + '\u211C': MO.ORD, // \Re + '\u2205': MO.ORD, // \emptyset + '\u221E': MO.ORD, // \infty + '\u2305': MO.BIN3, // barwedge + '\u2306': MO.BIN3, // doublebarwedge + '\u2322': MO.REL4, // \frown + '\u2323': MO.REL4, // \smile + '\u2329': MO.OPEN, // langle + '\u232A': MO.CLOSE, // rangle + '\u23AA': MO.ORD, // \bracevert + '\u23AF': [0,0,TEXCLASS.ORD,{stretchy: true}], // \underline + '\u23B0': MO.OPEN, // \lmoustache + '\u23B1': MO.CLOSE, // \rmoustache + '\u2500': MO.ORD, // horizontal line + '\u25EF': MO.BIN3, // \bigcirc + '\u2660': MO.ORD, // \spadesuit + '\u2661': MO.ORD, // \heartsuit + '\u2662': MO.ORD, // \diamondsuit + '\u2663': MO.ORD, // \clubsuit + '\u3008': MO.OPEN, // langle + '\u3009': MO.CLOSE, // rangle + '\uFE37': MO.WIDEACCENT, // horizontal brace down + '\uFE38': MO.WIDEACCENT // horizontal brace up + } + } + },{ + OPTYPES: MO + }); + + // + // These are not in the W3C table, but FF works this way, + // and it makes sense, so add it here + // + var OPTABLE = MML.mo.prototype.OPTABLE; + OPTABLE.infix["^"] = MO.WIDEREL; + OPTABLE.infix["_"] = MO.WIDEREL; + OPTABLE.prefix["\u2223"] = MO.OPEN; + OPTABLE.prefix["\u2225"] = MO.OPEN; + OPTABLE.postfix["\u2223"] = MO.CLOSE; + OPTABLE.postfix["\u2225"] = MO.CLOSE; + +})(MathJax.ElementJax.mml); + +MathJax.ElementJax.mml.loadComplete("jax.js"); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/Arrows.js b/js/mathjax/jax/element/mml/optable/Arrows.js new file mode 100644 index 0000000..fd3bcf8 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/Arrows.js @@ -0,0 +1,124 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/Arrows.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u219A': MO.RELACCENT, // leftwards arrow with stroke + '\u219B': MO.RELACCENT, // rightwards arrow with stroke + '\u219C': MO.WIDEREL, // leftwards wave arrow + '\u219D': MO.WIDEREL, // rightwards wave arrow + '\u219E': MO.WIDEREL, // leftwards two headed arrow + '\u219F': MO.WIDEREL, // upwards two headed arrow + '\u21A0': MO.WIDEREL, // rightwards two headed arrow + '\u21A1': MO.RELSTRETCH, // downwards two headed arrow + '\u21A2': MO.WIDEREL, // leftwards arrow with tail + '\u21A3': MO.WIDEREL, // rightwards arrow with tail + '\u21A4': MO.WIDEREL, // leftwards arrow from bar + '\u21A5': MO.RELSTRETCH, // upwards arrow from bar + '\u21A7': MO.RELSTRETCH, // downwards arrow from bar + '\u21A8': MO.RELSTRETCH, // up down arrow with base + '\u21AB': MO.WIDEREL, // leftwards arrow with loop + '\u21AC': MO.WIDEREL, // rightwards arrow with loop + '\u21AD': MO.WIDEREL, // left right wave arrow + '\u21AE': MO.RELACCENT, // left right arrow with stroke + '\u21AF': MO.RELSTRETCH, // downwards zigzag arrow + '\u21B0': MO.RELSTRETCH, // upwards arrow with tip leftwards + '\u21B1': MO.RELSTRETCH, // upwards arrow with tip rightwards + '\u21B2': MO.RELSTRETCH, // downwards arrow with tip leftwards + '\u21B3': MO.RELSTRETCH, // downwards arrow with tip rightwards + '\u21B4': MO.RELSTRETCH, // rightwards arrow with corner downwards + '\u21B5': MO.RELSTRETCH, // downwards arrow with corner leftwards + '\u21B6': MO.RELACCENT, // anticlockwise top semicircle arrow + '\u21B7': MO.RELACCENT, // clockwise top semicircle arrow + '\u21B8': MO.REL, // north west arrow to long bar + '\u21B9': MO.WIDEREL, // leftwards arrow to bar over rightwards arrow to bar + '\u21BA': MO.REL, // anticlockwise open circle arrow + '\u21BB': MO.REL, // clockwise open circle arrow + '\u21BE': MO.RELSTRETCH, // upwards harpoon with barb rightwards + '\u21BF': MO.RELSTRETCH, // upwards harpoon with barb leftwards + '\u21C2': MO.RELSTRETCH, // downwards harpoon with barb rightwards + '\u21C3': MO.RELSTRETCH, // downwards harpoon with barb leftwards + '\u21C4': MO.WIDEREL, // rightwards arrow over leftwards arrow + '\u21C5': MO.RELSTRETCH, // upwards arrow leftwards of downwards arrow + '\u21C6': MO.WIDEREL, // leftwards arrow over rightwards arrow + '\u21C7': MO.WIDEREL, // leftwards paired arrows + '\u21C8': MO.RELSTRETCH, // upwards paired arrows + '\u21C9': MO.WIDEREL, // rightwards paired arrows + '\u21CA': MO.RELSTRETCH, // downwards paired arrows + '\u21CB': MO.WIDEREL, // leftwards harpoon over rightwards harpoon + '\u21CD': MO.RELACCENT, // leftwards double arrow with stroke + '\u21CE': MO.RELACCENT, // left right double arrow with stroke + '\u21CF': MO.RELACCENT, // rightwards double arrow with stroke + '\u21D6': MO.RELSTRETCH, // north west double arrow + '\u21D7': MO.RELSTRETCH, // north east double arrow + '\u21D8': MO.RELSTRETCH, // south east double arrow + '\u21D9': MO.RELSTRETCH, // south west double arrow + '\u21DA': MO.WIDEREL, // leftwards triple arrow + '\u21DB': MO.WIDEREL, // rightwards triple arrow + '\u21DC': MO.WIDEREL, // leftwards squiggle arrow + '\u21DD': MO.WIDEREL, // rightwards squiggle arrow + '\u21DE': MO.REL, // upwards arrow with double stroke + '\u21DF': MO.REL, // downwards arrow with double stroke + '\u21E0': MO.WIDEREL, // leftwards dashed arrow + '\u21E1': MO.RELSTRETCH, // upwards dashed arrow + '\u21E2': MO.WIDEREL, // rightwards dashed arrow + '\u21E3': MO.RELSTRETCH, // downwards dashed arrow + '\u21E4': MO.WIDEREL, // leftwards arrow to bar + '\u21E5': MO.WIDEREL, // rightwards arrow to bar + '\u21E6': MO.WIDEREL, // leftwards white arrow + '\u21E7': MO.RELSTRETCH, // upwards white arrow + '\u21E8': MO.WIDEREL, // rightwards white arrow + '\u21E9': MO.RELSTRETCH, // downwards white arrow + '\u21EA': MO.RELSTRETCH, // upwards white arrow from bar + '\u21EB': MO.RELSTRETCH, // upwards white arrow on pedestal + '\u21EC': MO.RELSTRETCH, // upwards white arrow on pedestal with horizontal bar + '\u21ED': MO.RELSTRETCH, // upwards white arrow on pedestal with vertical bar + '\u21EE': MO.RELSTRETCH, // upwards white double arrow + '\u21EF': MO.RELSTRETCH, // upwards white double arrow on pedestal + '\u21F0': MO.WIDEREL, // rightwards white arrow from wall + '\u21F1': MO.REL, // north west arrow to corner + '\u21F2': MO.REL, // south east arrow to corner + '\u21F3': MO.RELSTRETCH, // up down white arrow + '\u21F4': MO.RELACCENT, // right arrow with small circle + '\u21F5': MO.RELSTRETCH, // downwards arrow leftwards of upwards arrow + '\u21F6': MO.WIDEREL, // three rightwards arrows + '\u21F7': MO.RELACCENT, // leftwards arrow with vertical stroke + '\u21F8': MO.RELACCENT, // rightwards arrow with vertical stroke + '\u21F9': MO.RELACCENT, // left right arrow with vertical stroke + '\u21FA': MO.RELACCENT, // leftwards arrow with double vertical stroke + '\u21FB': MO.RELACCENT, // rightwards arrow with double vertical stroke + '\u21FC': MO.RELACCENT, // left right arrow with double vertical stroke + '\u21FD': MO.WIDEREL, // leftwards open-headed arrow + '\u21FE': MO.WIDEREL, // rightwards open-headed arrow + '\u21FF': MO.WIDEREL // left right open-headed arrow + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/Arrows.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/BasicLatin.js b/js/mathjax/jax/element/mml/optable/BasicLatin.js new file mode 100644 index 0000000..c36b4ed --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/BasicLatin.js @@ -0,0 +1,67 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/BasicLatin.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '||': [0,0,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: || + '|||': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: ||| + }, + postfix: { + '!!': [1,0,TEXCLASS.BIN], // multiple character operator: !! + '\'': MO.ACCENT, // apostrophe + '++': [0,0,TEXCLASS.BIN], // multiple character operator: ++ + '--': [0,0,TEXCLASS.BIN], // multiple character operator: -- + '..': [0,0,TEXCLASS.BIN], // multiple character operator: .. + '...': MO.ORD, // multiple character operator: ... + '||': [0,0,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: || + '|||': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: ||| + }, + infix: { + '!=': MO.BIN4, // multiple character operator: != + '&&': MO.BIN4, // multiple character operator: && + '**': [1,1,TEXCLASS.BIN], // multiple character operator: ** + '*=': MO.BIN4, // multiple character operator: *= + '+=': MO.BIN4, // multiple character operator: += + '-=': MO.BIN4, // multiple character operator: -= + '->': MO.BIN5, // multiple character operator: -> + '//': [1,1,TEXCLASS.BIN], // multiple character operator: // + '/=': MO.BIN4, // multiple character operator: /= + ':=': MO.BIN4, // multiple character operator: := + '<=': MO.BIN5, // multiple character operator: <= + '<>': [1,1,TEXCLASS.BIN], // multiple character operator: <> + '==': MO.BIN4, // multiple character operator: == + '>=': MO.BIN5, // multiple character operator: >= + '@': MO.ORD11, // commercial at + '||': [2,2,TEXCLASS.BIN,{fence: true, stretchy: true, symmetric: true}], // multiple character operator: || + '|||': [2,2,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}] // multiple character operator: ||| + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/BasicLatin.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/CombDiacritMarks.js b/js/mathjax/jax/element/mml/optable/CombDiacritMarks.js new file mode 100644 index 0000000..b275086 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/CombDiacritMarks.js @@ -0,0 +1,37 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/CombDiacritMarks.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + postfix: { + '\u0311': MO.ACCENT // combining inverted breve + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/CombDiacritMarks.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/CombDiactForSymbols.js b/js/mathjax/jax/element/mml/optable/CombDiactForSymbols.js new file mode 100644 index 0000000..0ac97ab --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/CombDiactForSymbols.js @@ -0,0 +1,38 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/CombDiactForSymbols.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + postfix: { + '\u20DB': MO.ACCENT, // combining three dots above + '\u20DC': MO.ACCENT // combining four dots above + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/CombDiactForSymbols.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/Dingbats.js b/js/mathjax/jax/element/mml/optable/Dingbats.js new file mode 100644 index 0000000..24d5275 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/Dingbats.js @@ -0,0 +1,40 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/Dingbats.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2772': MO.OPEN // light left tortoise shell bracket ornament + }, + postfix: { + '\u2773': MO.CLOSE // light right tortoise shell bracket ornament + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/Dingbats.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/GeneralPunctuation.js b/js/mathjax/jax/element/mml/optable/GeneralPunctuation.js new file mode 100644 index 0000000..a1019ca --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/GeneralPunctuation.js @@ -0,0 +1,44 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/GeneralPunctuation.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2016': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // double vertical line + '\u2018': [0,0,TEXCLASS.OPEN,{fence: true}], // left single quotation mark + '\u201C': [0,0,TEXCLASS.OPEN,{fence: true}] // left double quotation mark + }, + postfix: { + '\u2016': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // double vertical line + '\u2019': [0,0,TEXCLASS.CLOSE,{fence: true}], // right single quotation mark + '\u201D': [0,0,TEXCLASS.CLOSE,{fence: true}] // right double quotation mark + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/GeneralPunctuation.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/GeometricShapes.js b/js/mathjax/jax/element/mml/optable/GeometricShapes.js new file mode 100644 index 0000000..2414595 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/GeometricShapes.js @@ -0,0 +1,68 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/GeometricShapes.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u25A0': MO.BIN3, // black square + '\u25A1': MO.BIN3, // white square + '\u25AA': MO.BIN3, // black small square + '\u25AB': MO.BIN3, // white small square + '\u25AD': MO.BIN3, // white rectangle + '\u25AE': MO.BIN3, // black vertical rectangle + '\u25AF': MO.BIN3, // white vertical rectangle + '\u25B0': MO.BIN3, // black parallelogram + '\u25B1': MO.BIN3, // white parallelogram + '\u25B2': MO.BIN4, // black up-pointing triangle + '\u25B4': MO.BIN4, // black up-pointing small triangle + '\u25B6': MO.BIN4, // black right-pointing triangle + '\u25B7': MO.BIN4, // white right-pointing triangle + '\u25B8': MO.BIN4, // black right-pointing small triangle + '\u25BC': MO.BIN4, // black down-pointing triangle + '\u25BE': MO.BIN4, // black down-pointing small triangle + '\u25C0': MO.BIN4, // black left-pointing triangle + '\u25C1': MO.BIN4, // white left-pointing triangle + '\u25C2': MO.BIN4, // black left-pointing small triangle + '\u25C4': MO.BIN4, // black left-pointing pointer + '\u25C5': MO.BIN4, // white left-pointing pointer + '\u25C6': MO.BIN4, // black diamond + '\u25C7': MO.BIN4, // white diamond + '\u25C8': MO.BIN4, // white diamond containing black small diamond + '\u25C9': MO.BIN4, // fisheye + '\u25CC': MO.BIN4, // dotted circle + '\u25CD': MO.BIN4, // circle with vertical fill + '\u25CE': MO.BIN4, // bullseye + '\u25CF': MO.BIN4, // black circle + '\u25D6': MO.BIN4, // left half black circle + '\u25D7': MO.BIN4, // right half black circle + '\u25E6': MO.BIN4 // white bullet + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/GeometricShapes.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/GreekAndCoptic.js b/js/mathjax/jax/element/mml/optable/GreekAndCoptic.js new file mode 100644 index 0000000..fbc9850 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/GreekAndCoptic.js @@ -0,0 +1,37 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/GreekAndCoptic.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u03F6': MO.REL // greek reversed lunate epsilon symbol + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/GreekAndCoptic.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/Latin1Supplement.js b/js/mathjax/jax/element/mml/optable/Latin1Supplement.js new file mode 100644 index 0000000..5c34ba0 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/Latin1Supplement.js @@ -0,0 +1,39 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/Latin1Supplement.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + postfix: { + '\u00B0': MO.ORD, // degree sign + '\u00B4': MO.ACCENT, // acute accent + '\u00B8': MO.ACCENT // cedilla + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/Latin1Supplement.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/LetterlikeSymbols.js b/js/mathjax/jax/element/mml/optable/LetterlikeSymbols.js new file mode 100644 index 0000000..a6a0ed7 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/LetterlikeSymbols.js @@ -0,0 +1,38 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/LetterlikeSymbols.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2145': MO.ORD21, // double-struck italic capital d + '\u2146': [2,0,TEXCLASS.ORD] // double-struck italic small d + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/LetterlikeSymbols.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/MathOperators.js b/js/mathjax/jax/element/mml/optable/MathOperators.js new file mode 100644 index 0000000..dd879b0 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/MathOperators.js @@ -0,0 +1,230 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/MathOperators.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2204': MO.ORD21, // there does not exist + '\u221B': MO.ORD11, // cube root + '\u221C': MO.ORD11, // fourth root + '\u2221': MO.ORD, // measured angle + '\u2222': MO.ORD, // spherical angle + '\u222C': MO.INTEGRAL, // double integral + '\u222D': MO.INTEGRAL, // triple integral + '\u222F': MO.INTEGRAL, // surface integral + '\u2230': MO.INTEGRAL, // volume integral + '\u2231': MO.INTEGRAL, // clockwise integral + '\u2232': MO.INTEGRAL, // clockwise contour integral + '\u2233': MO.INTEGRAL // anticlockwise contour integral + }, + infix: { + '\u2201': [1,2,TEXCLASS.ORD], // complement + '\u2206': MO.BIN3, // increment + '\u220A': MO.REL, // small element of + '\u220C': MO.REL, // does not contain as member + '\u220D': MO.REL, // small contains as member + '\u220E': MO.BIN3, // end of proof + '\u2214': MO.BIN4, // dot plus + '\u221F': MO.REL, // right angle + '\u2224': MO.REL, // does not divide + '\u2226': MO.REL, // not parallel to + '\u2234': MO.REL, // therefore + '\u2235': MO.REL, // because + '\u2236': MO.REL, // ratio + '\u2237': MO.REL, // proportion + '\u2238': MO.BIN4, // dot minus + '\u2239': MO.REL, // excess + '\u223A': MO.BIN4, // geometric proportion + '\u223B': MO.REL, // homothetic + '\u223D': MO.REL, // reversed tilde + '\u223D\u0331': MO.BIN3, // reversed tilde with underline + '\u223E': MO.REL, // inverted lazy s + '\u223F': MO.BIN3, // sine wave + '\u2241': MO.REL, // not tilde + '\u2242': MO.REL, // minus tilde + '\u2242\u0338': MO.REL, // minus tilde with slash + '\u2244': MO.REL, // not asymptotically equal to + '\u2246': MO.REL, // approximately but not actually equal to + '\u2247': MO.REL, // neither approximately nor actually equal to + '\u2249': MO.REL, // not almost equal to + '\u224A': MO.REL, // almost equal or equal to + '\u224B': MO.REL, // triple tilde + '\u224C': MO.REL, // all equal to + '\u224E': MO.REL, // geometrically equivalent to + '\u224E\u0338': MO.REL, // geometrically equivalent to with slash + '\u224F': MO.REL, // difference between + '\u224F\u0338': MO.REL, // difference between with slash + '\u2251': MO.REL, // geometrically equal to + '\u2252': MO.REL, // approximately equal to or the image of + '\u2253': MO.REL, // image of or approximately equal to + '\u2254': MO.REL, // colon equals + '\u2255': MO.REL, // equals colon + '\u2256': MO.REL, // ring in equal to + '\u2257': MO.REL, // ring equal to + '\u2258': MO.REL, // corresponds to + '\u2259': MO.REL, // estimates + '\u225A': MO.REL, // equiangular to + '\u225C': MO.REL, // delta equal to + '\u225D': MO.REL, // equal to by definition + '\u225E': MO.REL, // measured by + '\u225F': MO.REL, // questioned equal to + '\u2262': MO.REL, // not identical to + '\u2263': MO.REL, // strictly equivalent to + '\u2266': MO.REL, // less-than over equal to + '\u2266\u0338': MO.REL, // less-than over equal to with slash + '\u2267': MO.REL, // greater-than over equal to + '\u2268': MO.REL, // less-than but not equal to + '\u2269': MO.REL, // greater-than but not equal to + '\u226A\u0338': MO.REL, // much less than with slash + '\u226B\u0338': MO.REL, // much greater than with slash + '\u226C': MO.REL, // between + '\u226D': MO.REL, // not equivalent to + '\u226E': MO.REL, // not less-than + '\u226F': MO.REL, // not greater-than + '\u2270': MO.REL, // neither less-than nor equal to + '\u2271': MO.REL, // neither greater-than nor equal to + '\u2272': MO.REL, // less-than or equivalent to + '\u2273': MO.REL, // greater-than or equivalent to + '\u2274': MO.REL, // neither less-than nor equivalent to + '\u2275': MO.REL, // neither greater-than nor equivalent to + '\u2276': MO.REL, // less-than or greater-than + '\u2277': MO.REL, // greater-than or less-than + '\u2278': MO.REL, // neither less-than nor greater-than + '\u2279': MO.REL, // neither greater-than nor less-than + '\u227C': MO.REL, // precedes or equal to + '\u227D': MO.REL, // succeeds or equal to + '\u227E': MO.REL, // precedes or equivalent to + '\u227F': MO.REL, // succeeds or equivalent to + '\u227F\u0338': MO.REL, // succeeds or equivalent to with slash + '\u2280': MO.REL, // does not precede + '\u2281': MO.REL, // does not succeed + '\u2282\u20D2': MO.REL, // subset of with vertical line + '\u2283\u20D2': MO.REL, // superset of with vertical line + '\u2284': MO.REL, // not a subset of + '\u2285': MO.REL, // not a superset of + '\u2288': MO.REL, // neither a subset of nor equal to + '\u2289': MO.REL, // neither a superset of nor equal to + '\u228A': MO.REL, // subset of with not equal to + '\u228B': MO.REL, // superset of with not equal to + '\u228C': MO.BIN4, // multiset + '\u228D': MO.BIN4, // multiset multiplication + '\u228F': MO.REL, // square image of + '\u228F\u0338': MO.REL, // square image of with slash + '\u2290': MO.REL, // square original of + '\u2290\u0338': MO.REL, // square original of with slash + '\u229A': MO.BIN4, // circled ring operator + '\u229B': MO.BIN4, // circled asterisk operator + '\u229C': MO.BIN4, // circled equals + '\u229D': MO.BIN4, // circled dash + '\u229E': MO.BIN4, // squared plus + '\u229F': MO.BIN4, // squared minus + '\u22A0': MO.BIN4, // squared times + '\u22A1': MO.BIN4, // squared dot operator + '\u22A6': MO.REL, // assertion + '\u22A7': MO.REL, // models + '\u22A9': MO.REL, // forces + '\u22AA': MO.REL, // triple vertical bar right turnstile + '\u22AB': MO.REL, // double vertical bar double right turnstile + '\u22AC': MO.REL, // does not prove + '\u22AD': MO.REL, // not true + '\u22AE': MO.REL, // does not force + '\u22AF': MO.REL, // negated double vertical bar double right turnstile + '\u22B0': MO.REL, // precedes under relation + '\u22B1': MO.REL, // succeeds under relation + '\u22B2': MO.REL, // normal subgroup of + '\u22B3': MO.REL, // contains as normal subgroup + '\u22B4': MO.REL, // normal subgroup of or equal to + '\u22B5': MO.REL, // contains as normal subgroup or equal to + '\u22B6': MO.REL, // original of + '\u22B7': MO.REL, // image of + '\u22B8': MO.REL, // multimap + '\u22B9': MO.REL, // hermitian conjugate matrix + '\u22BA': MO.BIN4, // intercalate + '\u22BB': MO.BIN4, // xor + '\u22BC': MO.BIN4, // nand + '\u22BD': MO.BIN4, // nor + '\u22BE': MO.BIN3, // right angle with arc + '\u22BF': MO.BIN3, // right triangle + '\u22C7': MO.BIN4, // division times + '\u22C9': MO.BIN4, // left normal factor semidirect product + '\u22CA': MO.BIN4, // right normal factor semidirect product + '\u22CB': MO.BIN4, // left semidirect product + '\u22CC': MO.BIN4, // right semidirect product + '\u22CD': MO.REL, // reversed tilde equals + '\u22CE': MO.BIN4, // curly logical or + '\u22CF': MO.BIN4, // curly logical and + '\u22D0': MO.REL, // double subset + '\u22D1': MO.REL, // double superset + '\u22D2': MO.BIN4, // double intersection + '\u22D3': MO.BIN4, // double union + '\u22D4': MO.REL, // pitchfork + '\u22D5': MO.REL, // equal and parallel to + '\u22D6': MO.REL, // less-than with dot + '\u22D7': MO.REL, // greater-than with dot + '\u22D8': MO.REL, // very much less-than + '\u22D9': MO.REL, // very much greater-than + '\u22DA': MO.REL, // less-than equal to or greater-than + '\u22DB': MO.REL, // greater-than equal to or less-than + '\u22DC': MO.REL, // equal to or less-than + '\u22DD': MO.REL, // equal to or greater-than + '\u22DE': MO.REL, // equal to or precedes + '\u22DF': MO.REL, // equal to or succeeds + '\u22E0': MO.REL, // does not precede or equal + '\u22E1': MO.REL, // does not succeed or equal + '\u22E2': MO.REL, // not square image of or equal to + '\u22E3': MO.REL, // not square original of or equal to + '\u22E4': MO.REL, // square image of or not equal to + '\u22E5': MO.REL, // square original of or not equal to + '\u22E6': MO.REL, // less-than but not equivalent to + '\u22E7': MO.REL, // greater-than but not equivalent to + '\u22E8': MO.REL, // precedes but not equivalent to + '\u22E9': MO.REL, // succeeds but not equivalent to + '\u22EA': MO.REL, // not normal subgroup of + '\u22EB': MO.REL, // does not contain as normal subgroup + '\u22EC': MO.REL, // not normal subgroup of or equal to + '\u22ED': MO.REL, // does not contain as normal subgroup or equal + '\u22F0': MO.REL, // up right diagonal ellipsis + '\u22F2': MO.REL, // element of with long horizontal stroke + '\u22F3': MO.REL, // element of with vertical bar at end of horizontal stroke + '\u22F4': MO.REL, // small element of with vertical bar at end of horizontal stroke + '\u22F5': MO.REL, // element of with dot above + '\u22F6': MO.REL, // element of with overbar + '\u22F7': MO.REL, // small element of with overbar + '\u22F8': MO.REL, // element of with underbar + '\u22F9': MO.REL, // element of with two horizontal strokes + '\u22FA': MO.REL, // contains with long horizontal stroke + '\u22FB': MO.REL, // contains with vertical bar at end of horizontal stroke + '\u22FC': MO.REL, // small contains with vertical bar at end of horizontal stroke + '\u22FD': MO.REL, // contains with overbar + '\u22FE': MO.REL, // small contains with overbar + '\u22FF': MO.REL // z notation bag membership + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/MathOperators.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js b/js/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js new file mode 100644 index 0000000..eba7ee1 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js @@ -0,0 +1,44 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/MiscMathSymbolsA.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u27E6': MO.OPEN, // mathematical left white square bracket + '\u27EA': MO.OPEN, // mathematical left double angle bracket + '\u27EC': MO.OPEN // mathematical left white tortoise shell bracket + }, + postfix: { + '\u27E7': MO.CLOSE, // mathematical right white square bracket + '\u27EB': MO.CLOSE, // mathematical right double angle bracket + '\u27ED': MO.CLOSE // mathematical right white tortoise shell bracket + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/MiscMathSymbolsA.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js b/js/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js new file mode 100644 index 0000000..975012d --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js @@ -0,0 +1,170 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/MiscMathSymbolsB.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2980': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // triple vertical bar delimiter + '\u2983': MO.OPEN, // left white curly bracket + '\u2985': MO.OPEN, // left white parenthesis + '\u2987': MO.OPEN, // z notation left image bracket + '\u2989': MO.OPEN, // z notation left binding bracket + '\u298B': MO.OPEN, // left square bracket with underbar + '\u298D': MO.OPEN, // left square bracket with tick in top corner + '\u298F': MO.OPEN, // left square bracket with tick in bottom corner + '\u2991': MO.OPEN, // left angle bracket with dot + '\u2993': MO.OPEN, // left arc less-than bracket + '\u2995': MO.OPEN, // double left arc greater-than bracket + '\u2997': MO.OPEN, // left black tortoise shell bracket + '\u29FC': MO.OPEN // left-pointing curved angle bracket + }, + postfix: { + '\u2980': [0,0,TEXCLASS.ORD,{fence: true, stretchy: true}], // triple vertical bar delimiter + '\u2984': MO.CLOSE, // right white curly bracket + '\u2986': MO.CLOSE, // right white parenthesis + '\u2988': MO.CLOSE, // z notation right image bracket + '\u298A': MO.CLOSE, // z notation right binding bracket + '\u298C': MO.CLOSE, // right square bracket with underbar + '\u298E': MO.CLOSE, // right square bracket with tick in bottom corner + '\u2990': MO.CLOSE, // right square bracket with tick in top corner + '\u2992': MO.CLOSE, // right angle bracket with dot + '\u2994': MO.CLOSE, // right arc greater-than bracket + '\u2996': MO.CLOSE, // double right arc less-than bracket + '\u2998': MO.CLOSE, // right black tortoise shell bracket + '\u29FD': MO.CLOSE // right-pointing curved angle bracket + }, + infix: { + '\u2981': MO.BIN3, // z notation spot + '\u2982': MO.BIN3, // z notation type colon + '\u2999': MO.BIN3, // dotted fence + '\u299A': MO.BIN3, // vertical zigzag line + '\u299B': MO.BIN3, // measured angle opening left + '\u299C': MO.BIN3, // right angle variant with square + '\u299D': MO.BIN3, // measured right angle with dot + '\u299E': MO.BIN3, // angle with s inside + '\u299F': MO.BIN3, // acute angle + '\u29A0': MO.BIN3, // spherical angle opening left + '\u29A1': MO.BIN3, // spherical angle opening up + '\u29A2': MO.BIN3, // turned angle + '\u29A3': MO.BIN3, // reversed angle + '\u29A4': MO.BIN3, // angle with underbar + '\u29A5': MO.BIN3, // reversed angle with underbar + '\u29A6': MO.BIN3, // oblique angle opening up + '\u29A7': MO.BIN3, // oblique angle opening down + '\u29A8': MO.BIN3, // measured angle with open arm ending in arrow pointing up and right + '\u29A9': MO.BIN3, // measured angle with open arm ending in arrow pointing up and left + '\u29AA': MO.BIN3, // measured angle with open arm ending in arrow pointing down and right + '\u29AB': MO.BIN3, // measured angle with open arm ending in arrow pointing down and left + '\u29AC': MO.BIN3, // measured angle with open arm ending in arrow pointing right and up + '\u29AD': MO.BIN3, // measured angle with open arm ending in arrow pointing left and up + '\u29AE': MO.BIN3, // measured angle with open arm ending in arrow pointing right and down + '\u29AF': MO.BIN3, // measured angle with open arm ending in arrow pointing left and down + '\u29B0': MO.BIN3, // reversed empty set + '\u29B1': MO.BIN3, // empty set with overbar + '\u29B2': MO.BIN3, // empty set with small circle above + '\u29B3': MO.BIN3, // empty set with right arrow above + '\u29B4': MO.BIN3, // empty set with left arrow above + '\u29B5': MO.BIN3, // circle with horizontal bar + '\u29B6': MO.BIN4, // circled vertical bar + '\u29B7': MO.BIN4, // circled parallel + '\u29B8': MO.BIN4, // circled reverse solidus + '\u29B9': MO.BIN4, // circled perpendicular + '\u29BA': MO.BIN4, // circle divided by horizontal bar and top half divided by vertical bar + '\u29BB': MO.BIN4, // circle with superimposed x + '\u29BC': MO.BIN4, // circled anticlockwise-rotated division sign + '\u29BD': MO.BIN4, // up arrow through circle + '\u29BE': MO.BIN4, // circled white bullet + '\u29BF': MO.BIN4, // circled bullet + '\u29C0': MO.REL, // circled less-than + '\u29C1': MO.REL, // circled greater-than + '\u29C2': MO.BIN3, // circle with small circle to the right + '\u29C3': MO.BIN3, // circle with two horizontal strokes to the right + '\u29C4': MO.BIN4, // squared rising diagonal slash + '\u29C5': MO.BIN4, // squared falling diagonal slash + '\u29C6': MO.BIN4, // squared asterisk + '\u29C7': MO.BIN4, // squared small circle + '\u29C8': MO.BIN4, // squared square + '\u29C9': MO.BIN3, // two joined squares + '\u29CA': MO.BIN3, // triangle with dot above + '\u29CB': MO.BIN3, // triangle with underbar + '\u29CC': MO.BIN3, // s in triangle + '\u29CD': MO.BIN3, // triangle with serifs at bottom + '\u29CE': MO.REL, // right triangle above left triangle + '\u29CF': MO.REL, // left triangle beside vertical bar + '\u29CF\u0338': MO.REL, // left triangle beside vertical bar with slash + '\u29D0': MO.REL, // vertical bar beside right triangle + '\u29D0\u0338': MO.REL, // vertical bar beside right triangle with slash + '\u29D1': MO.REL, // bowtie with left half black + '\u29D2': MO.REL, // bowtie with right half black + '\u29D3': MO.REL, // black bowtie + '\u29D4': MO.REL, // times with left half black + '\u29D5': MO.REL, // times with right half black + '\u29D6': MO.BIN4, // white hourglass + '\u29D7': MO.BIN4, // black hourglass + '\u29D8': MO.BIN3, // left wiggly fence + '\u29D9': MO.BIN3, // right wiggly fence + '\u29DB': MO.BIN3, // right double wiggly fence + '\u29DC': MO.BIN3, // incomplete infinity + '\u29DD': MO.BIN3, // tie over infinity + '\u29DE': MO.REL, // infinity negated with vertical bar + '\u29DF': MO.BIN3, // double-ended multimap + '\u29E0': MO.BIN3, // square with contoured outline + '\u29E1': MO.REL, // increases as + '\u29E2': MO.BIN4, // shuffle product + '\u29E3': MO.REL, // equals sign and slanted parallel + '\u29E4': MO.REL, // equals sign and slanted parallel with tilde above + '\u29E5': MO.REL, // identical to and slanted parallel + '\u29E6': MO.REL, // gleich stark + '\u29E7': MO.BIN3, // thermodynamic + '\u29E8': MO.BIN3, // down-pointing triangle with left half black + '\u29E9': MO.BIN3, // down-pointing triangle with right half black + '\u29EA': MO.BIN3, // black diamond with down arrow + '\u29EB': MO.BIN3, // black lozenge + '\u29EC': MO.BIN3, // white circle with down arrow + '\u29ED': MO.BIN3, // black circle with down arrow + '\u29EE': MO.BIN3, // error-barred white square + '\u29EF': MO.BIN3, // error-barred black square + '\u29F0': MO.BIN3, // error-barred white diamond + '\u29F1': MO.BIN3, // error-barred black diamond + '\u29F2': MO.BIN3, // error-barred white circle + '\u29F3': MO.BIN3, // error-barred black circle + '\u29F4': MO.REL, // rule-delayed + '\u29F5': MO.BIN4, // reverse solidus operator + '\u29F6': MO.BIN4, // solidus with overbar + '\u29F7': MO.BIN4, // reverse solidus with horizontal stroke + '\u29F8': MO.BIN3, // big solidus + '\u29F9': MO.BIN3, // big reverse solidus + '\u29FA': MO.BIN3, // double plus + '\u29FB': MO.BIN3, // triple plus + '\u29FE': MO.BIN4, // tiny + '\u29FF': MO.BIN4 // miny + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/MiscMathSymbolsB.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js b/js/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js new file mode 100644 index 0000000..d869d1d --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js @@ -0,0 +1,38 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/MiscSymbolsAndArrows.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u2B45': MO.RELSTRETCH, // leftwards quadruple arrow + '\u2B46': MO.RELSTRETCH // rightwards quadruple arrow + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/MiscSymbolsAndArrows.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/MiscTechnical.js b/js/mathjax/jax/element/mml/optable/MiscTechnical.js new file mode 100644 index 0000000..da38d70 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/MiscTechnical.js @@ -0,0 +1,42 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/MiscTechnical.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + postfix: { + '\u23B4': MO.WIDEACCENT, // top square bracket + '\u23B5': MO.WIDEACCENT, // bottom square bracket + '\u23DC': MO.WIDEACCENT, // top parenthesis + '\u23DD': MO.WIDEACCENT, // bottom parenthesis + '\u23E0': MO.WIDEACCENT, // top tortoise shell bracket + '\u23E1': MO.WIDEACCENT // bottom tortoise shell bracket + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/MiscTechnical.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/SpacingModLetters.js b/js/mathjax/jax/element/mml/optable/SpacingModLetters.js new file mode 100644 index 0000000..a6eaa41 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/SpacingModLetters.js @@ -0,0 +1,40 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/SpacingModLetters.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + postfix: { + '\u02CD': MO.WIDEACCENT, // modifier letter low macron + '\u02DA': MO.ACCENT, // ring above + '\u02DD': MO.ACCENT, // double acute accent + '\u02F7': MO.WIDEACCENT // modifier letter low tilde + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/SpacingModLetters.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/SuppMathOperators.js b/js/mathjax/jax/element/mml/optable/SuppMathOperators.js new file mode 100644 index 0000000..e281b1c --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/SuppMathOperators.js @@ -0,0 +1,291 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/SuppMathOperators.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + prefix: { + '\u2A03': MO.OP, // n-ary union operator with dot + '\u2A05': MO.OP, // n-ary square intersection operator + '\u2A07': MO.OP, // two logical and operator + '\u2A08': MO.OP, // two logical or operator + '\u2A09': MO.OP, // n-ary times operator + '\u2A0A': MO.OP, // modulo two sum + '\u2A0B': MO.INTEGRAL2, // summation with integral + '\u2A0C': MO.INTEGRAL, // quadruple integral operator + '\u2A0D': MO.INTEGRAL2, // finite part integral + '\u2A0E': MO.INTEGRAL2, // integral with double stroke + '\u2A0F': MO.INTEGRAL2, // integral average with slash + '\u2A10': MO.OP, // circulation function + '\u2A11': MO.OP, // anticlockwise integration + '\u2A12': MO.OP, // line integration with rectangular path around pole + '\u2A13': MO.OP, // line integration with semicircular path around pole + '\u2A14': MO.OP, // line integration not including the pole + '\u2A15': MO.INTEGRAL2, // integral around a point operator + '\u2A16': MO.INTEGRAL2, // quaternion integral operator + '\u2A17': MO.INTEGRAL2, // integral with leftwards arrow with hook + '\u2A18': MO.INTEGRAL2, // integral with times sign + '\u2A19': MO.INTEGRAL2, // integral with intersection + '\u2A1A': MO.INTEGRAL2, // integral with union + '\u2A1B': MO.INTEGRAL2, // integral with overbar + '\u2A1C': MO.INTEGRAL2, // integral with underbar + '\u2AFC': MO.OP, // large triple vertical bar operator + '\u2AFF': MO.OP // n-ary white vertical bar + }, + infix: { + '\u2A1D': MO.BIN3, // join + '\u2A1E': MO.BIN3, // large left triangle operator + '\u2A1F': MO.BIN3, // z notation schema composition + '\u2A20': MO.BIN3, // z notation schema piping + '\u2A21': MO.BIN3, // z notation schema projection + '\u2A22': MO.BIN4, // plus sign with small circle above + '\u2A23': MO.BIN4, // plus sign with circumflex accent above + '\u2A24': MO.BIN4, // plus sign with tilde above + '\u2A25': MO.BIN4, // plus sign with dot below + '\u2A26': MO.BIN4, // plus sign with tilde below + '\u2A27': MO.BIN4, // plus sign with subscript two + '\u2A28': MO.BIN4, // plus sign with black triangle + '\u2A29': MO.BIN4, // minus sign with comma above + '\u2A2A': MO.BIN4, // minus sign with dot below + '\u2A2B': MO.BIN4, // minus sign with falling dots + '\u2A2C': MO.BIN4, // minus sign with rising dots + '\u2A2D': MO.BIN4, // plus sign in left half circle + '\u2A2E': MO.BIN4, // plus sign in right half circle + '\u2A30': MO.BIN4, // multiplication sign with dot above + '\u2A31': MO.BIN4, // multiplication sign with underbar + '\u2A32': MO.BIN4, // semidirect product with bottom closed + '\u2A33': MO.BIN4, // smash product + '\u2A34': MO.BIN4, // multiplication sign in left half circle + '\u2A35': MO.BIN4, // multiplication sign in right half circle + '\u2A36': MO.BIN4, // circled multiplication sign with circumflex accent + '\u2A37': MO.BIN4, // multiplication sign in double circle + '\u2A38': MO.BIN4, // circled division sign + '\u2A39': MO.BIN4, // plus sign in triangle + '\u2A3A': MO.BIN4, // minus sign in triangle + '\u2A3B': MO.BIN4, // multiplication sign in triangle + '\u2A3C': MO.BIN4, // interior product + '\u2A3D': MO.BIN4, // righthand interior product + '\u2A3E': MO.BIN4, // z notation relational composition + '\u2A40': MO.BIN4, // intersection with dot + '\u2A41': MO.BIN4, // union with minus sign + '\u2A42': MO.BIN4, // union with overbar + '\u2A43': MO.BIN4, // intersection with overbar + '\u2A44': MO.BIN4, // intersection with logical and + '\u2A45': MO.BIN4, // union with logical or + '\u2A46': MO.BIN4, // union above intersection + '\u2A47': MO.BIN4, // intersection above union + '\u2A48': MO.BIN4, // union above bar above intersection + '\u2A49': MO.BIN4, // intersection above bar above union + '\u2A4A': MO.BIN4, // union beside and joined with union + '\u2A4B': MO.BIN4, // intersection beside and joined with intersection + '\u2A4C': MO.BIN4, // closed union with serifs + '\u2A4D': MO.BIN4, // closed intersection with serifs + '\u2A4E': MO.BIN4, // double square intersection + '\u2A4F': MO.BIN4, // double square union + '\u2A50': MO.BIN4, // closed union with serifs and smash product + '\u2A51': MO.BIN4, // logical and with dot above + '\u2A52': MO.BIN4, // logical or with dot above + '\u2A53': MO.BIN4, // double logical and + '\u2A54': MO.BIN4, // double logical or + '\u2A55': MO.BIN4, // two intersecting logical and + '\u2A56': MO.BIN4, // two intersecting logical or + '\u2A57': MO.BIN4, // sloping large or + '\u2A58': MO.BIN4, // sloping large and + '\u2A59': MO.REL, // logical or overlapping logical and + '\u2A5A': MO.BIN4, // logical and with middle stem + '\u2A5B': MO.BIN4, // logical or with middle stem + '\u2A5C': MO.BIN4, // logical and with horizontal dash + '\u2A5D': MO.BIN4, // logical or with horizontal dash + '\u2A5E': MO.BIN4, // logical and with double overbar + '\u2A5F': MO.BIN4, // logical and with underbar + '\u2A60': MO.BIN4, // logical and with double underbar + '\u2A61': MO.BIN4, // small vee with underbar + '\u2A62': MO.BIN4, // logical or with double overbar + '\u2A63': MO.BIN4, // logical or with double underbar + '\u2A64': MO.BIN4, // z notation domain antirestriction + '\u2A65': MO.BIN4, // z notation range antirestriction + '\u2A66': MO.REL, // equals sign with dot below + '\u2A67': MO.REL, // identical with dot above + '\u2A68': MO.REL, // triple horizontal bar with double vertical stroke + '\u2A69': MO.REL, // triple horizontal bar with triple vertical stroke + '\u2A6A': MO.REL, // tilde operator with dot above + '\u2A6B': MO.REL, // tilde operator with rising dots + '\u2A6C': MO.REL, // similar minus similar + '\u2A6D': MO.REL, // congruent with dot above + '\u2A6E': MO.REL, // equals with asterisk + '\u2A6F': MO.REL, // almost equal to with circumflex accent + '\u2A70': MO.REL, // approximately equal or equal to + '\u2A71': MO.BIN4, // equals sign above plus sign + '\u2A72': MO.BIN4, // plus sign above equals sign + '\u2A73': MO.REL, // equals sign above tilde operator + '\u2A74': MO.REL, // double colon equal + '\u2A75': MO.REL, // two consecutive equals signs + '\u2A76': MO.REL, // three consecutive equals signs + '\u2A77': MO.REL, // equals sign with two dots above and two dots below + '\u2A78': MO.REL, // equivalent with four dots above + '\u2A79': MO.REL, // less-than with circle inside + '\u2A7A': MO.REL, // greater-than with circle inside + '\u2A7B': MO.REL, // less-than with question mark above + '\u2A7C': MO.REL, // greater-than with question mark above + '\u2A7D': MO.REL, // less-than or slanted equal to + '\u2A7D\u0338': MO.REL, // less-than or slanted equal to with slash + '\u2A7E': MO.REL, // greater-than or slanted equal to + '\u2A7E\u0338': MO.REL, // greater-than or slanted equal to with slash + '\u2A7F': MO.REL, // less-than or slanted equal to with dot inside + '\u2A80': MO.REL, // greater-than or slanted equal to with dot inside + '\u2A81': MO.REL, // less-than or slanted equal to with dot above + '\u2A82': MO.REL, // greater-than or slanted equal to with dot above + '\u2A83': MO.REL, // less-than or slanted equal to with dot above right + '\u2A84': MO.REL, // greater-than or slanted equal to with dot above left + '\u2A85': MO.REL, // less-than or approximate + '\u2A86': MO.REL, // greater-than or approximate + '\u2A87': MO.REL, // less-than and single-line not equal to + '\u2A88': MO.REL, // greater-than and single-line not equal to + '\u2A89': MO.REL, // less-than and not approximate + '\u2A8A': MO.REL, // greater-than and not approximate + '\u2A8B': MO.REL, // less-than above double-line equal above greater-than + '\u2A8C': MO.REL, // greater-than above double-line equal above less-than + '\u2A8D': MO.REL, // less-than above similar or equal + '\u2A8E': MO.REL, // greater-than above similar or equal + '\u2A8F': MO.REL, // less-than above similar above greater-than + '\u2A90': MO.REL, // greater-than above similar above less-than + '\u2A91': MO.REL, // less-than above greater-than above double-line equal + '\u2A92': MO.REL, // greater-than above less-than above double-line equal + '\u2A93': MO.REL, // less-than above slanted equal above greater-than above slanted equal + '\u2A94': MO.REL, // greater-than above slanted equal above less-than above slanted equal + '\u2A95': MO.REL, // slanted equal to or less-than + '\u2A96': MO.REL, // slanted equal to or greater-than + '\u2A97': MO.REL, // slanted equal to or less-than with dot inside + '\u2A98': MO.REL, // slanted equal to or greater-than with dot inside + '\u2A99': MO.REL, // double-line equal to or less-than + '\u2A9A': MO.REL, // double-line equal to or greater-than + '\u2A9B': MO.REL, // double-line slanted equal to or less-than + '\u2A9C': MO.REL, // double-line slanted equal to or greater-than + '\u2A9D': MO.REL, // similar or less-than + '\u2A9E': MO.REL, // similar or greater-than + '\u2A9F': MO.REL, // similar above less-than above equals sign + '\u2AA0': MO.REL, // similar above greater-than above equals sign + '\u2AA1': MO.REL, // double nested less-than + '\u2AA1\u0338': MO.REL, // double nested less-than with slash + '\u2AA2': MO.REL, // double nested greater-than + '\u2AA2\u0338': MO.REL, // double nested greater-than with slash + '\u2AA3': MO.REL, // double nested less-than with underbar + '\u2AA4': MO.REL, // greater-than overlapping less-than + '\u2AA5': MO.REL, // greater-than beside less-than + '\u2AA6': MO.REL, // less-than closed by curve + '\u2AA7': MO.REL, // greater-than closed by curve + '\u2AA8': MO.REL, // less-than closed by curve above slanted equal + '\u2AA9': MO.REL, // greater-than closed by curve above slanted equal + '\u2AAA': MO.REL, // smaller than + '\u2AAB': MO.REL, // larger than + '\u2AAC': MO.REL, // smaller than or equal to + '\u2AAD': MO.REL, // larger than or equal to + '\u2AAE': MO.REL, // equals sign with bumpy above + '\u2AAF\u0338': MO.REL, // precedes above single-line equals sign with slash + '\u2AB0\u0338': MO.REL, // succeeds above single-line equals sign with slash + '\u2AB1': MO.REL, // precedes above single-line not equal to + '\u2AB2': MO.REL, // succeeds above single-line not equal to + '\u2AB3': MO.REL, // precedes above equals sign + '\u2AB4': MO.REL, // succeeds above equals sign + '\u2AB5': MO.REL, // precedes above not equal to + '\u2AB6': MO.REL, // succeeds above not equal to + '\u2AB7': MO.REL, // precedes above almost equal to + '\u2AB8': MO.REL, // succeeds above almost equal to + '\u2AB9': MO.REL, // precedes above not almost equal to + '\u2ABA': MO.REL, // succeeds above not almost equal to + '\u2ABB': MO.REL, // double precedes + '\u2ABC': MO.REL, // double succeeds + '\u2ABD': MO.REL, // subset with dot + '\u2ABE': MO.REL, // superset with dot + '\u2ABF': MO.REL, // subset with plus sign below + '\u2AC0': MO.REL, // superset with plus sign below + '\u2AC1': MO.REL, // subset with multiplication sign below + '\u2AC2': MO.REL, // superset with multiplication sign below + '\u2AC3': MO.REL, // subset of or equal to with dot above + '\u2AC4': MO.REL, // superset of or equal to with dot above + '\u2AC5': MO.REL, // subset of above equals sign + '\u2AC6': MO.REL, // superset of above equals sign + '\u2AC7': MO.REL, // subset of above tilde operator + '\u2AC8': MO.REL, // superset of above tilde operator + '\u2AC9': MO.REL, // subset of above almost equal to + '\u2ACA': MO.REL, // superset of above almost equal to + '\u2ACB': MO.REL, // subset of above not equal to + '\u2ACC': MO.REL, // superset of above not equal to + '\u2ACD': MO.REL, // square left open box operator + '\u2ACE': MO.REL, // square right open box operator + '\u2ACF': MO.REL, // closed subset + '\u2AD0': MO.REL, // closed superset + '\u2AD1': MO.REL, // closed subset or equal to + '\u2AD2': MO.REL, // closed superset or equal to + '\u2AD3': MO.REL, // subset above superset + '\u2AD4': MO.REL, // superset above subset + '\u2AD5': MO.REL, // subset above subset + '\u2AD6': MO.REL, // superset above superset + '\u2AD7': MO.REL, // superset beside subset + '\u2AD8': MO.REL, // superset beside and joined by dash with subset + '\u2AD9': MO.REL, // element of opening downwards + '\u2ADA': MO.REL, // pitchfork with tee top + '\u2ADB': MO.REL, // transversal intersection + '\u2ADC': MO.REL, // forking + '\u2ADD': MO.REL, // nonforking + '\u2ADE': MO.REL, // short left tack + '\u2ADF': MO.REL, // short down tack + '\u2AE0': MO.REL, // short up tack + '\u2AE1': MO.REL, // perpendicular with s + '\u2AE2': MO.REL, // vertical bar triple right turnstile + '\u2AE3': MO.REL, // double vertical bar left turnstile + '\u2AE4': MO.REL, // vertical bar double left turnstile + '\u2AE5': MO.REL, // double vertical bar double left turnstile + '\u2AE6': MO.REL, // long dash from left member of double vertical + '\u2AE7': MO.REL, // short down tack with overbar + '\u2AE8': MO.REL, // short up tack with underbar + '\u2AE9': MO.REL, // short up tack above short down tack + '\u2AEA': MO.REL, // double down tack + '\u2AEB': MO.REL, // double up tack + '\u2AEC': MO.REL, // double stroke not sign + '\u2AED': MO.REL, // reversed double stroke not sign + '\u2AEE': MO.REL, // does not divide with reversed negation slash + '\u2AEF': MO.REL, // vertical line with circle above + '\u2AF0': MO.REL, // vertical line with circle below + '\u2AF1': MO.REL, // down tack with circle below + '\u2AF2': MO.REL, // parallel with horizontal stroke + '\u2AF3': MO.REL, // parallel with tilde operator + '\u2AF4': MO.BIN4, // triple vertical bar binary relation + '\u2AF5': MO.BIN4, // triple vertical bar with horizontal stroke + '\u2AF6': MO.BIN4, // triple colon operator + '\u2AF7': MO.REL, // triple nested less-than + '\u2AF8': MO.REL, // triple nested greater-than + '\u2AF9': MO.REL, // double-line slanted less-than or equal to + '\u2AFA': MO.REL, // double-line slanted greater-than or equal to + '\u2AFB': MO.BIN4, // triple solidus binary relation + '\u2AFD': MO.BIN4, // double solidus operator + '\u2AFE': MO.BIN3 // white vertical bar + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/SuppMathOperators.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/SupplementalArrowsA.js b/js/mathjax/jax/element/mml/optable/SupplementalArrowsA.js new file mode 100644 index 0000000..081def5 --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/SupplementalArrowsA.js @@ -0,0 +1,42 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/SupplementalArrowsA.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u27F0': MO.RELSTRETCH, // upwards quadruple arrow + '\u27F1': MO.RELSTRETCH, // downwards quadruple arrow + '\u27FB': MO.WIDEREL, // long leftwards arrow from bar + '\u27FD': MO.WIDEREL, // long leftwards double arrow from bar + '\u27FE': MO.WIDEREL, // long rightwards double arrow from bar + '\u27FF': MO.WIDEREL // long rightwards squiggle arrow + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/SupplementalArrowsA.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/element/mml/optable/SupplementalArrowsB.js b/js/mathjax/jax/element/mml/optable/SupplementalArrowsB.js new file mode 100644 index 0000000..2c6b99e --- /dev/null +++ b/js/mathjax/jax/element/mml/optable/SupplementalArrowsB.js @@ -0,0 +1,164 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/optable/SupplementalArrowsB.js + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (MML) { + var MO = MML.mo.OPTYPES; + var TEXCLASS = MML.TEXCLASS; + + MathJax.Hub.Insert(MML.mo.prototype,{ + OPTABLE: { + infix: { + '\u2900': MO.RELACCENT, // rightwards two-headed arrow with vertical stroke + '\u2901': MO.RELACCENT, // rightwards two-headed arrow with double vertical stroke + '\u2902': MO.RELACCENT, // leftwards double arrow with vertical stroke + '\u2903': MO.RELACCENT, // rightwards double arrow with vertical stroke + '\u2904': MO.RELACCENT, // left right double arrow with vertical stroke + '\u2905': MO.RELACCENT, // rightwards two-headed arrow from bar + '\u2906': MO.RELACCENT, // leftwards double arrow from bar + '\u2907': MO.RELACCENT, // rightwards double arrow from bar + '\u2908': MO.REL, // downwards arrow with horizontal stroke + '\u2909': MO.REL, // upwards arrow with horizontal stroke + '\u290A': MO.RELSTRETCH, // upwards triple arrow + '\u290B': MO.RELSTRETCH, // downwards triple arrow + '\u290C': MO.WIDEREL, // leftwards double dash arrow + '\u290D': MO.WIDEREL, // rightwards double dash arrow + '\u290E': MO.WIDEREL, // leftwards triple dash arrow + '\u290F': MO.WIDEREL, // rightwards triple dash arrow + '\u2910': MO.WIDEREL, // rightwards two-headed triple dash arrow + '\u2911': MO.RELACCENT, // rightwards arrow with dotted stem + '\u2912': MO.RELSTRETCH, // upwards arrow to bar + '\u2913': MO.RELSTRETCH, // downwards arrow to bar + '\u2914': MO.RELACCENT, // rightwards arrow with tail with vertical stroke + '\u2915': MO.RELACCENT, // rightwards arrow with tail with double vertical stroke + '\u2916': MO.RELACCENT, // rightwards two-headed arrow with tail + '\u2917': MO.RELACCENT, // rightwards two-headed arrow with tail with vertical stroke + '\u2918': MO.RELACCENT, // rightwards two-headed arrow with tail with double vertical stroke + '\u2919': MO.RELACCENT, // leftwards arrow-tail + '\u291A': MO.RELACCENT, // rightwards arrow-tail + '\u291B': MO.RELACCENT, // leftwards double arrow-tail + '\u291C': MO.RELACCENT, // rightwards double arrow-tail + '\u291D': MO.RELACCENT, // leftwards arrow to black diamond + '\u291E': MO.RELACCENT, // rightwards arrow to black diamond + '\u291F': MO.RELACCENT, // leftwards arrow from bar to black diamond + '\u2920': MO.RELACCENT, // rightwards arrow from bar to black diamond + '\u2921': MO.RELSTRETCH, // north west and south east arrow + '\u2922': MO.RELSTRETCH, // north east and south west arrow + '\u2923': MO.REL, // north west arrow with hook + '\u2924': MO.REL, // north east arrow with hook + '\u2925': MO.REL, // south east arrow with hook + '\u2926': MO.REL, // south west arrow with hook + '\u2927': MO.REL, // north west arrow and north east arrow + '\u2928': MO.REL, // north east arrow and south east arrow + '\u2929': MO.REL, // south east arrow and south west arrow + '\u292A': MO.REL, // south west arrow and north west arrow + '\u292B': MO.REL, // rising diagonal crossing falling diagonal + '\u292C': MO.REL, // falling diagonal crossing rising diagonal + '\u292D': MO.REL, // south east arrow crossing north east arrow + '\u292E': MO.REL, // north east arrow crossing south east arrow + '\u292F': MO.REL, // falling diagonal crossing north east arrow + '\u2930': MO.REL, // rising diagonal crossing south east arrow + '\u2931': MO.REL, // north east arrow crossing north west arrow + '\u2932': MO.REL, // north west arrow crossing north east arrow + '\u2933': MO.RELACCENT, // wave arrow pointing directly right + '\u2934': MO.REL, // arrow pointing rightwards then curving upwards + '\u2935': MO.REL, // arrow pointing rightwards then curving downwards + '\u2936': MO.REL, // arrow pointing downwards then curving leftwards + '\u2937': MO.REL, // arrow pointing downwards then curving rightwards + '\u2938': MO.REL, // right-side arc clockwise arrow + '\u2939': MO.REL, // left-side arc anticlockwise arrow + '\u293A': MO.RELACCENT, // top arc anticlockwise arrow + '\u293B': MO.RELACCENT, // bottom arc anticlockwise arrow + '\u293C': MO.RELACCENT, // top arc clockwise arrow with minus + '\u293D': MO.RELACCENT, // top arc anticlockwise arrow with plus + '\u293E': MO.REL, // lower right semicircular clockwise arrow + '\u293F': MO.REL, // lower left semicircular anticlockwise arrow + '\u2940': MO.REL, // anticlockwise closed circle arrow + '\u2941': MO.REL, // clockwise closed circle arrow + '\u2942': MO.RELACCENT, // rightwards arrow above short leftwards arrow + '\u2943': MO.RELACCENT, // leftwards arrow above short rightwards arrow + '\u2944': MO.RELACCENT, // short rightwards arrow above leftwards arrow + '\u2945': MO.RELACCENT, // rightwards arrow with plus below + '\u2946': MO.RELACCENT, // leftwards arrow with plus below + '\u2947': MO.RELACCENT, // rightwards arrow through x + '\u2948': MO.RELACCENT, // left right arrow through small circle + '\u2949': MO.REL, // upwards two-headed arrow from small circle + '\u294A': MO.RELACCENT, // left barb up right barb down harpoon + '\u294B': MO.RELACCENT, // left barb down right barb up harpoon + '\u294C': MO.REL, // up barb right down barb left harpoon + '\u294D': MO.REL, // up barb left down barb right harpoon + '\u294E': MO.WIDEREL, // left barb up right barb up harpoon + '\u294F': MO.RELSTRETCH, // up barb right down barb right harpoon + '\u2950': MO.WIDEREL, // left barb down right barb down harpoon + '\u2951': MO.RELSTRETCH, // up barb left down barb left harpoon + '\u2952': MO.WIDEREL, // leftwards harpoon with barb up to bar + '\u2953': MO.WIDEREL, // rightwards harpoon with barb up to bar + '\u2954': MO.RELSTRETCH, // upwards harpoon with barb right to bar + '\u2955': MO.RELSTRETCH, // downwards harpoon with barb right to bar + '\u2956': MO.RELSTRETCH, // leftwards harpoon with barb down to bar + '\u2957': MO.RELSTRETCH, // rightwards harpoon with barb down to bar + '\u2958': MO.RELSTRETCH, // upwards harpoon with barb left to bar + '\u2959': MO.RELSTRETCH, // downwards harpoon with barb left to bar + '\u295A': MO.WIDEREL, // leftwards harpoon with barb up from bar + '\u295B': MO.WIDEREL, // rightwards harpoon with barb up from bar + '\u295C': MO.RELSTRETCH, // upwards harpoon with barb right from bar + '\u295D': MO.RELSTRETCH, // downwards harpoon with barb right from bar + '\u295E': MO.WIDEREL, // leftwards harpoon with barb down from bar + '\u295F': MO.WIDEREL, // rightwards harpoon with barb down from bar + '\u2960': MO.RELSTRETCH, // upwards harpoon with barb left from bar + '\u2961': MO.RELSTRETCH, // downwards harpoon with barb left from bar + '\u2962': MO.RELACCENT, // leftwards harpoon with barb up above leftwards harpoon with barb down + '\u2963': MO.REL, // upwards harpoon with barb left beside upwards harpoon with barb right + '\u2964': MO.RELACCENT, // rightwards harpoon with barb up above rightwards harpoon with barb down + '\u2965': MO.REL, // downwards harpoon with barb left beside downwards harpoon with barb right + '\u2966': MO.RELACCENT, // leftwards harpoon with barb up above rightwards harpoon with barb up + '\u2967': MO.RELACCENT, // leftwards harpoon with barb down above rightwards harpoon with barb down + '\u2968': MO.RELACCENT, // rightwards harpoon with barb up above leftwards harpoon with barb up + '\u2969': MO.RELACCENT, // rightwards harpoon with barb down above leftwards harpoon with barb down + '\u296A': MO.RELACCENT, // leftwards harpoon with barb up above long dash + '\u296B': MO.RELACCENT, // leftwards harpoon with barb down below long dash + '\u296C': MO.RELACCENT, // rightwards harpoon with barb up above long dash + '\u296D': MO.RELACCENT, // rightwards harpoon with barb down below long dash + '\u296E': MO.RELSTRETCH, // upwards harpoon with barb left beside downwards harpoon with barb right + '\u296F': MO.RELSTRETCH, // downwards harpoon with barb left beside upwards harpoon with barb right + '\u2970': MO.RELACCENT, // right double arrow with rounded head + '\u2971': MO.RELACCENT, // equals sign above rightwards arrow + '\u2972': MO.RELACCENT, // tilde operator above rightwards arrow + '\u2973': MO.RELACCENT, // leftwards arrow above tilde operator + '\u2974': MO.RELACCENT, // rightwards arrow above tilde operator + '\u2975': MO.RELACCENT, // rightwards arrow above almost equal to + '\u2976': MO.RELACCENT, // less-than above leftwards arrow + '\u2977': MO.RELACCENT, // leftwards arrow through less-than + '\u2978': MO.RELACCENT, // greater-than above rightwards arrow + '\u2979': MO.RELACCENT, // subset above rightwards arrow + '\u297A': MO.RELACCENT, // leftwards arrow through subset + '\u297B': MO.RELACCENT, // superset above leftwards arrow + '\u297C': MO.RELACCENT, // left fish tail + '\u297D': MO.RELACCENT, // right fish tail + '\u297E': MO.REL, // up fish tail + '\u297F': MO.REL // down fish tail + } + } + }); + + MathJax.Ajax.loadComplete(MML.optableDir+"/SupplementalArrowsB.js"); + +})(MathJax.ElementJax.mml); +// @license-end diff --git a/js/mathjax/jax/input/AsciiMath/config.js b/js/mathjax/jax/input/AsciiMath/config.js new file mode 100644 index 0000000..97f5369 --- /dev/null +++ b/js/mathjax/jax/input/AsciiMath/config.js @@ -0,0 +1,48 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/AsciiMath/config.js + * + * Initializes the AsciiMath InputJax (the main definition is in + * MathJax/jax/input/AsciiMath/jax.js, which is loaded when needed). + * + * Originally adapted for MathJax by David Lippman. + * Additional work done by Davide P. Cervone. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.InputJax.AsciiMath = MathJax.InputJax({ + id: "AsciiMath", + version: "2.7.9", + directory: MathJax.InputJax.directory + "/AsciiMath", + extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath", + + config: { + fixphi: true, // switch phi and varphi unicode values + useMathMLspacing: true, // use MathML spacing rather than TeX spacing? + displaystyle: true, // put limits above and below operators + decimalsign: "." // can change to "," but watch out for "(1,2)" + } +}); +MathJax.InputJax.AsciiMath.Register("math/asciimath"); + +MathJax.InputJax.AsciiMath.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/input/AsciiMath/jax.js b/js/mathjax/jax/input/AsciiMath/jax.js new file mode 100644 index 0000000..bad0cd8 --- /dev/null +++ b/js/mathjax/jax/input/AsciiMath/jax.js @@ -0,0 +1,1543 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/AsciiMath/jax.js + * + * An Input Jax for AsciiMath notation + * (see http://www1.chapman.edu/~jipsen/mathml/asciimath.html). + * + * Originally adapted for MathJax by David Lippman. + * Additional work done by Davide P. Cervone. + * + * The current development repository for AsciiMathML is + * https://github.com/mathjax/asciimathml + * + * A portion of this file is taken from + * ASCIIMathML.js Version 2.2 Mar 3, 2014, (c) Peter Jipsen http://www.chapman.edu/~jipsen + * and is used by permission of Peter Jipsen, who has agreed to allow us to + * release it under the Apache2 license (see below). That portion is indicated + * via comments. + * + * The remainder falls under the copyright that follows. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2012-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (ASCIIMATH) { + + var MML; // Filled in later + + // + // Make a documentFragment work-alike that uses MML objects + // rather than DOM objects. + // + var DOCFRAG = MathJax.Object.Subclass({ + firstChild: null, + lastChild: null, + Init: function () { + this.childNodes = []; + }, + appendChild: function (node) { + if (node.parent) {node.parent.removeChild(node)} + if (this.lastChild) {this.lastChild.nextSibling = node} + if (!this.firstChild) {this.firstChild = node} + this.childNodes.push(node); node.parent = this; + this.lastChild = node; + return node; + }, + removeChild: function (node) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === node) break} + if (i === m) return; + this.childNodes.splice(i,1); + if (node === this.firstChild) {this.firstChild = node.nextSibling} + if (node === this.lastChild) { + if (!this.childNodes.length) {this.lastChild = null} + else {this.lastChild = this.childNodes[this.childNodes.length-1]} + } + if (i) {this.childNodes[i-1].nextSibling = node.nextSibling} + node.nextSibling = node.parent = null; + return node; + }, + replaceChild: function (node,old) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === old) break} + if (i) {this.childNodes[i-1].nextSibling = node} else {this.firstChild = node} + if (i >= m-1) {this.lastChild = node} + this.childNodes[i] = node; node.nextSibling = old.nextSibling; + old.nextSibling = old.parent = null; + return old; + }, + hasChildNodes: function (node) { + return (this.childNodes.length>0); + }, + toString: function () {return "{"+this.childNodes.join("")+"}"} + }); + + var INITASCIIMATH = function () { + MML = MathJax.ElementJax.mml; + var MBASEINIT = MML.mbase.prototype.Init; + + // + // Make MML elements looks like DOM elements (add the + // methods that AsciiMath needs) + // + MML.mbase.Augment({ + firstChild: null, + lastChild: null, + nodeValue: null, + nextSibling: null, + Init: function () { + var obj = MBASEINIT.apply(this,arguments) || this; + obj.childNodes = obj.data; + obj.nodeName = obj.type; + return obj; + }, + appendChild: function (node) { + if (node.parent) {node.parent.removeChild(node)} + var nodes = arguments; + if (node.isa(DOCFRAG)) { + nodes = node.childNodes; + node.data = node.childNodes = []; + node.firstChild = node.lastChild = null; + } + for (var i = 0, m = nodes.length; i < m; i++) { + node = nodes[i]; + if (this.lastChild) {this.lastChild.nextSibling = node} + if (!this.firstChild) {this.firstChild = node} + this.Append(node); + this.lastChild = node; + } + return node; + }, + removeChild: function (node) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === node) break} + if (i === m) return; + this.childNodes.splice(i,1); + if (node === this.firstChild) {this.firstChild = node.nextSibling} + if (node === this.lastChild) { + if (!this.childNodes.length) {this.lastChild = null} + else {this.lastChild = this.childNodes[this.childNodes.length-1]} + } + if (i) {this.childNodes[i-1].nextSibling = node.nextSibling} + node.nextSibling = node.parent = null; + return node; + }, + replaceChild: function (node,old) { + for (var i = 0, m = this.childNodes.length; i < m; i++) + {if (this.childNodes[i] === old) break} + // FIXME: make this work with DOCFRAG's? + if (i) {this.childNodes[i-1].nextSibling = node} else {this.firstChild = node} + if (i >= m-1) {this.lastChild = node} + this.SetData(i,node); node.nextSibling = old.nextSibling; + old.nextSibling = old.parent = null; + return old; + }, + hasChildNodes: function (node) { + return (this.childNodes.length>0); + }, + setAttribute: function (name,value) {this[name] = value} + }); + }; + + // + // Set up to isolate ASCIIMathML.js + // + + var window = {}; // hide the true window + + // + // Hide the true document, and add functions that + // use and produce MML objects instead of DOM objects + // + var document = { + getElementById: true, + createElementNS: function (ns,type) { + var node = MML[type](); + if (type === "mo" && ASCIIMATH.config.useMathMLspacing) {node.useMMLspacing = 0x80} + return node; + }, + createTextNode: function (text) {return MML.chars(text).With({nodeValue:text})}, + createDocumentFragment: function () {return DOCFRAG()} + }; + + var navigator = {appName: "MathJax"}; // hide the true navigator object + +/****************************************************************** + * + * The following section is ASCIIMathML.js Version 2.2 + * (c) Peter Jipsen, used with permission. + * + * Some sections are commented out to save space in the + * minified version (but that is not strictly necessary). + * + ******************************************************************/ + +/* +ASCIIMathML.js +============== +This file contains JavaScript functions to convert ASCII math notation +and (some) LaTeX to Presentation MathML. The conversion is done while the +HTML page loads, and should work with Firefox and other browsers that can +render MathML. + +Just add the next line to your HTML page with this file in the same folder: + + + +Version 2.2 Mar 3, 2014. +Latest version at https://github.com/mathjax/asciimathml +If you use it on a webpage, please send the URL to jipsen@chapman.edu + +Copyright (c) 2014 Peter Jipsen and other ASCIIMathML.js contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +//var asciimath = {}; + +//(function(){ +var mathcolor = "blue"; // change it to "" (to inherit) or another color +//var mathfontsize = "1em"; // change to e.g. 1.2em for larger math +//var mathfontfamily = "serif"; // change to "" to inherit (works in IE) + // or another family (e.g. "arial") +//var automathrecognize = false; // writing "amath" on page makes this true +//var checkForMathML = true; // check if browser can display MathML +//var notifyIfNoMathML = true; // display note at top if no MathML capability +//var alertIfNoMathML = false; // show alert box if no MathML capability +//var translateOnLoad = true; // set to false to do call translators from js +//var translateASCIIMath = true; // false to preserve `..` +var displaystyle = true; // puts limits above and below large operators +var showasciiformulaonhover = true; // helps students learn ASCIIMath +var decimalsign = "."; // change to "," if you like, beware of `(1,2)`! +//var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters +//var AMdocumentId = "wikitext" // PmWiki element containing math (default=body) +var fixphi = true; //false to return to legacy phi/varphi mapping + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +var isIE = (navigator.appName.slice(0,9)=="Microsoft"); +/* +var noMathML = false, translated = false; + +if (isIE) { // add MathPlayer info to IE webpages + document.write(""); + document.write(""); +} + +// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW) +function setStylesheet(s) { + var id = "AMMLcustomStyleSheet"; + var n = document.getElementById(id); + if(document.createStyleSheet) { + // Test for IE's non-standard createStyleSheet method + if(n) + n.parentNode.removeChild(n); + // This failed without the   + document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd"," "); + } else { + if(n) { + n.replaceChild(document.createTextNode(s),n.firstChild); + } else { + n = document.createElement("style"); + n.type = "text/css"; + n.id = id; + n.appendChild(document.createTextNode(s)); + document.getElementsByTagName("head")[0].appendChild(n); + } + } +} + +setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}"); + +function init(){ + var msg, warnings = new Array(); + if (document.getElementById==null){ + alert("This webpage requires a recent browser such as Mozilla Firefox"); + return null; + } + if (checkForMathML && (msg = checkMathML())) warnings.push(msg); + if (warnings.length>0) displayWarnings(warnings); + if (!noMathML) initSymbols(); + return true; +} + +function checkMathML(){ + if (navigator.appName.slice(0,8)=="Netscape") + if (navigator.appVersion.slice(0,1)>="5") noMathML = null; + else noMathML = true; + else if (navigator.appName.slice(0,9)=="Microsoft") + try { + var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); + noMathML = null; + } catch (e) { + noMathML = true; + } + else if (navigator.appName.slice(0,5)=="Opera") + if (navigator.appVersion.slice(0,3)>="9.5") noMathML = null; + else noMathML = true; +//noMathML = true; //uncomment to check + if (noMathML && notifyIfNoMathML) { + var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later."; + if (alertIfNoMathML) + alert(msg); + else return msg; + } +} + +function hideWarning(){ + var body = document.getElementsByTagName("body")[0]; + body.removeChild(document.getElementById('AMMLwarningBox')); + body.onclick = null; +} + +function displayWarnings(warnings) { + var i, frag, nd = createElementXHTML("div"); + var body = document.getElementsByTagName("body")[0]; + body.onclick=hideWarning; + nd.id = 'AMMLwarningBox'; + for (i=0; i<", tag:"mo", output:"\u22C9", tex:"ltimes", ttype:CONST}, +{input:"><|", tag:"mo", output:"\u22CA", tex:"rtimes", ttype:CONST}, +{input:"|><|", tag:"mo", output:"\u22C8", tex:"bowtie", ttype:CONST}, +{input:"-:", tag:"mo", output:"\u00F7", tex:"div", ttype:CONST}, +{input:"divide", tag:"mo", output:"-:", tex:null, ttype:DEFINITION}, +{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST}, +{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, +{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, +{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, +{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, +{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, +{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, +{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, +{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, +{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, +{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, +{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, +{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, +{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, + +//binary relation symbols +{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, +{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, +{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, +{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, +{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, +{input:"gt", tag:"mo", output:">", tex:null, ttype:CONST}, +{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, +{input:"gt=", tag:"mo", output:"\u2265", tex:"geq", ttype:CONST}, +{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, +{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, +{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, +{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, +{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, +{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, +{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, +{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, +{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, +{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, +{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, +{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, +{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, +{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, +{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, + +//logical symbols +{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, +{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, +{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, +{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, +{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, +{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, +{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, +{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, +{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, +{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, +{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, +{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, + +//grouping brackets +{input:"(", tag:"mo", output:"(", tex:"left(", ttype:LEFTBRACKET}, +{input:")", tag:"mo", output:")", tex:"right)", ttype:RIGHTBRACKET}, +{input:"[", tag:"mo", output:"[", tex:"left[", ttype:LEFTBRACKET}, +{input:"]", tag:"mo", output:"]", tex:"right]", ttype:RIGHTBRACKET}, +{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, +{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, +{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, +{input:":|:", tag:"mo", output:"|", tex:null, ttype:CONST}, +{input:"|:", tag:"mo", output:"|", tex:null, ttype:LEFTBRACKET}, +{input:":|", tag:"mo", output:"|", tex:null, ttype:RIGHTBRACKET}, +//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, +{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, +{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, +{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, +{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, + +//miscellaneous symbols +{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, +{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, +{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, +{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, +{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, +{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, +{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, +{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, +{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, +{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, +{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, +{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, +{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, +{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, +{input:":'", tag:"mo", output:"\u2235", tex:"because", ttype:CONST}, +{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, +{input:"/_\\", tag:"mo", output:"\u25B3", tex:"triangle", ttype:CONST}, +{input:"'", tag:"mo", output:"\u2032", tex:"prime", ttype:CONST}, +{input:"tilde", tag:"mover", output:"~", tex:null, ttype:UNARY, acc:true}, +{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, +{input:"frown", tag:"mo", output:"\u2322", tex:null, ttype:CONST}, +{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, +{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, +{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, +{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, +{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, +{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, +{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, +{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, +{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, +{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, +{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, +{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, +{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, +{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, +{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, +{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, + +//standard functions +{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, +{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, +{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true}, +{input:"arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true}, +{input:"arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true}, +{input:"coth", tag:"mo", output:"coth", tex:null, ttype:UNARY, func:true}, +{input:"sech", tag:"mo", output:"sech", tex:null, ttype:UNARY, func:true}, +{input:"csch", tag:"mo", output:"csch", tex:null, ttype:UNARY, func:true}, +{input:"exp", tag:"mo", output:"exp", tex:null, ttype:UNARY, func:true}, +{input:"abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, rewriteleftright:["|","|"]}, +{input:"norm", tag:"mo", output:"norm", tex:null, ttype:UNARY, rewriteleftright:["\u2225","\u2225"]}, +{input:"floor", tag:"mo", output:"floor", tex:null, ttype:UNARY, rewriteleftright:["\u230A","\u230B"]}, +{input:"ceil", tag:"mo", output:"ceil", tex:null, ttype:UNARY, rewriteleftright:["\u2308","\u2309"]}, +{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, +{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, +{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, +{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, +{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, +{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, +{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, +{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, +{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, +{input:"Sin", tag:"mo", output:"Sin", tex:null, ttype:UNARY, func:true}, +{input:"Cos", tag:"mo", output:"Cos", tex:null, ttype:UNARY, func:true}, +{input:"Tan", tag:"mo", output:"Tan", tex:null, ttype:UNARY, func:true}, +{input:"Arcsin", tag:"mo", output:"Arcsin", tex:null, ttype:UNARY, func:true}, +{input:"Arccos", tag:"mo", output:"Arccos", tex:null, ttype:UNARY, func:true}, +{input:"Arctan", tag:"mo", output:"Arctan", tex:null, ttype:UNARY, func:true}, +{input:"Sinh", tag:"mo", output:"Sinh", tex:null, ttype:UNARY, func:true}, +{input:"Cosh", tag:"mo", output:"Cosh", tex:null, ttype:UNARY, func:true}, +{input:"Tanh", tag:"mo", output:"Tanh", tex:null, ttype:UNARY, func:true}, +{input:"Cot", tag:"mo", output:"Cot", tex:null, ttype:UNARY, func:true}, +{input:"Sec", tag:"mo", output:"Sec", tex:null, ttype:UNARY, func:true}, +{input:"Csc", tag:"mo", output:"Csc", tex:null, ttype:UNARY, func:true}, +{input:"Log", tag:"mo", output:"Log", tex:null, ttype:UNARY, func:true}, +{input:"Ln", tag:"mo", output:"Ln", tex:null, ttype:UNARY, func:true}, +{input:"Abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["|","|"]}, + +//arrows +{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, +{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, +{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, +{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, +{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, +{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, +{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, +{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, +{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, +{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, +{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, +{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, +//commands with argument +{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, +{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, +{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, +{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, +{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"overset", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"underset", tag:"munder", output:"stackrel", tex:null, ttype:BINARY}, +{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, +{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, +{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, +{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, +{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, +{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, +{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, +{input:"overarc", tag:"mover", output:"\u23DC", tex:"overparen", ttype:UNARY, acc:true}, +{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, +{input:"ubrace", tag:"munder", output:"\u23DF", tex:"underbrace", ttype:UNARYUNDEROVER, acc:true}, +{input:"obrace", tag:"mover", output:"\u23DE", tex:"overbrace", ttype:UNARYUNDEROVER, acc:true}, +{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, +{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, +{input:"color", tag:"mstyle", ttype:BINARY}, +{input:"id", tag:"mrow", ttype:BINARY}, +{input:"class", tag:"mrow", ttype:BINARY}, +{input:"cancel", tag:"menclose", output:"cancel", tex:null, ttype:UNARY}, +AMquote, +{input:"bb", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"bb", tex:null, ttype:UNARY}, +{input:"mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, +{input:"sf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, +{input:"mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, +{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, +{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, +{input:"tt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, +{input:"mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, +{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, +{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} +]; + +function compareNames(s1,s2) { + if (s1.input > s2.input) return 1 + else return -1; +} + +var AMnames = []; //list of input symbols + +function initSymbols() { + var i; + var symlen = AMsymbols.length; + for (i=0; i=n where str appears or would be inserted +// assumes arr is sorted + if (n==0) { + var h,m; + n = -1; + h = arr.length; + while (n+1> 1; + if (arr[m]=str +} + +function AMgetSymbol(str) { +//return maximal initial substring of str that appears in names +//return null if there is none + var k = 0; //new pos + var j = 0; //old pos + var mk; //match pos + var st; + var tagst; + var match = ""; + var more = true; + for (var i=1; i<=str.length && more; i++) { + st = str.slice(0,i); //initial substring of length i + j = k; + k = position(AMnames, st, j); + if (k=AMnames[k]; + } + AMpreviousSymbol=AMcurrentSymbol; + if (match!=""){ + AMcurrentSymbol=AMsymbols[mk].ttype; + return AMsymbols[mk]; + } +// if str[0] is a digit or - return maxsubstring of digits.digits + AMcurrentSymbol=CONST; + k = 1; + st = str.slice(0,1); + var integ = true; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + if (st == decimalsign) { + st = str.slice(k,k+1); + if ("0"<=st && st<="9") { + integ = false; + k++; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + } + } + if ((integ && k>1) || k>2) { + st = str.slice(0,k-1); + tagst = "mn"; + } else { + k = 2; + st = str.slice(0,1); //take 1 character + tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); + } + if (st=="-" && AMpreviousSymbol==INFIX) { + AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse + return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; + } + return {input:st, tag:tagst, output:st, ttype:CONST}; +} + +function AMremoveBrackets(node) { + var st; + if (!node.hasChildNodes()) { return; } + if (node.firstChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { + st = node.firstChild.firstChild.nodeValue; + if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); + } + if (node.lastChild.hasChildNodes() && (node.nodeName=="mrow" || node.nodeName=="M:MROW")) { + st = node.lastChild.firstChild.nodeValue; + if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); + } +} + +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ + +var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; + +function AMparseSexpr(str) { //parses str and returns [node,tailstr] + var symbol, node, result, i, st,// rightvert = false, + newFrag = document.createDocumentFragment(); + str = AMremoveCharsAndBlanks(str,0); + symbol = AMgetSymbol(str); //either a token or a bracket or empty + if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { + return [null,str]; + } + if (symbol.ttype == DEFINITION) { + str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); + symbol = AMgetSymbol(str); + } + switch (symbol.ttype) { case UNDEROVER: + case CONST: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + case LEFTBRACKET: //read (expr+) + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,true); + AMnestingDepth--; + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = createMmlNode("mrow",result[0]); + else { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + } + return [node,result[1]]; + case TEXT: + if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; + else i = 0; + if (i==-1) i = str.length; + st = str.slice(1,i); + if (st.charAt(0) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(st))); + if (st.charAt(st.length-1) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + str = AMremoveCharsAndBlanks(str,i+1); + return [createMmlNode("mrow",newFrag),str]; + case UNARYUNDEROVER: + case UNARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + if (typeof symbol.func == "boolean" && symbol.func) { // functions hack + st = str.charAt(0); + if (st=="^" || st=="_" || st=="/" || st=="|" || st=="," || + (symbol.input.length==1 && symbol.input.match(/\w/) && st!="(")) { + return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + } else { + node = createMmlNode("mrow", + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node.appendChild(result[0]); + return [node,result[1]]; + } + } + AMremoveBrackets(result[0]); + if (symbol.input == "sqrt") { // sqrt + return [createMmlNode(symbol.tag,result[0]),result[1]]; + } else if (typeof symbol.rewriteleftright != "undefined") { // abs, floor, ceil + node = createMmlNode("mrow", createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[0]))); + node.appendChild(result[0]); + node.appendChild(createMmlNode("mo",document.createTextNode(symbol.rewriteleftright[1]))); + return [node,result[1]]; + } else if (symbol.input == "cancel") { // cancel + node = createMmlNode(symbol.tag,result[0]); + node.setAttribute("notation","updiagonalstrike"); + return [node,result[1]]; + } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent + node = createMmlNode(symbol.tag,result[0]); + var accnode = createMmlNode("mo",document.createTextNode(symbol.output)); + if (symbol.input=="vec" && ( + (result[0].nodeName=="mrow" && result[0].childNodes.length==1 + && result[0].firstChild.firstChild.nodeValue !== null + && result[0].firstChild.firstChild.nodeValue.length==1) || + (result[0].firstChild.nodeValue !== null + && result[0].firstChild.nodeValue.length==1) )) { + accnode.setAttribute("stretchy",false); + } + node.appendChild(accnode); + return [node,result[1]]; + } else { // font change command + if (!isIE && typeof symbol.codes != "undefined") { + for (i=0; i64 && st.charCodeAt(j)<91) + newst = newst + symbol.codes[st.charCodeAt(j)-65]; + else if (st.charCodeAt(j)>96 && st.charCodeAt(j)<123) + newst = newst + symbol.codes[st.charCodeAt(j)-71]; + else newst = newst + st.charAt(j); + if (result[0].nodeName=="mi") + result[0]=createMmlNode("mo"). + appendChild(document.createTextNode(newst)); + else result[0].replaceChild(createMmlNode("mo"). + appendChild(document.createTextNode(newst)), + result[0].childNodes[i]); + } + } + node = createMmlNode(symbol.tag,result[0]); + node.setAttribute(symbol.atname,symbol.atval); + return [node,result[1]]; + } + case BINARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result[0]); + var result2 = AMparseSexpr(result[1]); + if (result2[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result2[0]); + if (['color', 'class', 'id'].indexOf(symbol.input) >= 0) { + + // Get the second argument + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + st = str.slice(1,i); + + // Make a mathml node + node = createMmlNode(symbol.tag,result2[0]); + + // Set the correct attribute + if (symbol.input === "color") node.setAttribute("mathcolor", st) + else if (symbol.input === "class") node.setAttribute("class", st) + else if (symbol.input === "id") node.setAttribute("id", st) + return [node,result2[1]]; + } + if (symbol.input=="root" || symbol.output=="stackrel") + newFrag.appendChild(result2[0]); + newFrag.appendChild(result[0]); + if (symbol.input=="frac") newFrag.appendChild(result2[0]); + return [createMmlNode(symbol.tag,newFrag),result2[1]]; + case INFIX: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode("mo",document.createTextNode(symbol.output)),str]; + case SPACE: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + return [createMmlNode("mrow",newFrag),str]; + case LEFTRIGHT: +// if (rightvert) return [null,str]; else rightvert = true; + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,false); + AMnestingDepth--; + st = ""; + if (result[0].lastChild!=null) + st = result[0].lastChild.firstChild.nodeValue; + if (st == "|" && str.charAt(0)!==",") { // its an absolute value subterm + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + return [node,result[1]]; + } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing + node = createMmlNode("mo",document.createTextNode("\u2223")); + node = createMmlNode("mrow",node); + return [node,str]; + } + default: +//alert("default"); + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + } +} + +function AMparseIexpr(str) { + var symbol, sym1, sym2, node, result, underover; + str = AMremoveCharsAndBlanks(str,0); + sym1 = AMgetSymbol(str); + result = AMparseSexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input != "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); +// if (symbol.input == "/") result = AMparseIexpr(str); else ... + result = AMparseSexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; +// if (symbol.input == "/") AMremoveBrackets(node); + underover = (sym1.ttype == UNDEROVER || sym1.ttype == UNARYUNDEROVER); + if (symbol.input == "_") { + sym2 = AMgetSymbol(str); + if (sym2.input == "^") { + str = AMremoveCharsAndBlanks(str,sym2.input.length); + var res2 = AMparseSexpr(str); + AMremoveBrackets(res2[0]); + str = res2[1]; + node = createMmlNode((underover?"munderover":"msubsup"),node); + node.appendChild(result[0]); + node.appendChild(res2[0]); + node = createMmlNode("mrow",node); // so sum does not stretch + } else { + node = createMmlNode((underover?"munder":"msub"),node); + node.appendChild(result[0]); + } + } else if (symbol.input == "^" && underover) { + node = createMmlNode("mover",node); + node.appendChild(result[0]); + } else { + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + } + if (typeof sym1.func != 'undefined' && sym1.func) { + sym2 = AMgetSymbol(str); + if (sym2.ttype != INFIX && sym2.ttype != RIGHTBRACKET && + (sym1.input.length>1 || sym2.ttype == LEFTBRACKET)) { + result = AMparseIexpr(str); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + str = result[1]; + } + } + } + return [node,str]; +} + +function AMparseExpr(str,rightbracket) { + var symbol, node, result, i, + newFrag = document.createDocumentFragment(); + do { + str = AMremoveCharsAndBlanks(str,0); + result = AMparseIexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input == "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseIexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; + AMremoveBrackets(node); + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + newFrag.appendChild(node); + symbol = AMgetSymbol(str); + } + else if (node!=undefined) newFrag.appendChild(node); + } while ((symbol.ttype != RIGHTBRACKET && + (symbol.ttype != LEFTRIGHT || rightbracket) + || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); + if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { +// if (AMnestingDepth > 0) AMnestingDepth--; + var len = newFrag.childNodes.length; + if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" + && newFrag.childNodes[len-1].lastChild + && newFrag.childNodes[len-1].lastChild.firstChild ) { //matrix + //removed to allow row vectors: //&& len>1 && + //newFrag.childNodes[len-2].nodeName == "mo" && + //newFrag.childNodes[len-2].firstChild.nodeValue == "," + var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; + if (right==")" || right=="]") { + var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; + if (left=="(" && right==")" && symbol.output != "}" || + left=="[" && right=="]") { + var pos = []; // positions of commas + var matrix = true; + var m = newFrag.childNodes.length; + for (i=0; matrix && i1) matrix = pos[i].length == pos[i-2].length; + } + matrix = matrix && (pos.length>1 || pos[0].length>0); + var columnlines = []; + if (matrix) { + var row, frag, n, k, table = document.createDocumentFragment(); + for (i=0; i(-,-,...,-,-) + n = node.childNodes.length; + k = 0; + node.removeChild(node.firstChild); //remove ( + for (j=1; j2) { + newFrag.removeChild(newFrag.firstChild); //remove ) + newFrag.removeChild(newFrag.firstChild); //remove , + } + table.appendChild(createMmlNode("mtr",row)); + } + node = createMmlNode("mtable",table); + node.setAttribute("columnlines", columnlines.join(" ")); + if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); + newFrag.replaceChild(node,newFrag.firstChild); + } + } + } + } + str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (typeof symbol.invisible != "boolean" || !symbol.invisible) { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + newFrag.appendChild(node); + } + } + return [newFrag,str]; +} + +function parseMath(str,latex) { + var frag, node; + AMnestingDepth = 0; + //some basic cleanup for dealing with stuff editors like TinyMCE adds + str = str.replace(/ /g,""); + str = str.replace(/>/g,">"); + str = str.replace(/</g,"<"); + frag = AMparseExpr(str.replace(/^\s+/g,""),false)[0]; + node = createMmlNode("mstyle",frag); + if (mathcolor != "") node.setAttribute("mathcolor",mathcolor); + if (mathfontsize != "") { + node.setAttribute("fontsize", mathfontsize); + node.setAttribute("mathsize", mathfontsize); + } + if (mathfontfamily != "") { + node.setAttribute("fontfamily", mathfontfamily); + node.setAttribute("mathvariant", mathfontfamily); + } + + if (displaystyle) node.setAttribute("displaystyle","true"); + node = createMmlNode("math",node); + if (showasciiformulaonhover) //fixed by djhsu so newline + node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko + return node; +} + +/* +function strarr2docFrag(arr, linebreaks, latex) { + var newFrag=document.createDocumentFragment(); + var expr = false; + for (var i=0; i,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken; + var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g"); + str = str.replace(re," `$2`$7"); + var arr = str.split(AMdelimiter1); + var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g"); + var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now + for (i=0; i1 || mtch) { + if (!noMathML) { + frg = strarr2docFrag(arr,n.nodeType==8,latex); + var len = frg.childNodes.length; + n.parentNode.replaceChild(frg,n); + return len-1; + } else return 0; + } + } + } else return 0; + } else if (n.nodeName!="math") { + for (i=0; i element, not %1", + "<"+doc.firstChild.nodeName+">"]); + } + var data = {math:doc.firstChild, script:script}; + MATHML.DOMfilterHooks.Execute(data); + this.mml = this.MakeMML(data.math); + }, + + // + // Convert the MathML structure to the MathJax Element jax structure + // + MakeMML: function (node) { + var CLASS = String(node.getAttribute("class")||""); // make sure CLASS is a string + var mml, type = node.nodeName.toLowerCase().replace(/^[a-z]+:/,""); + var match = (CLASS.match(/(^| )MJX-TeXAtom-([^ ]*)/)); + if (match) { + mml = this.TeXAtom(match[2],match[2] === "OP" && !CLASS.match(/MJX-fixedlimits/)); + } else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) { + MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]); + return MML.Error(_("UnknownNodeType","Unknown node type: %1",type)); + } else { + mml = MML[type](); + } + this.AddAttributes(mml,node); this.CheckClass(mml,mml["class"]); + this.AddChildren(mml,node); + if (MATHML.config.useMathMLspacing) {mml.useMMLspacing = 0x08} + return mml; + }, + TeXAtom: function (mclass,movablelimits) { + var mml = MML.TeXAtom().With({texClass:MML.TEXCLASS[mclass]}); + if (movablelimits) {mml.movesupsub = mml.movablelimits = true} + return mml; + }, + CheckClass: function (mml,CLASS) { + CLASS = (CLASS||"").split(/ /); var NCLASS = []; + for (var i = 0, m = CLASS.length; i < m; i++) { + if (CLASS[i].substr(0,4) === "MJX-") { + if (CLASS[i] === "MJX-arrow") { + // This class was used in former versions of MathJax to attach an + // arrow to the updiagonalstrike notation. For backward + // compatibility, let's continue to accept this case. See issue 481. + if (!mml.notation.match("/"+MML.NOTATION.UPDIAGONALARROW+"/")) + mml.notation += " "+MML.NOTATION.UPDIAGONALARROW; + } else if (CLASS[i] === "MJX-variant") { + mml.variantForm = true; + // + // Variant forms come from AMSsymbols, and it sets up the + // character mappings, so load that if needed. + // + if (!MathJax.Extension["TeX/AMSsymbols"]) + {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/AMSsymbols.js"))} + } else if (CLASS[i].substr(0,11) !== "MJX-TeXAtom") { + mml.mathvariant = CLASS[i].substr(3); + // + // Caligraphic and oldstyle bold are set up in the boldsymbol + // extension, so load it if it isn't already loaded. + // + if (mml.mathvariant === "-tex-caligraphic-bold" || + mml.mathvariant === "-tex-oldstyle-bold") { + if (!MathJax.Extension["TeX/boldsymbol"]) + {MathJax.Hub.RestartAfter(MathJax.Ajax.Require("[MathJax]/extensions/TeX/boldsymbol.js"))} + } + } + } else {NCLASS.push(CLASS[i])} + } + if (NCLASS.length) {mml["class"] = NCLASS.join(" ")} else {delete mml["class"]} + }, + + // + // Add the attributes to the mml node + // + AddAttributes: function (mml,node) { + mml.attr = {}; mml.attrNames = []; + for (var i = 0, m = node.attributes.length; i < m; i++) { + var name = node.attributes[i].name; + if (name == "xlink:href") {name = "href"} + if (name.match(/:/)) continue; + if (name.match(/^_moz-math-((column|row)(align|line)|font-style)$/)) continue; + var value = node.attributes[i].value; + value = this.filterAttribute(name,value); + var defaults = (mml.type === "mstyle" ? MML.math.prototype.defaults : mml.defaults); + if (value != null) { + var val = value.toLowerCase(); + if (val === "true" || val === "false") { + if (typeof (defaults[name]) === "boolean" || defaults[name] === MML.INHERIT || + mml.type === "math" || mml.type === "mstyle" || + (defaults[name] === MML.AUTO && + (mml.defaultDef == null || typeof(mml.defaultDef[name]) === "boolean"))) { + value = (val === "true"); + } + } + if (defaults[name] != null || MML.copyAttributes[name]) + {mml[name] = value} else {mml.attr[name] = value} + mml.attrNames.push(name); + } + } + }, + filterAttribute: function (name,value) {return value}, // safe mode overrides this + + // + // Create the children for the mml node + // + AddChildren: function (mml,node) { + for (var i = 0, m = node.childNodes.length; i < m; i++) { + var child = node.childNodes[i]; + if (child.nodeName === "#comment") continue; + if (child.nodeName === "#text") { + if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) { + var text = child.nodeValue; + if (mml.isToken) { + text = text.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + text = this.trimSpace(text); + } + mml.Append(MML.chars(text)); + } else if (child.nodeValue.match(/\S/)) { + MATHML.Error(["UnexpectedTextNode", + "Unexpected text node: %1","'"+child.nodeValue+"'"]); + } + } else if (mml.type === "annotation-xml") { + mml.Append(MML.xml(child)); + } else { + var cmml = this.MakeMML(child); mml.Append(cmml); + if (cmml.mmlSelfClosing && cmml.data.length) + {mml.Append.apply(mml,cmml.data); cmml.data = []} + } + } + if (mml.type === "mrow" && mml.data.length >= 2) { + var first = mml.data[0], last = mml.data[mml.data.length-1]; + if (first.type === "mo" && first.Get("fence") && + last.type === "mo" && last.Get("fence")) { + if (first.data[0]) {mml.open = first.data.join("")} + if (last.data[0]) {mml.close = last.data.join("")} + } + } + }, + + // + // Clean Up the source to prepare for XML parsing + // + preProcessMath: function (math) { + if (math.match(/^<[a-z]+:/i) && !math.match(/^<[^<>]* xmlns:/)) { + math = math.replace(/^<([a-z]+)(:math)/i,'<$1$2 xmlns:$1="http://www.w3.org/1998/Math/MathML"') + } + // HTML5 removes xmlns: namespaces, so put them back for XML + var match = math.match(/^(])+)>)/i); + if (match && match[2].match(/ (?!xmlns=)[a-z]+=\"http:/i)) { + math = match[1].replace(/ (?!xmlns=)([a-z]+=(['"])http:.*?\2)/ig," xmlns:$1 $1") + + math.substr(match[0].length); + } + if (math.match(/^]/i) && !math.match(/^<[^<>]* xmlns=/)) { + // append the MathML namespace + math = math.replace(/^<(math)/i,'\s*$/,"$2"); + return math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + }, + + // + // Remove attribute whitespace + // + trimSpace: function (string) { + return string.replace(/[\t\n\r]/g," ") // whitespace to spaces + .replace(/^ +/,"") // initial whitespace + .replace(/ +$/,"") // trailing whitespace + .replace(/ +/g," "); // internal multiple whitespace + }, + + // + // Replace a named entity by its value + // (look up from external files if necessary) + // + replaceEntity: function (match,entity) { + if (entity.match(/^(lt|amp|quot)$/)) {return match} // these mess up attribute parsing + if (MATHML.Parse.Entity[entity]) {return MATHML.Parse.Entity[entity]} + var file = entity.charAt(0).toLowerCase(); + var font = entity.match(/^[a-zA-Z](fr|scr|opf)$/); + if (font) {file = font[1]} + if (!MATHML.Parse.loaded[file]) { + MATHML.Parse.loaded[file] = true; + MathJax.Hub.RestartAfter(MathJax.Ajax.Require(MATHML.entityDir+"/"+file+".js")); + } + return match; + } + }, { + loaded: [] // the entity files that are loaded + }); + + /************************************************************************/ + + MATHML.Augment({ + sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"], + + prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML string before processing MathML + DOMfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on MathML DOM before processing + postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run on internal jax format after processing MathML + + Translate: function (script) { + if (!this.ParseXML) {this.ParseXML = this.createParser()} + var mml, math, data = {script:script}; + if (script.firstChild && + script.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") === "math") { + data.math = script.firstChild; + } else { + math = MathJax.HTML.getScript(script); + if (BROWSER.isMSIE) {math = math.replace(/( )+$/,"")} + data.math = math; + } + var callback = this.prefilterHooks.Execute(data); if (callback) return callback; + math = data.math; + try { + mml = MATHML.Parse(math,script).mml; + } catch(err) { + if (!err.mathmlError) {throw err} + mml = this.formatError(err,math,script); + } + data.math = MML(mml); + return this.postfilterHooks.Execute(data) || data.math; + }, + prefilterMath: function (math,script) {return math}, + prefilterMathML: function (math,script) {return math}, + formatError: function (err,math,script) { + var message = err.message.replace(/\n.*/,""); + MathJax.Hub.signal.Post(["MathML Jax - parse error",message,math,script]); + return MML.Error(message); + }, + Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (MathJax.Object.isArray(message)) {message = _.apply(_,message)} + throw MathJax.Hub.Insert(Error(message),{mathmlError: true}); + }, + // + // Parsers for various forms (DOMParser, Windows ActiveX object, other) + // + parseDOM: function (string) {return this.parser.parseFromString(string,"text/xml")}, + parseMS: function (string) {return (this.parser.loadXML(string) ? this.parser : null)}, + parseDIV: function (string) { + this.div.innerHTML = + "
"+string.replace(/<([a-z]+)([^>]*)\/>/g,"<$1$2>")+"
"; + var doc = this.div.firstChild; + this.div.innerHTML = ""; + return doc; + }, + parseError: function (string) {return null}, + createMSParser: function() { + var parser = null; + var xml = ["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.5.0", + "MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0", + "MSXML2.DOMDocument.2.0","Microsoft.XMLDOM"]; + for (var i = 0, m = xml.length; i < m && !parser; i++) { + try { + parser = new ActiveXObject(xml[i]) + } catch (err) {} + } + return parser; + }, + // + // Create the parser using a DOMParser, or other fallback method + // + createParser: function () { + if (window.DOMParser) { + this.parser = new DOMParser(); + return(this.parseDOM); + } else if (window.ActiveXObject) { + this.parser = this.createMSParser(); + if (!this.parser) { + MathJax.Localization.Try(this.parserCreationError); + return(this.parseError); + } + this.parser.async = false; + return(this.parseMS); + } + this.div = MathJax.Hub.Insert(document.createElement("div"),{ + style:{visibility:"hidden", overflow:"hidden", height:"1px", + position:"absolute", top:0} + }); + if (!document.body.firstChild) {document.body.appendChild(this.div)} + else {document.body.insertBefore(this.div,document.body.firstChild)} + return(this.parseDIV); + }, + parserCreationError: function () { + alert(_("CantCreateXMLParser", + "MathJax can't create an XML parser for MathML. Check that\n"+ + "the 'Script ActiveX controls marked safe for scripting' security\n"+ + "setting is enabled (use the Internet Options item in the Tools\n"+ + "menu, and select the Security panel, then press the Custom Level\n"+ + "button to check this).\n\n"+ + "MathML equations will not be able to be processed by MathJax.")); + }, + // + // Initialize the parser object (whichever type is used) + // + Startup: function () { + MML = MathJax.ElementJax.mml; + MML.mspace.Augment({mmlSelfClosing: true}); + MML.none.Augment({mmlSelfClosing: true}); + MML.mprescripts.Augment({mmlSelfClosing:true}); + MML.maligngroup.Augment({mmlSelfClosing:true}); + MML.malignmark.Augment({mmlSelfClosing:true}); + } + }); + + // + // Add the default pre-filter (for backward compatibility) + // + MATHML.prefilterHooks.Add(function (data) { + data.math = (typeof(data.math) === "string" ? + MATHML.prefilterMath(data.math,data.script) : + MATHML.prefilterMathML(data.math,data.script)); + }); + + MATHML.Parse.Entity = { + ApplyFunction: '\u2061', + Backslash: '\u2216', + Because: '\u2235', + Breve: '\u02D8', + Cap: '\u22D2', + CenterDot: '\u00B7', + CircleDot: '\u2299', + CircleMinus: '\u2296', + CirclePlus: '\u2295', + CircleTimes: '\u2297', + Congruent: '\u2261', + ContourIntegral: '\u222E', + Coproduct: '\u2210', + Cross: '\u2A2F', + Cup: '\u22D3', + CupCap: '\u224D', + Dagger: '\u2021', + Del: '\u2207', + Delta: '\u0394', + Diamond: '\u22C4', + DifferentialD: '\u2146', + DotEqual: '\u2250', + DoubleDot: '\u00A8', + DoubleRightTee: '\u22A8', + DoubleVerticalBar: '\u2225', + DownArrow: '\u2193', + DownLeftVector: '\u21BD', + DownRightVector: '\u21C1', + DownTee: '\u22A4', + Downarrow: '\u21D3', + Element: '\u2208', + EqualTilde: '\u2242', + Equilibrium: '\u21CC', + Exists: '\u2203', + ExponentialE: '\u2147', + FilledVerySmallSquare: '\u25AA', + ForAll: '\u2200', + Gamma: '\u0393', + Gg: '\u22D9', + GreaterEqual: '\u2265', + GreaterEqualLess: '\u22DB', + GreaterFullEqual: '\u2267', + GreaterLess: '\u2277', + GreaterSlantEqual: '\u2A7E', + GreaterTilde: '\u2273', + Hacek: '\u02C7', + Hat: '\u005E', + HumpDownHump: '\u224E', + HumpEqual: '\u224F', + Im: '\u2111', + ImaginaryI: '\u2148', + Integral: '\u222B', + Intersection: '\u22C2', + InvisibleComma: '\u2063', + InvisibleTimes: '\u2062', + Lambda: '\u039B', + Larr: '\u219E', + LeftAngleBracket: '\u27E8', + LeftArrow: '\u2190', + LeftArrowRightArrow: '\u21C6', + LeftCeiling: '\u2308', + LeftDownVector: '\u21C3', + LeftFloor: '\u230A', + LeftRightArrow: '\u2194', + LeftTee: '\u22A3', + LeftTriangle: '\u22B2', + LeftTriangleEqual: '\u22B4', + LeftUpVector: '\u21BF', + LeftVector: '\u21BC', + Leftarrow: '\u21D0', + Leftrightarrow: '\u21D4', + LessEqualGreater: '\u22DA', + LessFullEqual: '\u2266', + LessGreater: '\u2276', + LessSlantEqual: '\u2A7D', + LessTilde: '\u2272', + Ll: '\u22D8', + Lleftarrow: '\u21DA', + LongLeftArrow: '\u27F5', + LongLeftRightArrow: '\u27F7', + LongRightArrow: '\u27F6', + Longleftarrow: '\u27F8', + Longleftrightarrow: '\u27FA', + Longrightarrow: '\u27F9', + Lsh: '\u21B0', + MinusPlus: '\u2213', + NestedGreaterGreater: '\u226B', + NestedLessLess: '\u226A', + NotDoubleVerticalBar: '\u2226', + NotElement: '\u2209', + NotEqual: '\u2260', + NotExists: '\u2204', + NotGreater: '\u226F', + NotGreaterEqual: '\u2271', + NotLeftTriangle: '\u22EA', + NotLeftTriangleEqual: '\u22EC', + NotLess: '\u226E', + NotLessEqual: '\u2270', + NotPrecedes: '\u2280', + NotPrecedesSlantEqual: '\u22E0', + NotRightTriangle: '\u22EB', + NotRightTriangleEqual: '\u22ED', + NotSubsetEqual: '\u2288', + NotSucceeds: '\u2281', + NotSucceedsSlantEqual: '\u22E1', + NotSupersetEqual: '\u2289', + NotTilde: '\u2241', + NotVerticalBar: '\u2224', + Omega: '\u03A9', + OverBar: '\u203E', + OverBrace: '\u23DE', + PartialD: '\u2202', + Phi: '\u03A6', + Pi: '\u03A0', + PlusMinus: '\u00B1', + Precedes: '\u227A', + PrecedesEqual: '\u2AAF', + PrecedesSlantEqual: '\u227C', + PrecedesTilde: '\u227E', + Product: '\u220F', + Proportional: '\u221D', + Psi: '\u03A8', + Rarr: '\u21A0', + Re: '\u211C', + ReverseEquilibrium: '\u21CB', + RightAngleBracket: '\u27E9', + RightArrow: '\u2192', + RightArrowLeftArrow: '\u21C4', + RightCeiling: '\u2309', + RightDownVector: '\u21C2', + RightFloor: '\u230B', + RightTee: '\u22A2', + RightTeeArrow: '\u21A6', + RightTriangle: '\u22B3', + RightTriangleEqual: '\u22B5', + RightUpVector: '\u21BE', + RightVector: '\u21C0', + Rightarrow: '\u21D2', + Rrightarrow: '\u21DB', + Rsh: '\u21B1', + Sigma: '\u03A3', + SmallCircle: '\u2218', + Sqrt: '\u221A', + Square: '\u25A1', + SquareIntersection: '\u2293', + SquareSubset: '\u228F', + SquareSubsetEqual: '\u2291', + SquareSuperset: '\u2290', + SquareSupersetEqual: '\u2292', + SquareUnion: '\u2294', + Star: '\u22C6', + Subset: '\u22D0', + SubsetEqual: '\u2286', + Succeeds: '\u227B', + SucceedsEqual: '\u2AB0', + SucceedsSlantEqual: '\u227D', + SucceedsTilde: '\u227F', + SuchThat: '\u220B', + Sum: '\u2211', + Superset: '\u2283', + SupersetEqual: '\u2287', + Supset: '\u22D1', + Therefore: '\u2234', + Theta: '\u0398', + Tilde: '\u223C', + TildeEqual: '\u2243', + TildeFullEqual: '\u2245', + TildeTilde: '\u2248', + UnderBar: '\u005F', + UnderBrace: '\u23DF', + Union: '\u22C3', + UnionPlus: '\u228E', + UpArrow: '\u2191', + UpDownArrow: '\u2195', + UpTee: '\u22A5', + Uparrow: '\u21D1', + Updownarrow: '\u21D5', + Upsilon: '\u03A5', + Vdash: '\u22A9', + Vee: '\u22C1', + VerticalBar: '\u2223', + VerticalTilde: '\u2240', + Vvdash: '\u22AA', + Wedge: '\u22C0', + Xi: '\u039E', + acute: '\u00B4', + aleph: '\u2135', + alpha: '\u03B1', + amalg: '\u2A3F', + and: '\u2227', + ang: '\u2220', + angmsd: '\u2221', + angsph: '\u2222', + ape: '\u224A', + backprime: '\u2035', + backsim: '\u223D', + backsimeq: '\u22CD', + beta: '\u03B2', + beth: '\u2136', + between: '\u226C', + bigcirc: '\u25EF', + bigodot: '\u2A00', + bigoplus: '\u2A01', + bigotimes: '\u2A02', + bigsqcup: '\u2A06', + bigstar: '\u2605', + bigtriangledown: '\u25BD', + bigtriangleup: '\u25B3', + biguplus: '\u2A04', + blacklozenge: '\u29EB', + blacktriangle: '\u25B4', + blacktriangledown: '\u25BE', + blacktriangleleft: '\u25C2', + bowtie: '\u22C8', + boxdl: '\u2510', + boxdr: '\u250C', + boxminus: '\u229F', + boxplus: '\u229E', + boxtimes: '\u22A0', + boxul: '\u2518', + boxur: '\u2514', + bsol: '\u005C', + bull: '\u2022', + cap: '\u2229', + check: '\u2713', + chi: '\u03C7', + circ: '\u02C6', + circeq: '\u2257', + circlearrowleft: '\u21BA', + circlearrowright: '\u21BB', + circledR: '\u00AE', + circledS: '\u24C8', + circledast: '\u229B', + circledcirc: '\u229A', + circleddash: '\u229D', + clubs: '\u2663', + colon: '\u003A', + comp: '\u2201', + ctdot: '\u22EF', + cuepr: '\u22DE', + cuesc: '\u22DF', + cularr: '\u21B6', + cup: '\u222A', + curarr: '\u21B7', + curlyvee: '\u22CE', + curlywedge: '\u22CF', + dagger: '\u2020', + daleth: '\u2138', + ddarr: '\u21CA', + deg: '\u00B0', + delta: '\u03B4', + digamma: '\u03DD', + div: '\u00F7', + divideontimes: '\u22C7', + dot: '\u02D9', + doteqdot: '\u2251', + dotplus: '\u2214', + dotsquare: '\u22A1', + dtdot: '\u22F1', + ecir: '\u2256', + efDot: '\u2252', + egs: '\u2A96', + ell: '\u2113', + els: '\u2A95', + empty: '\u2205', + epsi: '\u03B5', + epsiv: '\u03F5', + erDot: '\u2253', + eta: '\u03B7', + eth: '\u00F0', + flat: '\u266D', + fork: '\u22D4', + frown: '\u2322', + gEl: '\u2A8C', + gamma: '\u03B3', + gap: '\u2A86', + gimel: '\u2137', + gnE: '\u2269', + gnap: '\u2A8A', + gne: '\u2A88', + gnsim: '\u22E7', + gt: '\u003E', + gtdot: '\u22D7', + harrw: '\u21AD', + hbar: '\u210F', + hellip: '\u2026', + hookleftarrow: '\u21A9', + hookrightarrow: '\u21AA', + imath: '\u0131', + infin: '\u221E', + intcal: '\u22BA', + iota: '\u03B9', + jmath: '\u0237', + kappa: '\u03BA', + kappav: '\u03F0', + lEg: '\u2A8B', + lambda: '\u03BB', + lap: '\u2A85', + larrlp: '\u21AB', + larrtl: '\u21A2', + lbrace: '\u007B', + lbrack: '\u005B', + le: '\u2264', + leftleftarrows: '\u21C7', + leftthreetimes: '\u22CB', + lessdot: '\u22D6', + lmoust: '\u23B0', + lnE: '\u2268', + lnap: '\u2A89', + lne: '\u2A87', + lnsim: '\u22E6', + longmapsto: '\u27FC', + looparrowright: '\u21AC', + lowast: '\u2217', + loz: '\u25CA', + lt: '\u003C', + ltimes: '\u22C9', + ltri: '\u25C3', + macr: '\u00AF', + malt: '\u2720', + mho: '\u2127', + mu: '\u03BC', + multimap: '\u22B8', + nLeftarrow: '\u21CD', + nLeftrightarrow: '\u21CE', + nRightarrow: '\u21CF', + nVDash: '\u22AF', + nVdash: '\u22AE', + natur: '\u266E', + nearr: '\u2197', + nharr: '\u21AE', + nlarr: '\u219A', + not: '\u00AC', + nrarr: '\u219B', + nu: '\u03BD', + nvDash: '\u22AD', + nvdash: '\u22AC', + nwarr: '\u2196', + omega: '\u03C9', + omicron: '\u03BF', + or: '\u2228', + osol: '\u2298', + period: '\u002E', + phi: '\u03C6', + phiv: '\u03D5', + pi: '\u03C0', + piv: '\u03D6', + prap: '\u2AB7', + precnapprox: '\u2AB9', + precneqq: '\u2AB5', + precnsim: '\u22E8', + prime: '\u2032', + psi: '\u03C8', + rarrtl: '\u21A3', + rbrace: '\u007D', + rbrack: '\u005D', + rho: '\u03C1', + rhov: '\u03F1', + rightrightarrows: '\u21C9', + rightthreetimes: '\u22CC', + ring: '\u02DA', + rmoust: '\u23B1', + rtimes: '\u22CA', + rtri: '\u25B9', + scap: '\u2AB8', + scnE: '\u2AB6', + scnap: '\u2ABA', + scnsim: '\u22E9', + sdot: '\u22C5', + searr: '\u2198', + sect: '\u00A7', + sharp: '\u266F', + sigma: '\u03C3', + sigmav: '\u03C2', + simne: '\u2246', + smile: '\u2323', + spades: '\u2660', + sub: '\u2282', + subE: '\u2AC5', + subnE: '\u2ACB', + subne: '\u228A', + supE: '\u2AC6', + supnE: '\u2ACC', + supne: '\u228B', + swarr: '\u2199', + tau: '\u03C4', + theta: '\u03B8', + thetav: '\u03D1', + tilde: '\u02DC', + times: '\u00D7', + triangle: '\u25B5', + triangleq: '\u225C', + upsi: '\u03C5', + upuparrows: '\u21C8', + veebar: '\u22BB', + vellip: '\u22EE', + weierp: '\u2118', + xi: '\u03BE', + yen: '\u00A5', + zeta: '\u03B6', + zigrarr: '\u21DD' + }; + + MATHML.loadComplete("jax.js"); + +})(MathJax.InputJax.MathML,MathJax.Hub.Browser); +// @license-end diff --git a/js/mathjax/jax/input/TeX/config.js b/js/mathjax/jax/input/TeX/config.js new file mode 100644 index 0000000..76e751f --- /dev/null +++ b/js/mathjax/jax/input/TeX/config.js @@ -0,0 +1,56 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/TeX/config.js + * + * Initializes the TeX InputJax (the main definition is in + * MathJax/jax/input/TeX/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.InputJax.TeX = MathJax.InputJax({ + id: "TeX", + version: "2.7.9", + directory: MathJax.InputJax.directory + "/TeX", + extensionDir: MathJax.InputJax.extensionDir + "/TeX", + + config: { + TagSide: "right", + TagIndent: "0.8em", + MultLineWidth: "85%", + + equationNumbers: { + autoNumber: "none", // "AMS" for standard AMS numbering, + // or "all" for all displayed equations + formatNumber: function (n) {return n}, + formatTag: function (n) {return '('+n+')'}, + formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/\s/g,"_")}, + formatURL: function (id,base) {return base+'#'+encodeURIComponent(id)}, + useLabelIds: true + } + }, + + resetEquationNumbers: function () {} // filled in by AMSmath extension +}); +MathJax.InputJax.TeX.Register("math/tex"); + +MathJax.InputJax.TeX.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/input/TeX/jax.js b/js/mathjax/jax/input/TeX/jax.js new file mode 100644 index 0000000..9c36d31 --- /dev/null +++ b/js/mathjax/jax/input/TeX/jax.js @@ -0,0 +1,2373 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/input/TeX/jax.js + * + * Implements the TeX InputJax that reads mathematics in + * TeX and LaTeX format and converts it to the MML ElementJax + * internal format. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (TEX,HUB,AJAX) { + var MML, NBSP = "\u00A0"; + + var _ = function (id) { + return MathJax.Localization._.apply(MathJax.Localization, + [["TeX", id]].concat([].slice.call(arguments,1))); + }; + + var isArray = MathJax.Object.isArray; + + var STACK = MathJax.Object.Subclass({ + Init: function (env,inner) { + this.global = {isInner: inner}; + this.data = [STACKITEM.start(this.global)]; + if (env) {this.data[0].env = env} + this.env = this.data[0].env; + }, + Push: function () { + var i, m, item, top; + for (i = 0, m = arguments.length; i < m; i++) { + item = arguments[i]; if (!item) continue; + if (item instanceof MML.mbase) {item = STACKITEM.mml(item)} + item.global = this.global; + top = (this.data.length ? this.Top().checkItem(item) : true); + if (top instanceof Array) {this.Pop(); this.Push.apply(this,top)} + else if (top instanceof STACKITEM) {this.Pop(); this.Push(top)} + else if (top) { + this.data.push(item); + if (item.env) { + if (item.copyEnv !== false) { + for (var id in this.env) + {if (this.env.hasOwnProperty(id)) {item.env[id] = this.env[id]}} + } + this.env = item.env; + } else {item.env = this.env} + } + } + }, + Pop: function () { + var item = this.data.pop(); if (!item.isOpen) {delete item.env} + this.env = (this.data.length ? this.Top().env : {}); + return item; + }, + Top: function (n) { + if (n == null) {n = 1} + if (this.data.length < n) {return null} + return this.data[this.data.length-n]; + }, + Prev: function (noPop) { + var top = this.Top(); + if (noPop) {return top.data[top.data.length-1]} + else {return top.Pop()} + }, + toString: function () {return "stack[\n "+this.data.join("\n ")+"\n]"} + }); + + var STACKITEM = STACK.Item = MathJax.Object.Subclass({ + type: "base", + endError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], + closeError: /*_()*/ ["ExtraCloseMissingOpen","Extra close brace or missing open brace"], + rightError: /*_()*/ ["MissingLeftExtraRight","Missing \\left or extra \\right"], + Init: function () { + if (this.isOpen) {this.env = {}} + this.data = []; + this.Push.apply(this,arguments); + }, + Push: function () {this.data.push.apply(this.data,arguments)}, + Pop: function () {return this.data.pop()}, + mmlData: function (inferred,forceRow) { + if (inferred == null) {inferred = true} + if (this.data.length === 1 && !forceRow) {return this.data[0]} + return MML.mrow.apply(MML,this.data).With((inferred ? {inferred: true}: {})); + }, + checkItem: function (item) { + if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []} + if (item.type === "cell" && this.isOpen) { + if (item.linebreak) {return false} + TEX.Error(["Misplaced","Misplaced %1",item.name]); + } + if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])} + if (!item.isNotStack) {return true} + this.Push(item.data[0]); return false; + }, + With: function (def) { + for (var id in def) {if (def.hasOwnProperty(id)) {this[id] = def[id]}} + return this; + }, + toString: function () {return this.type+"["+this.data.join("; ")+"]"} + }); + + STACKITEM.start = STACKITEM.Subclass({ + type: "start", isOpen: true, + Init: function (global) { + this.SUPER(arguments).Init.call(this); + this.global = global; + }, + checkItem: function (item) { + if (item.type === "stop") {return STACKITEM.mml(this.mmlData())} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.stop = STACKITEM.Subclass({ + type: "stop", isClose: true + }); + + STACKITEM.open = STACKITEM.Subclass({ + type: "open", isOpen: true, + stopError: /*_()*/ ["ExtraOpenMissingClose","Extra open brace or missing close brace"], + checkItem: function (item) { + if (item.type === "close") { + var mml = this.mmlData(); + return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way) + } + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.close = STACKITEM.Subclass({ + type: "close", isClose: true + }); + + STACKITEM.prime = STACKITEM.Subclass({ + type: "prime", + checkItem: function (item) { + if (this.data[0].type !== "msubsup") + {return [MML.msup(this.data[0],this.data[1]),item]} + this.data[0].SetData(this.data[0].sup,this.data[1]); + return [this.data[0],item]; + } + }); + + STACKITEM.subsup = STACKITEM.Subclass({ + type: "subsup", + stopError: /*_()*/ ["MissingScript","Missing superscript or subscript argument"], + supError: /*_()*/ ["MissingOpenForSup","Missing open brace for superscript"], + subError: /*_()*/ ["MissingOpenForSub","Missing open brace for subscript"], + checkItem: function (item) { + if (item.type === "open" || item.type === "left") {return true} + if (item.type === "mml") { + if (this.primes) { + if (this.position !== 2) {this.data[0].SetData(2,this.primes)} + else {item.data[0] = MML.mrow(this.primes.With({variantForm:true}),item.data[0])} + } + this.data[0].SetData(this.position,item.data[0]); + if (this.movesupsub != null) {this.data[0].movesupsub = this.movesupsub} + return STACKITEM.mml(this.data[0]); + } + if (this.SUPER(arguments).checkItem.call(this,item)) + {TEX.Error(this[["","subError","supError"][this.position]])} + }, + Pop: function () {} + }); + + STACKITEM.over = STACKITEM.Subclass({ + type: "over", isClose: true, name: "\\over", + checkItem: function (item,stack) { + if (item.type === "over") + {TEX.Error(["AmbiguousUseOf","Ambiguous use of %1",item.name])} + if (item.isClose) { + var mml = MML.mfrac(this.num,this.mmlData(false)); + if (this.thickness != null) {mml.linethickness = this.thickness} + if (this.open || this.close) { + mml.texWithDelims = true; + mml = TEX.fixedFence(this.open,mml,this.close); + } + return [STACKITEM.mml(mml), item]; + } + return this.SUPER(arguments).checkItem.call(this,item); + }, + toString: function () {return "over["+this.num+" / "+this.data.join("; ")+"]"} + }); + + STACKITEM.left = STACKITEM.Subclass({ + type: "left", isOpen: true, delim: '(', + stopError: /*_()*/ ["ExtraLeftMissingRight", "Extra \\left or missing \\right"], + checkItem: function (item) { + if (item.type === "right") + {return STACKITEM.mml(TEX.fenced(this.delim,this.mmlData(),item.delim))} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.right = STACKITEM.Subclass({ + type: "right", isClose: true, delim: ')' + }); + + STACKITEM.begin = STACKITEM.Subclass({ + type: "begin", isOpen: true, + checkItem: function (item) { + if (item.type === "end") { + if (item.name !== this.name) + {TEX.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,item.name])} + if (!this.end) {return STACKITEM.mml(this.mmlData())} + return this.parse[this.end].call(this.parse,this,this.data); + } + if (item.type === "stop") + {TEX.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])} + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.end = STACKITEM.Subclass({ + type: "end", isClose: true + }); + + STACKITEM.style = STACKITEM.Subclass({ + type: "style", + checkItem: function (item) { + if (!item.isClose) {return this.SUPER(arguments).checkItem.call(this,item)} + var mml = MML.mstyle.apply(MML,this.data).With(this.styles); + return [STACKITEM.mml(mml),item]; + } + }); + + STACKITEM.position = STACKITEM.Subclass({ + type: "position", + checkItem: function (item) { + if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1",this.name])} + if (item.isNotStack) { + var mml = item.mmlData(); + switch (this.move) { + case 'vertical': + mml = MML.mpadded(mml).With({height: this.dh, depth: this.dd, voffset: this.dh}); + return [STACKITEM.mml(mml)]; + case 'horizontal': + return [STACKITEM.mml(this.left),item,STACKITEM.mml(this.right)]; + } + } + return this.SUPER(arguments).checkItem.call(this,item); + } + }); + + STACKITEM.array = STACKITEM.Subclass({ + type: "array", isOpen: true, copyEnv: false, arraydef: {}, + Init: function () { + this.table = []; this.row = []; this.frame = []; this.hfill = []; + this.SUPER(arguments).Init.apply(this,arguments); + }, + checkItem: function (item) { + if (item.isClose && item.type !== "over") { + if (item.isEntry) {this.EndEntry(); this.clearEnv(); return false} + if (item.isCR) {this.EndEntry(); this.EndRow(); this.clearEnv(); return false} + this.EndTable(); this.clearEnv(); + var scriptlevel = this.arraydef.scriptlevel; delete this.arraydef.scriptlevel; + var mml = MML.mtable.apply(MML,this.table).With(this.arraydef); + if (this.frame.length === 4) { + mml.frame = (this.frame.dashed ? "dashed" : "solid"); + } else if (this.frame.length) { + mml.hasFrame = true; + if (this.arraydef.rowlines) {this.arraydef.rowlines = this.arraydef.rowlines.replace(/none( none)+$/,"none")} + mml = MML.menclose(mml).With({notation: this.frame.join(" "), isFrame: true}); + if ((this.arraydef.columnlines||"none") != "none" || + (this.arraydef.rowlines||"none") != "none") {mml.padding = 0} // HTML-CSS jax implements this + } + if (scriptlevel) {mml = MML.mstyle(mml).With({scriptlevel: scriptlevel})} + if (this.open || this.close) {mml = TEX.fenced(this.open,mml,this.close)} + mml = STACKITEM.mml(mml); + if (this.requireClose) { + if (item.type === 'close') {return mml} + TEX.Error(["MissingCloseBrace","Missing close brace"]); + } + return [mml,item]; + } + return this.SUPER(arguments).checkItem.call(this,item); + }, + EndEntry: function () { + var mtd = MML.mtd.apply(MML,this.data); + if (this.hfill.length) { + if (this.hfill[0] === 0) mtd.columnalign = "right"; + if (this.hfill[this.hfill.length-1] === this.data.length) + mtd.columnalign = (mtd.columnalign ? "center" : "left"); + } + this.row.push(mtd); this.data = []; this.hfill = []; + }, + EndRow: function () { + var mtr = MML.mtr; + if (this.isNumbered && this.row.length === 3) { + this.row.unshift(this.row.pop()); // move equation number to first position + mtr = MML.mlabeledtr; + } + this.table.push(mtr.apply(MML,this.row)); this.row = []; + }, + EndTable: function () { + if (this.data.length || this.row.length) {this.EndEntry(); this.EndRow()} + this.checkLines(); + }, + checkLines: function () { + if (this.arraydef.rowlines) { + var lines = this.arraydef.rowlines.split(/ /); + if (lines.length === this.table.length) { + this.frame.push("bottom"); lines.pop(); + this.arraydef.rowlines = lines.join(' '); + } else if (lines.length < this.table.length-1) { + this.arraydef.rowlines += " none"; + } + } + if (this.rowspacing) { + var rows = this.arraydef.rowspacing.split(/ /); + while (rows.length < this.table.length) {rows.push(this.rowspacing+"em")} + this.arraydef.rowspacing = rows.join(' '); + } + }, + clearEnv: function () { + for (var id in this.env) {if (this.env.hasOwnProperty(id)) {delete this.env[id]}} + } + }); + + STACKITEM.cell = STACKITEM.Subclass({ + type: "cell", isClose: true + }); + + STACKITEM.mml = STACKITEM.Subclass({ + type: "mml", isNotStack: true, + Add: function () {this.data.push.apply(this.data,arguments); return this} + }); + + STACKITEM.fn = STACKITEM.Subclass({ + type: "fn", + checkItem: function (item) { + if (this.data[0]) { + if (item.isOpen) {return true} + if (item.type !== "fn") { + if (item.type !== "mml" || !item.data[0]) {return [this.data[0],item]} + if (item.data[0].isa(MML.mspace)) {return [this.data[0],item]} + var mml = item.data[0]; if (mml.isEmbellished()) {mml = mml.CoreMO()} + if ([0,0,1,1,0,1,1,0,0,0][mml.Get("texClass")]) {return [this.data[0],item]} + } + return [this.data[0],MML.mo(MML.entity("#x2061")).With({texClass:MML.TEXCLASS.NONE}),item]; + } + return this.SUPER(arguments).checkItem.apply(this,arguments); + } + }); + + STACKITEM.not = STACKITEM.Subclass({ + type: "not", + checkItem: function (item) { + var mml, c; + if (item.type === "open" || item.type === "left") {return true} + if (item.type === "mml" && item.data[0].type.match(/^(mo|mi|mtext)$/)) { + mml = item.data[0], c = mml.data.join(""); + if (c.length === 1 && !mml.movesupsub && mml.data.length === 1) { + c = STACKITEM.not.remap[c.charCodeAt(0)]; + if (c) {mml.SetData(0,MML.chars(String.fromCharCode(c)))} + else {mml.Append(MML.chars("\u0338"))} + return item; + } + } + // \mathrel{\rlap{\notChar}} + mml = MML.mpadded(MML.mtext("\u29F8")).With({width:0}); + mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.REL}); + return [mml,item]; + } + }); + STACKITEM.not.remap = { + 0x2190:0x219A, 0x2192:0x219B, 0x2194:0x21AE, + 0x21D0:0x21CD, 0x21D2:0x21CF, 0x21D4:0x21CE, + 0x2208:0x2209, 0x220B:0x220C, 0x2223:0x2224, 0x2225:0x2226, + 0x223C:0x2241, 0x007E:0x2241, 0x2243:0x2244, 0x2245:0x2247, + 0x2248:0x2249, 0x224D:0x226D, 0x003D:0x2260, 0x2261:0x2262, + 0x003C:0x226E, 0x003E:0x226F, 0x2264:0x2270, 0x2265:0x2271, + 0x2272:0x2274, 0x2273:0x2275, 0x2276:0x2278, 0x2277:0x2279, + 0x227A:0x2280, 0x227B:0x2281, 0x2282:0x2284, 0x2283:0x2285, + 0x2286:0x2288, 0x2287:0x2289, 0x22A2:0x22AC, 0x22A8:0x22AD, + 0x22A9:0x22AE, 0x22AB:0x22AF, 0x227C:0x22E0, 0x227D:0x22E1, + 0x2291:0x22E2, 0x2292:0x22E3, 0x22B2:0x22EA, 0x22B3:0x22EB, + 0x22B4:0x22EC, 0x22B5:0x22ED, 0x2203:0x2204 + }; + + STACKITEM.dots = STACKITEM.Subclass({ + type: "dots", + checkItem: function (item) { + if (item.type === "open" || item.type === "left") {return true} + var dots = this.ldots; + if (item.type === "mml" && item.data[0].isEmbellished()) { + var tclass = item.data[0].CoreMO().Get("texClass"); + if (tclass === MML.TEXCLASS.BIN || tclass === MML.TEXCLASS.REL) {dots = this.cdots} + } + return [dots,item]; + } + }); + + + var TEXDEF = { + // + // Add new definitions without overriding user-defined ones + // + Add: function (src,dst,nouser) { + if (!dst) {dst = this} + for (var id in src) {if (src.hasOwnProperty(id)) { + if (typeof src[id] === 'object' && !isArray(src[id]) && + (typeof dst[id] === 'object' || typeof dst[id] === 'function')) + {this.Add(src[id],dst[id],src[id],nouser)} + else if (!dst[id] || !dst[id].isUser || !nouser) {dst[id] = src[id]} + }} + return dst; + } + }; + var STARTUP = function () { + MML = MathJax.ElementJax.mml; + HUB.Insert(TEXDEF,{ + + // patterns for letters and numbers + letter: /[a-z]/i, + digit: /[0-9.]/, + number: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)*|\.[0-9]+)/, + + special: { + '\\': 'ControlSequence', + '{': 'Open', + '}': 'Close', + '~': 'Tilde', + '^': 'Superscript', + '_': 'Subscript', + ' ': 'Space', + "\t": 'Space', + "\r": 'Space', + "\n": 'Space', + "'": 'Prime', + '%': 'Comment', + '&': 'Entry', + '#': 'Hash', + '\u00A0': 'Space', + '\u2019': 'Prime' + }, + + remap: { + '-': '2212', + '*': '2217', + '`': '2018' // map ` to back quote + }, + + mathchar0mi: { + // Lower-case greek + alpha: '03B1', + beta: '03B2', + gamma: '03B3', + delta: '03B4', + epsilon: '03F5', + zeta: '03B6', + eta: '03B7', + theta: '03B8', + iota: '03B9', + kappa: '03BA', + lambda: '03BB', + mu: '03BC', + nu: '03BD', + xi: '03BE', + omicron: '03BF', // added for completeness + pi: '03C0', + rho: '03C1', + sigma: '03C3', + tau: '03C4', + upsilon: '03C5', + phi: '03D5', + chi: '03C7', + psi: '03C8', + omega: '03C9', + varepsilon: '03B5', + vartheta: '03D1', + varpi: '03D6', + varrho: '03F1', + varsigma: '03C2', + varphi: '03C6', + + // Ord symbols + S: ['00A7',{mathvariant: MML.VARIANT.NORMAL}], + aleph: ['2135',{mathvariant: MML.VARIANT.NORMAL}], + hbar: ['210F',{variantForm:true}], + imath: '0131', + jmath: '0237', + ell: '2113', + wp: ['2118',{mathvariant: MML.VARIANT.NORMAL}], + Re: ['211C',{mathvariant: MML.VARIANT.NORMAL}], + Im: ['2111',{mathvariant: MML.VARIANT.NORMAL}], + partial: ['2202',{mathvariant: MML.VARIANT.NORMAL}], + infty: ['221E',{mathvariant: MML.VARIANT.NORMAL}], + prime: ['2032',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], + emptyset: ['2205',{mathvariant: MML.VARIANT.NORMAL}], + nabla: ['2207',{mathvariant: MML.VARIANT.NORMAL}], + top: ['22A4',{mathvariant: MML.VARIANT.NORMAL}], + bot: ['22A5',{mathvariant: MML.VARIANT.NORMAL}], + angle: ['2220',{mathvariant: MML.VARIANT.NORMAL}], + triangle: ['25B3',{mathvariant: MML.VARIANT.NORMAL}], + backslash: ['2216',{mathvariant: MML.VARIANT.NORMAL, variantForm:true}], + forall: ['2200',{mathvariant: MML.VARIANT.NORMAL}], + exists: ['2203',{mathvariant: MML.VARIANT.NORMAL}], + neg: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], + lnot: ['00AC',{mathvariant: MML.VARIANT.NORMAL}], + flat: ['266D',{mathvariant: MML.VARIANT.NORMAL}], + natural: ['266E',{mathvariant: MML.VARIANT.NORMAL}], + sharp: ['266F',{mathvariant: MML.VARIANT.NORMAL}], + clubsuit: ['2663',{mathvariant: MML.VARIANT.NORMAL}], + diamondsuit: ['2662',{mathvariant: MML.VARIANT.NORMAL}], + heartsuit: ['2661',{mathvariant: MML.VARIANT.NORMAL}], + spadesuit: ['2660',{mathvariant: MML.VARIANT.NORMAL}] + }, + + mathchar0mo: { + surd: '221A', + + // big ops + coprod: ['2210',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigvee: ['22C1',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigwedge: ['22C0',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + biguplus: ['2A04',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigcap: ['22C2',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigcup: ['22C3',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + 'int': ['222B',{texClass: MML.TEXCLASS.OP}], + intop: ['222B',{texClass: MML.TEXCLASS.OP, movesupsub:true, movablelimits:true}], + iint: ['222C',{texClass: MML.TEXCLASS.OP}], + iiint: ['222D',{texClass: MML.TEXCLASS.OP}], + prod: ['220F',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + sum: ['2211',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigotimes: ['2A02',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigoplus: ['2A01',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + bigodot: ['2A00',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + oint: ['222E',{texClass: MML.TEXCLASS.OP}], + bigsqcup: ['2A06',{texClass: MML.TEXCLASS.OP, movesupsub:true}], + smallint: ['222B',{largeop:false}], + + // binary operations + triangleleft: '25C3', + triangleright: '25B9', + bigtriangleup: '25B3', + bigtriangledown: '25BD', + wedge: '2227', + land: '2227', + vee: '2228', + lor: '2228', + cap: '2229', + cup: '222A', + ddagger: '2021', + dagger: '2020', + sqcap: '2293', + sqcup: '2294', + uplus: '228E', + amalg: '2A3F', + diamond: '22C4', + bullet: '2219', + wr: '2240', + div: '00F7', + odot: ['2299',{largeop: false}], + oslash: ['2298',{largeop: false}], + otimes: ['2297',{largeop: false}], + ominus: ['2296',{largeop: false}], + oplus: ['2295',{largeop: false}], + mp: '2213', + pm: '00B1', + circ: '2218', + bigcirc: '25EF', + setminus: ['2216',{variantForm:true}], + cdot: '22C5', + ast: '2217', + times: '00D7', + star: '22C6', + + // Relations + propto: '221D', + sqsubseteq: '2291', + sqsupseteq: '2292', + parallel: '2225', + mid: '2223', + dashv: '22A3', + vdash: '22A2', + leq: '2264', + le: '2264', + geq: '2265', + ge: '2265', + lt: '003C', + gt: '003E', + succ: '227B', + prec: '227A', + approx: '2248', + succeq: '2AB0', // or '227C', + preceq: '2AAF', // or '227D', + supset: '2283', + subset: '2282', + supseteq: '2287', + subseteq: '2286', + 'in': '2208', + ni: '220B', + notin: '2209', + owns: '220B', + gg: '226B', + ll: '226A', + sim: '223C', + simeq: '2243', + perp: '22A5', + equiv: '2261', + asymp: '224D', + smile: '2323', + frown: '2322', + ne: '2260', + neq: '2260', + cong: '2245', + doteq: '2250', + bowtie: '22C8', + models: '22A8', + + notChar: '29F8', + + + // Arrows + Leftrightarrow: '21D4', + Leftarrow: '21D0', + Rightarrow: '21D2', + leftrightarrow: '2194', + leftarrow: '2190', + gets: '2190', + rightarrow: '2192', + to: '2192', + mapsto: '21A6', + leftharpoonup: '21BC', + leftharpoondown: '21BD', + rightharpoonup: '21C0', + rightharpoondown: '21C1', + nearrow: '2197', + searrow: '2198', + nwarrow: '2196', + swarrow: '2199', + rightleftharpoons: '21CC', + hookrightarrow: '21AA', + hookleftarrow: '21A9', + longleftarrow: '27F5', + Longleftarrow: '27F8', + longrightarrow: '27F6', + Longrightarrow: '27F9', + Longleftrightarrow: '27FA', + longleftrightarrow: '27F7', + longmapsto: '27FC', + + + // Misc. + ldots: '2026', + cdots: '22EF', + vdots: '22EE', + ddots: '22F1', + dotsc: '2026', // dots with commas + dotsb: '22EF', // dots with binary ops and relations + dotsm: '22EF', // dots with multiplication + dotsi: '22EF', // dots with integrals + dotso: '2026', // other dots + + ldotp: ['002E', {texClass: MML.TEXCLASS.PUNCT}], + cdotp: ['22C5', {texClass: MML.TEXCLASS.PUNCT}], + colon: ['003A', {texClass: MML.TEXCLASS.PUNCT}] + }, + + mathchar7: { + Gamma: '0393', + Delta: '0394', + Theta: '0398', + Lambda: '039B', + Xi: '039E', + Pi: '03A0', + Sigma: '03A3', + Upsilon: '03A5', + Phi: '03A6', + Psi: '03A8', + Omega: '03A9', + + '_': '005F', + '#': '0023', + '$': '0024', + '%': '0025', + '&': '0026', + And: '0026' + }, + + delimiter: { + '(': '(', + ')': ')', + '[': '[', + ']': ']', + '<': '27E8', + '>': '27E9', + '\\lt': '27E8', + '\\gt': '27E9', + '/': '/', + '|': ['|',{texClass:MML.TEXCLASS.ORD}], + '.': '', + '\\\\': '\\', + '\\lmoustache': '23B0', // non-standard + '\\rmoustache': '23B1', // non-standard + '\\lgroup': '27EE', // non-standard + '\\rgroup': '27EF', // non-standard + '\\arrowvert': '23D0', + '\\Arrowvert': '2016', + '\\bracevert': '23AA', // non-standard + '\\Vert': ['2016',{texClass:MML.TEXCLASS.ORD}], + '\\|': ['2016',{texClass:MML.TEXCLASS.ORD}], + '\\vert': ['|',{texClass:MML.TEXCLASS.ORD}], + '\\uparrow': '2191', + '\\downarrow': '2193', + '\\updownarrow': '2195', + '\\Uparrow': '21D1', + '\\Downarrow': '21D3', + '\\Updownarrow': '21D5', + '\\backslash': '\\', + '\\rangle': '27E9', + '\\langle': '27E8', + '\\rbrace': '}', + '\\lbrace': '{', + '\\}': '}', + '\\{': '{', + '\\rceil': '2309', + '\\lceil': '2308', + '\\rfloor': '230B', + '\\lfloor': '230A', + '\\lbrack': '[', + '\\rbrack': ']' + }, + + macros: { + displaystyle: ['SetStyle','D',true,0], + textstyle: ['SetStyle','T',false,0], + scriptstyle: ['SetStyle','S',false,1], + scriptscriptstyle: ['SetStyle','SS',false,2], + + rm: ['SetFont',MML.VARIANT.NORMAL], + mit: ['SetFont',MML.VARIANT.ITALIC], + oldstyle: ['SetFont',MML.VARIANT.OLDSTYLE], + cal: ['SetFont',MML.VARIANT.CALIGRAPHIC], + it: ['SetFont',"-tex-mathit"], // needs special handling + bf: ['SetFont',MML.VARIANT.BOLD], + bbFont: ['SetFont',MML.VARIANT.DOUBLESTRUCK], + scr: ['SetFont',MML.VARIANT.SCRIPT], + frak: ['SetFont',MML.VARIANT.FRAKTUR], + sf: ['SetFont',MML.VARIANT.SANSSERIF], + tt: ['SetFont',MML.VARIANT.MONOSPACE], + +// font: + + tiny: ['SetSize',0.5], + Tiny: ['SetSize',0.6], // non-standard + scriptsize: ['SetSize',0.7], + small: ['SetSize',0.85], + normalsize: ['SetSize',1.0], + large: ['SetSize',1.2], + Large: ['SetSize',1.44], + LARGE: ['SetSize',1.73], + huge: ['SetSize',2.07], + Huge: ['SetSize',2.49], + + arcsin: ['NamedFn'], + arccos: ['NamedFn'], + arctan: ['NamedFn'], + arg: ['NamedFn'], + cos: ['NamedFn'], + cosh: ['NamedFn'], + cot: ['NamedFn'], + coth: ['NamedFn'], + csc: ['NamedFn'], + deg: ['NamedFn'], + det: 'NamedOp', + dim: ['NamedFn'], + exp: ['NamedFn'], + gcd: 'NamedOp', + hom: ['NamedFn'], + inf: 'NamedOp', + ker: ['NamedFn'], + lg: ['NamedFn'], + lim: 'NamedOp', + liminf: ['NamedOp','lim inf'], + limsup: ['NamedOp','lim sup'], + ln: ['NamedFn'], + log: ['NamedFn'], + max: 'NamedOp', + min: 'NamedOp', + Pr: 'NamedOp', + sec: ['NamedFn'], + sin: ['NamedFn'], + sinh: ['NamedFn'], + sup: 'NamedOp', + tan: ['NamedFn'], + tanh: ['NamedFn'], + + limits: ['Limits',1], + nolimits: ['Limits',0], + + overline: ['UnderOver','00AF',null,1], + underline: ['UnderOver','005F'], + overbrace: ['UnderOver','23DE',1], + underbrace: ['UnderOver','23DF',1], + overparen: ['UnderOver','23DC'], + underparen: ['UnderOver','23DD'], + overrightarrow: ['UnderOver','2192'], + underrightarrow: ['UnderOver','2192'], + overleftarrow: ['UnderOver','2190'], + underleftarrow: ['UnderOver','2190'], + overleftrightarrow: ['UnderOver','2194'], + underleftrightarrow: ['UnderOver','2194'], + + overset: 'Overset', + underset: 'Underset', + stackrel: ['Macro','\\mathrel{\\mathop{#2}\\limits^{#1}}',2], + + over: 'Over', + overwithdelims: 'Over', + atop: 'Over', + atopwithdelims: 'Over', + above: 'Over', + abovewithdelims: 'Over', + brace: ['Over','{','}'], + brack: ['Over','[',']'], + choose: ['Over','(',')'], + + frac: 'Frac', + sqrt: 'Sqrt', + root: 'Root', + uproot: ['MoveRoot','upRoot'], + leftroot: ['MoveRoot','leftRoot'], + + left: 'LeftRight', + right: 'LeftRight', + middle: 'Middle', + + llap: 'Lap', + rlap: 'Lap', + raise: 'RaiseLower', + lower: 'RaiseLower', + moveleft: 'MoveLeftRight', + moveright: 'MoveLeftRight', + + ',': ['Spacer',MML.LENGTH.THINMATHSPACE], + ':': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], // for LaTeX + '>': ['Spacer',MML.LENGTH.MEDIUMMATHSPACE], + ';': ['Spacer',MML.LENGTH.THICKMATHSPACE], + '!': ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], + enspace: ['Spacer',".5em"], + quad: ['Spacer',"1em"], + qquad: ['Spacer',"2em"], + thinspace: ['Spacer',MML.LENGTH.THINMATHSPACE], + negthinspace: ['Spacer',MML.LENGTH.NEGATIVETHINMATHSPACE], + + hskip: 'Hskip', + hspace: 'Hskip', + kern: 'Hskip', + mskip: 'Hskip', + mspace: 'Hskip', + mkern: 'Hskip', + rule: 'rule', + Rule: ['Rule'], + Space: ['Rule','blank'], + + big: ['MakeBig',MML.TEXCLASS.ORD,0.85], + Big: ['MakeBig',MML.TEXCLASS.ORD,1.15], + bigg: ['MakeBig',MML.TEXCLASS.ORD,1.45], + Bigg: ['MakeBig',MML.TEXCLASS.ORD,1.75], + bigl: ['MakeBig',MML.TEXCLASS.OPEN,0.85], + Bigl: ['MakeBig',MML.TEXCLASS.OPEN,1.15], + biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.45], + Biggl: ['MakeBig',MML.TEXCLASS.OPEN,1.75], + bigr: ['MakeBig',MML.TEXCLASS.CLOSE,0.85], + Bigr: ['MakeBig',MML.TEXCLASS.CLOSE,1.15], + biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.45], + Biggr: ['MakeBig',MML.TEXCLASS.CLOSE,1.75], + bigm: ['MakeBig',MML.TEXCLASS.REL,0.85], + Bigm: ['MakeBig',MML.TEXCLASS.REL,1.15], + biggm: ['MakeBig',MML.TEXCLASS.REL,1.45], + Biggm: ['MakeBig',MML.TEXCLASS.REL,1.75], + + mathord: ['TeXAtom',MML.TEXCLASS.ORD], + mathop: ['TeXAtom',MML.TEXCLASS.OP], + mathopen: ['TeXAtom',MML.TEXCLASS.OPEN], + mathclose: ['TeXAtom',MML.TEXCLASS.CLOSE], + mathbin: ['TeXAtom',MML.TEXCLASS.BIN], + mathrel: ['TeXAtom',MML.TEXCLASS.REL], + mathpunct: ['TeXAtom',MML.TEXCLASS.PUNCT], + mathinner: ['TeXAtom',MML.TEXCLASS.INNER], + + vcenter: ['TeXAtom',MML.TEXCLASS.VCENTER], + + mathchoice: ['Extension','mathchoice'], + buildrel: 'BuildRel', + + hbox: ['HBox',0], + text: 'HBox', + mbox: ['HBox',0], + fbox: 'FBox', + + strut: 'Strut', + mathstrut: ['Macro','\\vphantom{(}'], + phantom: 'Phantom', + vphantom: ['Phantom',1,0], + hphantom: ['Phantom',0,1], + smash: 'Smash', + + acute: ['Accent', "00B4"], // or 0301 or 02CA + grave: ['Accent', "0060"], // or 0300 or 02CB + ddot: ['Accent', "00A8"], // or 0308 + tilde: ['Accent', "007E"], // or 0303 or 02DC + bar: ['Accent', "00AF"], // or 0304 or 02C9 + breve: ['Accent', "02D8"], // or 0306 + check: ['Accent', "02C7"], // or 030C + hat: ['Accent', "005E"], // or 0302 or 02C6 + vec: ['Accent', "2192"], // or 20D7 + dot: ['Accent', "02D9"], // or 0307 + widetilde: ['Accent', "007E",1], // or 0303 or 02DC + widehat: ['Accent', "005E",1], // or 0302 or 02C6 + + matrix: 'Matrix', + array: 'Matrix', + pmatrix: ['Matrix','(',')'], + cases: ['Matrix','{','',"left left",null,".1em",null,true], + eqalign: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D'], + displaylines: ['Matrix',null,null,"center",null,".5em",'D'], + cr: 'Cr', + '\\': 'CrLaTeX', + newline: ['CrLaTeX',true], + hline: ['HLine','solid'], + hdashline: ['HLine','dashed'], +// noalign: 'HandleNoAlign', + eqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"right"], + leqalignno: ['Matrix',null,null,"right left",MML.LENGTH.THICKMATHSPACE,".5em",'D',null,"left"], + hfill: 'HFill', + hfil: 'HFill', // \hfil treated as \hfill for now + hfilll: 'HFill', // \hfilll treated as \hfill for now + + // TeX substitution macros + bmod: ['Macro','\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'], + pmod: ['Macro','\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}',1], + mod: ['Macro','\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1',1], + pod: ['Macro','\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)',1], + iff: ['Macro','\\;\\Longleftrightarrow\\;'], + skew: ['Macro','{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}',3], + mathcal: ['Macro','{\\cal #1}',1], + mathscr: ['Macro','{\\scr #1}',1], + mathrm: ['Macro','{\\rm #1}',1], + mathbf: ['Macro','{\\bf #1}',1], + mathbb: ['Macro','{\\bbFont #1}',1], + Bbb: ['Macro','{\\bbFont #1}',1], + mathit: ['Macro','{\\it #1}',1], + mathfrak: ['Macro','{\\frak #1}',1], + mathsf: ['Macro','{\\sf #1}',1], + mathtt: ['Macro','{\\tt #1}',1], + textrm: ['Macro','\\mathord{\\rm\\text{#1}}',1], + textit: ['Macro','\\mathord{\\it\\text{#1}}',1], + textbf: ['Macro','\\mathord{\\bf\\text{#1}}',1], + textsf: ['Macro','\\mathord{\\sf\\text{#1}}',1], + texttt: ['Macro','\\mathord{\\tt\\text{#1}}',1], + pmb: ['Macro','\\rlap{#1}\\kern1px{#1}',1], + TeX: ['Macro','T\\kern-.14em\\lower.5ex{E}\\kern-.115em X'], + LaTeX: ['Macro','L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX'], + ' ': ['Macro','\\text{ }'], + + // Specially handled + not: 'Not', + dots: 'Dots', + space: 'Tilde', + '\u00A0': 'Tilde', + + + // LaTeX + begin: 'BeginEnd', + end: 'BeginEnd', + + newcommand: ['Extension','newcommand'], + renewcommand: ['Extension','newcommand'], + newenvironment: ['Extension','newcommand'], + renewenvironment: ['Extension','newcommand'], + def: ['Extension','newcommand'], + 'let': ['Extension','newcommand'], + + verb: ['Extension','verb'], + + boldsymbol: ['Extension','boldsymbol'], + + tag: ['Extension','AMSmath'], + notag: ['Extension','AMSmath'], + label: ['Extension','AMSmath'], + ref: ['Extension','AMSmath'], + eqref: ['Extension','AMSmath'], + nonumber: ['Macro','\\notag'], + + // Extensions to TeX + unicode: ['Extension','unicode'], + color: 'Color', + + href: ['Extension','HTML'], + 'class': ['Extension','HTML'], + style: ['Extension','HTML'], + cssId: ['Extension','HTML'], + bbox: ['Extension','bbox'], + + mmlToken: 'MmlToken', + + require: 'Require' + + }, + + environment: { + array: ['AlignedArray'], + matrix: ['Array',null,null,null,'c'], + pmatrix: ['Array',null,'(',')','c'], + bmatrix: ['Array',null,'[',']','c'], + Bmatrix: ['Array',null,'\\{','\\}','c'], + vmatrix: ['Array',null,'\\vert','\\vert','c'], + Vmatrix: ['Array',null,'\\Vert','\\Vert','c'], + cases: ['Array',null,'\\{','.','ll',null,".2em",'T'], + + equation: [null,'Equation'], + 'equation*': [null,'Equation'], + + eqnarray: ['ExtensionEnv',null,'AMSmath'], + 'eqnarray*': ['ExtensionEnv',null,'AMSmath'], + + align: ['ExtensionEnv',null,'AMSmath'], + 'align*': ['ExtensionEnv',null,'AMSmath'], + aligned: ['ExtensionEnv',null,'AMSmath'], + multline: ['ExtensionEnv',null,'AMSmath'], + 'multline*': ['ExtensionEnv',null,'AMSmath'], + split: ['ExtensionEnv',null,'AMSmath'], + gather: ['ExtensionEnv',null,'AMSmath'], + 'gather*': ['ExtensionEnv',null,'AMSmath'], + gathered: ['ExtensionEnv',null,'AMSmath'], + alignat: ['ExtensionEnv',null,'AMSmath'], + 'alignat*': ['ExtensionEnv',null,'AMSmath'], + alignedat: ['ExtensionEnv',null,'AMSmath'] + }, + + p_height: 1.2 / .85 // cmex10 height plus depth over .85 + + }); + + // + // Add macros defined in the configuration + // + if (this.config.Macros) { + var MACROS = this.config.Macros; + for (var id in MACROS) {if (MACROS.hasOwnProperty(id)) { + if (typeof(MACROS[id]) === "string") {TEXDEF.macros[id] = ['Macro',MACROS[id]]} + else {TEXDEF.macros[id] = ["Macro"].concat(MACROS[id])} + TEXDEF.macros[id].isUser = true; + }} + } + }; + + /************************************************************************/ + /* + * The TeX Parser + */ + + var PARSE = MathJax.Object.Subclass({ + Init: function (string,env) { + this.string = string; this.i = 0; this.macroCount = 0; + var ENV; if (env) {ENV = {}; for (var id in env) {if (env.hasOwnProperty(id)) {ENV[id] = env[id]}}} + this.stack = TEX.Stack(ENV,!!env); + this.Parse(); this.Push(STACKITEM.stop()); + }, + Parse: function () { + var c, n; + while (this.i < this.string.length) { + c = this.string.charAt(this.i++); n = c.charCodeAt(0); + if (n >= 0xD800 && n < 0xDC00) {c += this.string.charAt(this.i++)} + if (TEXDEF.special.hasOwnProperty(c)) {this[TEXDEF.special[c]](c)} + else if (TEXDEF.letter.test(c)) {this.Variable(c)} + else if (TEXDEF.digit.test(c)) {this.Number(c)} + else {this.Other(c)} + } + }, + Push: function () {this.stack.Push.apply(this.stack,arguments)}, + mml: function () { + if (this.stack.Top().type !== "mml") {return null} + return this.stack.Top().data[0]; + }, + mmlToken: function (token) {return token}, // used by boldsymbol extension + + /************************************************************************/ + /* + * Handle various token classes + */ + + /* + * Lookup a control-sequence and process it + */ + ControlSequence: function (c) { + var name = this.GetCS(), macro = this.csFindMacro(name); + if (macro) { + if (!isArray(macro)) {macro = [macro]} + var fn = macro[0]; if (!(fn instanceof Function)) {fn = this[fn]} + fn.apply(this,[c+name].concat(macro.slice(1))); + } else if (TEXDEF.mathchar0mi.hasOwnProperty(name)) {this.csMathchar0mi(name,TEXDEF.mathchar0mi[name])} + else if (TEXDEF.mathchar0mo.hasOwnProperty(name)) {this.csMathchar0mo(name,TEXDEF.mathchar0mo[name])} + else if (TEXDEF.mathchar7.hasOwnProperty(name)) {this.csMathchar7(name,TEXDEF.mathchar7[name])} + else if (TEXDEF.delimiter.hasOwnProperty("\\"+name)) {this.csDelimiter(name,TEXDEF.delimiter["\\"+name])} + else {this.csUndefined(c+name)} + }, + // + // Look up a macro in the macros list + // (overridden in begingroup extension) + // + csFindMacro: function (name) { + return (TEXDEF.macros.hasOwnProperty(name) ? TEXDEF.macros[name] : null); + }, + // + // Handle normal mathchar (as an mi) + // + csMathchar0mi: function (name,mchar) { + var def = {mathvariant: MML.VARIANT.ITALIC}; + if (isArray(mchar)) {def = mchar[1]; mchar = mchar[0]} + this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle normal mathchar (as an mo) + // + csMathchar0mo: function (name,mchar) { + var def = {stretchy: false}; + if (isArray(mchar)) {def = mchar[1]; def.stretchy = false; mchar = mchar[0]} + this.Push(this.mmlToken(MML.mo(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle mathchar in current family + // + csMathchar7: function (name,mchar) { + var def = {mathvariant: MML.VARIANT.NORMAL}; + if (isArray(mchar)) {def = mchar[1]; mchar = mchar[0]} + if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(MML.mi(MML.entity("#x"+mchar)).With(def))); + }, + // + // Handle delimiter + // + csDelimiter: function (name,delim) { + var def = {}; + if (isArray(delim)) {def = delim[1]; delim = delim[0]} + if (delim.length === 4) {delim = MML.entity('#x'+delim)} else {delim = MML.chars(delim)} + this.Push(this.mmlToken(MML.mo(delim).With({fence: false, stretchy: false}).With(def))); + }, + // + // Handle undefined control sequence + // (overridden in noUndefined extension) + // + csUndefined: function (name) { + TEX.Error(["UndefinedControlSequence","Undefined control sequence %1",name]); + }, + + /* + * Handle a variable (a single letter) + */ + Variable: function (c) { + var def = {}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(MML.mi(MML.chars(c)).With(def))); + }, + + /* + * Determine the extent of a number (pattern may need work) + */ + Number: function (c) { + var mml, n = this.string.slice(this.i-1).match(TEXDEF.number); + if (n) {mml = MML.mn(n[0].replace(/[{}]/g,"")); this.i += n[0].length - 1} + else {mml = MML.mo(MML.chars(c))} + if (this.stack.env.font) {mml.mathvariant = this.stack.env.font} + this.Push(this.mmlToken(mml)); + }, + + /* + * Handle { and } + */ + Open: function (c) {this.Push(STACKITEM.open())}, + Close: function (c) {this.Push(STACKITEM.close())}, + + /* + * Handle tilde and spaces + */ + Tilde: function (c) {this.Push(MML.mtext(MML.chars(NBSP)))}, + Space: function (c) {}, + + /* + * Handle ^, _, and ' + */ + Superscript: function (c) { + if (this.GetNext().match(/\d/)) // don't treat numbers as a unit + {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} + var primes, base, top = this.stack.Top(); + if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} + else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} + if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} + var movesupsub = base.movesupsub, position = base.sup; + if ((base.type === "msubsup" && base.data[base.sup]) || + (base.type === "munderover" && base.data[base.over] && !base.subsupOK)) + {TEX.Error(["DoubleExponent","Double exponent: use braces to clarify"])} + if (base.type !== "msubsup") { + if (movesupsub) { + if (base.type !== "munderover" || base.data[base.over]) { + if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} + base = MML.munderover(base,null,null).With({movesupsub:true}) + } + position = base.over; + } else { + base = MML.msubsup(base,null,null); + position = base.sup; + } + } + this.Push(STACKITEM.subsup(base).With({ + position: position, primes: primes, movesupsub: movesupsub + })); + }, + Subscript: function (c) { + if (this.GetNext().match(/\d/)) // don't treat numbers as a unit + {this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)} + var primes, base, top = this.stack.Top(); + if (top.type === "prime") {base = top.data[0]; primes = top.data[1]; this.stack.Pop()} + else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} + if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} + var movesupsub = base.movesupsub, position = base.sub; + if ((base.type === "msubsup" && base.data[base.sub]) || + (base.type === "munderover" && base.data[base.under] && !base.subsupOK)) + {TEX.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])} + if (base.type !== "msubsup") { + if (movesupsub) { + if (base.type !== "munderover" || base.data[base.under]) { + if (base.movablelimits && base.isa(MML.mi)) {base = this.mi2mo(base)} + base = MML.munderover(base,null,null).With({movesupsub:true}) + } + position = base.under; + } else { + base = MML.msubsup(base,null,null); + position = base.sub; + } + } + this.Push(STACKITEM.subsup(base).With({ + position: position, primes: primes, movesupsub: movesupsub + })); + }, + PRIME: "\u2032", SMARTQUOTE: "\u2019", + Prime: function (c) { + var base = this.stack.Prev(); if (!base) {base = MML.mi()} + if (base.type === "msubsup" && base.data[base.sup]) { + TEX.Error(["DoubleExponentPrime", + "Prime causes double exponent: use braces to clarify"]); + } + var sup = ""; this.i--; + do {sup += this.PRIME; this.i++, c = this.GetNext()} + while (c === "'" || c === this.SMARTQUOTE); + sup = ["","\u2032","\u2033","\u2034","\u2057"][sup.length] || sup; + this.Push(STACKITEM.prime(base,this.mmlToken(MML.mo(sup)))); + }, + mi2mo: function (mi) { + var mo = MML.mo(); mo.Append.apply(mo,mi.data); var id; + for (id in mo.defaults) + {if (mo.defaults.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} + for (id in MML.copyAttributes) + {if (MML.copyAttributes.hasOwnProperty(id) && mi[id] != null) {mo[id] = mi[id]}} + mo.lspace = mo.rspace = "0"; // prevent mo from having space in NativeMML + mo.useMMLspacing &= ~(mo.SPACE_ATTR.lspace | mo.SPACE_ATTR.rspace); // don't count these explicit settings + return mo; + }, + + /* + * Handle comments + */ + Comment: function (c) { + while (this.i < this.string.length && this.string.charAt(this.i) != "\n") {this.i++} + }, + + /* + * Handle hash marks outside of definitions + */ + Hash: function (c) { + TEX.Error(["CantUseHash1", + "You can't use 'macro parameter character #' in math mode"]); + }, + + /* + * Handle other characters (as elements) + */ + Other: function (c) { + var def, mo; + if (this.stack.env.font) {def = {mathvariant: this.stack.env.font}} + if (TEXDEF.remap.hasOwnProperty(c)) { + c = TEXDEF.remap[c]; + if (isArray(c)) {def = c[1]; c = c[0]} + mo = MML.mo(MML.entity('#x'+c)).With(def); + } else { + mo = MML.mo(c).With(def); + } + if (mo.autoDefault("stretchy",true)) {mo.stretchy = false} + if (mo.autoDefault("texClass",true) == "") {mo = MML.TeXAtom(mo)} + this.Push(this.mmlToken(mo)); + }, + + /************************************************************************/ + /* + * Macros + */ + + SetFont: function (name,font) {this.stack.env.font = font}, + SetStyle: function (name,texStyle,style,level) { + this.stack.env.style = texStyle; this.stack.env.level = level; + this.Push(STACKITEM.style().With({styles: {displaystyle: style, scriptlevel: level}})); + }, + SetSize: function (name,size) { + this.stack.env.size = size; + this.Push(STACKITEM.style().With({styles: {mathsize: size+"em"}})); // convert to absolute? + }, + + Color: function (name) { + var color = this.GetArgument(name); + var old = this.stack.env.color; this.stack.env.color = color; + var math = this.ParseArg(name); + if (old) {this.stack.env.color = old} else {delete this.stack.env.color} + this.Push(MML.mstyle(math).With({mathcolor: color})); + }, + + Spacer: function (name,space) { + this.Push(MML.mspace().With({width: space, mathsize: MML.SIZE.NORMAL, scriptlevel:0})); + }, + + LeftRight: function (name) { + this.Push(STACKITEM[name.substr(1)]().With({delim: this.GetDelimiter(name)})); + }, + + Middle: function (name) { + var delim = this.GetDelimiter(name); + this.Push(MML.TeXAtom().With({texClass:MML.TEXCLASS.CLOSE})); + if (this.stack.Top().type !== "left") + {TEX.Error(["MisplacedMiddle","%1 must be within \\left and \\right",name])} + this.Push(MML.mo(delim).With({stretchy:true})); + this.Push(MML.TeXAtom().With({texClass:MML.TEXCLASS.OPEN})); + }, + + NamedFn: function (name,id) { + if (!id) {id = name.substr(1)}; + var mml = MML.mi(id).With({texClass: MML.TEXCLASS.OP}); + this.Push(STACKITEM.fn(this.mmlToken(mml))); + }, + NamedOp: function (name,id) { + if (!id) {id = name.substr(1)}; + id = id.replace(/ /,"\u2006"); + var mml = MML.mo(id).With({ + movablelimits: true, + movesupsub: true, + form: MML.FORM.PREFIX, + texClass: MML.TEXCLASS.OP + }); + this.Push(this.mmlToken(mml)); + }, + Limits: function (name,limits) { + var op = this.stack.Prev("nopop"); + if (!op || (op.Get("texClass") !== MML.TEXCLASS.OP && op.movesupsub == null)) + {TEX.Error(["MisplacedLimits","%1 is allowed only on operators",name])} + var top = this.stack.Top(); + if (op.type === "munderover" && !limits) { + op = top.data[top.data.length-1] = MML.msubsup.apply(MML.subsup,op.data); + } else if (op.type === "msubsup" && limits) { + op = top.data[top.data.length-1] = MML.munderover.apply(MML.underover,op.data); + } + op.movesupsub = (limits ? true : false); + op.Core().movablelimits = false; + if (op.movablelimits) op.movablelimits = false; + }, + + Over: function (name,open,close) { + var mml = STACKITEM.over().With({name: name}); + if (open || close) { + mml.open = open; mml.close = close; + } else if (name.match(/withdelims$/)) { + mml.open = this.GetDelimiter(name); + mml.close = this.GetDelimiter(name); + } + if (name.match(/^\\above/)) {mml.thickness = this.GetDimen(name)} + else if (name.match(/^\\atop/) || open || close) {mml.thickness = 0} + this.Push(mml); + }, + + Frac: function (name) { + var num = this.ParseArg(name); + var den = this.ParseArg(name); + this.Push(MML.mfrac(num,den)); + }, + + Sqrt: function (name) { + var n = this.GetBrackets(name), arg = this.GetArgument(name); + if (arg === "\\frac") {arg += "{"+this.GetArgument(arg)+"}{"+this.GetArgument(arg)+"}"} + var mml = TEX.Parse(arg,this.stack.env).mml(); + if (!n) {mml = MML.msqrt.apply(MML,mml.array())} + else {mml = MML.mroot(mml,this.parseRoot(n))} + this.Push(mml); + }, + Root: function (name) { + var n = this.GetUpTo(name,"\\of"); + var arg = this.ParseArg(name); + this.Push(MML.mroot(arg,this.parseRoot(n))); + }, + parseRoot: function (n) { + var env = this.stack.env, inRoot = env.inRoot; env.inRoot = true; + var parser = TEX.Parse(n,env); n = parser.mml(); var global = parser.stack.global; + if (global.leftRoot || global.upRoot) { + n = MML.mpadded(n); + if (global.leftRoot) {n.width = global.leftRoot} + if (global.upRoot) {n.voffset = global.upRoot; n.height = global.upRoot} + } + env.inRoot = inRoot; + return n; + }, + MoveRoot: function (name,id) { + if (!this.stack.env.inRoot) + {TEX.Error(["MisplacedMoveRoot","%1 can appear only within a root",name])} + if (this.stack.global[id]) + {TEX.Error(["MultipleMoveRoot","Multiple use of %1",name])} + var n = this.GetArgument(name); + if (!n.match(/-?[0-9]+/)) + {TEX.Error(["IntegerArg","The argument to %1 must be an integer",name])} + n = (n/15)+"em"; + if (n.substr(0,1) !== "-") {n = "+"+n} + this.stack.global[id] = n; + }, + + Accent: function (name,accent,stretchy) { + var c = this.ParseArg(name); + var def = {accent: true}; if (this.stack.env.font) {def.mathvariant = this.stack.env.font} + var mml = this.mmlToken(MML.mo(MML.entity("#x"+accent)).With(def)); + mml.stretchy = (stretchy ? true : false); + var mo = (c.isEmbellished() ? c.CoreMO() : c); + if (mo.isa(MML.mo)) mo.movablelimits = false; + this.Push(MML.TeXAtom(MML.munderover(c,null,mml).With({accent: true}))); + }, + + UnderOver: function (name,c,stack,noaccent) { + var pos = {o: "over", u: "under"}[name.charAt(1)]; + var base = this.ParseArg(name); + if (base.Get("movablelimits")) {base.movablelimits = false} + if (base.isa(MML.munderover) && base.isEmbellished()) { + base.Core().With({lspace:0,rspace:0}); // get spacing right for NativeMML + base = MML.mrow(MML.mo().With({rspace:0}),base); // add an empty so it's not embellished any more + } + var mml = MML.munderover(base,null,null); + mml.SetData( + mml[pos], + this.mmlToken(MML.mo(MML.entity("#x"+c)).With({stretchy:true, accent:!noaccent})) + ); + if (stack) {mml = MML.TeXAtom(mml).With({texClass:MML.TEXCLASS.OP, movesupsub:true})} + this.Push(mml.With({subsupOK:true})); + }, + + Overset: function (name) { + var top = this.ParseArg(name), base = this.ParseArg(name); + base.movablelimits = false; + this.Push(MML.mover(base,top)); + }, + Underset: function (name) { + var bot = this.ParseArg(name), base = this.ParseArg(name); + base.movablelimits = false; + this.Push(MML.munder(base,bot)); + }, + + TeXAtom: function (name,mclass) { + var def = {texClass: mclass}, mml; + if (mclass == MML.TEXCLASS.OP) { + def.movesupsub = def.movablelimits = true; + var arg = this.GetArgument(name); + var match = arg.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/); + if (match) { + def.mathvariant = MML.VARIANT.NORMAL; + mml = STACKITEM.fn(this.mmlToken(MML.mi(match[1]).With(def))); + } else { + mml = STACKITEM.fn(MML.TeXAtom(TEX.Parse(arg,this.stack.env).mml()).With(def)); + } + } else {mml = MML.TeXAtom(this.ParseArg(name)).With(def)} + this.Push(mml); + }, + + MmlToken: function (name) { + var type = this.GetArgument(name), + attr = this.GetBrackets(name,"").replace(/^\s+/,""), + data = this.GetArgument(name), + def = {attrNames:[]}, match; + if (!MML[type] || !MML[type].prototype.isToken) + {TEX.Error(["NotMathMLToken","%1 is not a token element",type])} + while (attr !== "") { + match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i); + if (!match) + {TEX.Error(["InvalidMathMLAttr","Invalid MathML attribute: %1",attr])} + if (MML[type].prototype.defaults[match[1]] == null && !this.MmlTokenAllow[match[1]]) { + TEX.Error(["UnknownAttrForElement", + "%1 is not a recognized attribute for %2", + match[1],type]); + } + var value = this.MmlFilterAttribute(match[1],match[2].replace(/^(['"])(.*)\1$/,"$2")); + if (value) { + if (value.toLowerCase() === "true") {value = true} + else if (value.toLowerCase() === "false") {value = false} + def[match[1]] = value; + def.attrNames.push(match[1]); + } + attr = attr.substr(match[0].length); + } + this.Push(this.mmlToken(MML[type](data).With(def))); + }, + MmlFilterAttribute: function (name,value) {return value}, + MmlTokenAllow: { + fontfamily:1, fontsize:1, fontweight:1, fontstyle:1, + color:1, background:1, + id:1, "class":1, href:1, style:1 + }, + + Strut: function (name) { + this.Push(MML.mpadded(MML.mrow()).With({height: "8.6pt", depth: "3pt", width: 0})); + }, + + Phantom: function (name,v,h) { + var mml = this.ParseArg(name); + if (v || h) { + mml = MML.mpadded(mml); + if (h) {mml.height = mml.depth = 0} + if (v) {mml.width = 0} + } + this.Push(MML.TeXAtom(MML.mphantom(mml))); + }, + + Smash: function (name) { + var bt = this.trimSpaces(this.GetBrackets(name,"")); + var smash = MML.mpadded(this.ParseArg(name)); + switch (bt) { + case "b": smash.depth = 0; break; + case "t": smash.height = 0; break; + default: smash.height = smash.depth = 0; + } + this.Push(MML.TeXAtom(smash)); + }, + + Lap: function (name) { + var mml = MML.mpadded(this.ParseArg(name)).With({width: 0}); + if (name === "\\llap") {mml.lspace = "-1width"} + this.Push(MML.TeXAtom(mml)); + }, + + RaiseLower: function (name) { + var h = this.GetDimen(name); + var item = STACKITEM.position().With({name: name, move: 'vertical'}); + if (h.charAt(0) === '-') {h = h.slice(1); name = {raise: "\\lower", lower: "\\raise"}[name.substr(1)]} + if (name === "\\lower") {item.dh = '-'+h; item.dd = '+'+h} else {item.dh = '+'+h; item.dd = '-'+h} + this.Push(item); + }, + + MoveLeftRight: function (name) { + var h = this.GetDimen(name); + var nh = (h.charAt(0) === '-' ? h.slice(1) : '-'+h); + if (name === "\\moveleft") {var tmp = h; h = nh; nh = tmp} + this.Push(STACKITEM.position().With({ + name: name, move: 'horizontal', + left: MML.mspace().With({width: h, mathsize: MML.SIZE.NORMAL}), + right: MML.mspace().With({width: nh, mathsize: MML.SIZE.NORMAL}) + })); + }, + + Hskip: function (name) { + this.Push(MML.mspace().With({width: this.GetDimen(name), mathsize: MML.SIZE.NORMAL})); + }, + + Rule: function (name,style) { + var w = this.GetDimen(name), + h = this.GetDimen(name), + d = this.GetDimen(name); + var def = {width:w, height:h, depth:d}; + if (style !== 'blank') { + def.mathbackground = (this.stack.env.color || "black"); + } + this.Push(MML.mspace().With(def)); + }, + rule: function (name) { + var v = this.GetBrackets(name), + w = this.GetDimen(name), + h = this.GetDimen(name); + var mml = MML.mspace().With({ + width: w, height:h, + mathbackground: (this.stack.env.color || "black") + }); + if (v) { + mml = MML.mpadded(mml).With({voffset: v}); + if (v.match(/^\-/)) { + mml.height = v; + mml.depth = '+' + v.substr(1); + } else { + mml.height = '+' + v; + } + } + this.Push(mml); + }, + + MakeBig: function (name,mclass,size) { + size *= TEXDEF.p_height; + size = String(size).replace(/(\.\d\d\d).+/,'$1')+"em"; + var delim = this.GetDelimiter(name,true); + this.Push(MML.mstyle(MML.TeXAtom(MML.mo(delim).With({ + minsize: size, maxsize: size, + fence: true, stretchy: true, symmetric: true + })).With({texClass: mclass})).With({scriptlevel: 0})); + }, + + BuildRel: function (name) { + var top = this.ParseUpTo(name,"\\over"); + var bot = this.ParseArg(name); + this.Push(MML.TeXAtom(MML.munderover(bot,null,top)).With({texClass: MML.TEXCLASS.REL})); + }, + + HBox: function (name,style) { + this.Push.apply(this,this.InternalMath(this.GetArgument(name),style)); + }, + + FBox: function (name) { + this.Push(MML.menclose.apply(MML,this.InternalMath(this.GetArgument(name))).With({notation:"box"})); + }, + + Not: function (name) { + this.Push(STACKITEM.not()); + }, + + Dots: function (name) { + this.Push(STACKITEM.dots().With({ + ldots: this.mmlToken(MML.mo(MML.entity("#x2026")).With({stretchy:false})), + cdots: this.mmlToken(MML.mo(MML.entity("#x22EF")).With({stretchy:false})) + })); + }, + + Require: function (name) { + var file = this.GetArgument(name) + .replace(/.*\//,"") // remove any leading path + .replace(/[^a-z0-9_.-]/ig,""); // remove illegal characters + this.Extension(null,file); + }, + + Extension: function (name,file,array) { + if (name && !typeof(name) === "string") {name = name.name} + file = TEX.extensionDir+"/"+file; + if (!file.match(/\.js$/)) {file += ".js"} + if (!AJAX.loaded[AJAX.fileURL(file)]) { + if (name != null) {delete TEXDEF[array || 'macros'][name.replace(/^\\/,"")]} + HUB.RestartAfter(AJAX.Require(file)); + } + }, + + Macro: function (name,macro,argcount,def) { + if (argcount) { + var args = []; + if (def != null) { + var optional = this.GetBrackets(name); + args.push(optional == null ? def : optional); + } + for (var i = args.length; i < argcount; i++) {args.push(this.GetArgument(name))} + macro = this.SubstituteArgs(args,macro); + } + this.string = this.AddArgs(macro,this.string.slice(this.i)); + this.i = 0; + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error(["MaxMacroSub1", + "MathJax maximum macro substitution count exceeded; " + + "is there a recursive macro call?"]); + } + }, + + Matrix: function (name,open,close,align,spacing,vspacing,style,cases,numbered) { + var c = this.GetNext(); + if (c === "") + {TEX.Error(["MissingArgFor","Missing argument for %1",name])} + if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0} + var array = STACKITEM.array().With({ + requireClose: true, + arraydef: { + rowspacing: (vspacing||"4pt"), + columnspacing: (spacing||"1em") + } + }); + if (cases) {array.isCases = true} + if (numbered) {array.isNumbered = true; array.arraydef.side = numbered} + if (open || close) {array.open = open; array.close = close} + if (style === "D") {array.arraydef.displaystyle = true} + if (align != null) {array.arraydef.columnalign = align} + this.Push(array); + }, + + Entry: function (name) { + this.Push(STACKITEM.cell().With({isEntry: true, name: name})); + if (this.stack.Top().isCases) { + // + // Make second column be in \text{...} (unless it is already + // in a \text{...}, for backward compatibility). + // + var string = this.string; + var braces = 0, close = -1, i = this.i, m = string.length; + // + // Look through the string character by character... + // + while (i < m) { + var c = string.charAt(i); + if (c === "{") { + // + // Increase the nested brace count and go on + // + braces++; + i++; + } else if (c === "}") { + // + // If there are too many close braces, just end (we will get an + // error message later when the rest of the string is parsed) + // Otherwise + // decrease the nested brace count, + // if it is now zero and we haven't already marked the end of the + // first brace group, record the position (use to check for \text{} later) + // go on to the next character. + // + if (braces === 0) { + m = 0; + } else { + braces--; + if (braces === 0 && close < 0) { + close = i - this.i; + } + i++; + } + } else if (c === "&" && braces === 0) { + // + // Extra alignment tabs are not allowed in cases + // + TEX.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]); + } else if (c === "\\") { + // + // If the macro is \cr or \\, end the search, otherwise skip the macro + // (multi-letter names don't matter, as we will skip the rest of the + // characters in the main loop) + // + if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2} + } else { + // + // Go on to the next character + // + i++; + } + } + // + // Check if the second column text is already in \text{}, + // If not, process the second column as text and continue parsing from there, + // (otherwise process the second column as normal, since it is in \text{} + // + var text = string.substr(this.i,i-this.i); + if (!text.match(/^\s*\\text[^a-zA-Z]/) || close !== text.replace(/\s+$/,'').length - 1) { + this.Push.apply(this,this.InternalMath(text,0)); + this.i = i; + } + } + }, + + Cr: function (name) { + this.Push(STACKITEM.cell().With({isCR: true, name: name})); + }, + + CrLaTeX: function (name, nobrackets) { + var n; + if (!nobrackets && this.string.charAt(this.i) === "[") { + n = this.GetBrackets(name,"").replace(/ /g,"").replace(/,/,"."); + if (n && !this.matchDimen(n)) { + TEX.Error(["BracketMustBeDimension", + "Bracket argument to %1 must be a dimension",name]); + } + } + this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); + var top = this.stack.Top(); + if (top.isa(STACKITEM.array)) { + if (n && top.arraydef.rowspacing) { + var rows = top.arraydef.rowspacing.split(/ /); + if (!top.rowspacing) {top.rowspacing = this.dimen2em(rows[0])} + while (rows.length < top.table.length) {rows.push(this.Em(top.rowspacing))} + rows[top.table.length-1] = this.Em(Math.max(0,top.rowspacing+this.dimen2em(n))); + top.arraydef.rowspacing = rows.join(' '); + } + } else { + if (n) {this.Push(MML.mspace().With({depth:n}))} + this.Push(MML.mspace().With({linebreak:MML.LINEBREAK.NEWLINE})); + } + }, + emPerInch: 7.2, + pxPerInch: 72, + matchDimen: function (dim) { + return dim.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(px|pt|em|ex|mu|pc|in|mm|cm)$/); + }, + dimen2em: function (dim) { + var match = this.matchDimen(dim); + var m = parseFloat(match[1]||"1"), unit = match[2]; + if (unit === "em") {return m} + if (unit === "ex") {return m * .43} + if (unit === "pt") {return m / 10} // 10 pt to an em + if (unit === "pc") {return m * 1.2} // 12 pt to a pc + if (unit === "px") {return m * this.emPerInch / this.pxPerInch} + if (unit === "in") {return m * this.emPerInch} + if (unit === "cm") {return m * this.emPerInch / 2.54} // 2.54 cm to an inch + if (unit === "mm") {return m * this.emPerInch / 25.4} // 10 mm to a cm + if (unit === "mu") {return m / 18} + return 0; + }, + Em: function (m) { + if (Math.abs(m) < .0006) {return "0em"} + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; + }, + + HLine: function (name,style) { + if (style == null) {style = "solid"} + var top = this.stack.Top(); + if (!top.isa(STACKITEM.array) || top.data.length) + {TEX.Error(["Misplaced","Misplaced %1",name])} + if (top.table.length == 0) { + top.frame.push("top"); + } else { + var lines = (top.arraydef.rowlines ? top.arraydef.rowlines.split(/ /) : []); + while (lines.length < top.table.length) {lines.push("none")} + lines[top.table.length-1] = style; + top.arraydef.rowlines = lines.join(' '); + } + }, + + HFill: function (name) { + var top = this.stack.Top(); + if (top.isa(STACKITEM.array)) top.hfill.push(top.data.length); + else TEX.Error(["UnsupportedHFill","Unsupported use of %1",name]); + }, + + + + /************************************************************************/ + /* + * LaTeX environments + */ + + BeginEnd: function (name) { + var env = this.GetArgument(name), isEnd = false; + if (env.match(/^\\end\\/)) {isEnd = true; env = env.substr(5)} // special \end{} for \newenvironment environments + if (env.match(/\\/i)) {TEX.Error(["InvalidEnv","Invalid environment name '%1'",env])} + var cmd = this.envFindName(env); + if (!cmd) {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])} + if (!isArray(cmd)) {cmd = [cmd]} + var end = (isArray(cmd[1]) ? cmd[1][0] : cmd[1]); + var mml = STACKITEM.begin().With({name: env, end: end, parse:this}); + if (name === "\\end") { + if (!isEnd && isArray(cmd[1]) && this[cmd[1][1]]) { + mml = this[cmd[1][1]].apply(this,[mml].concat(cmd.slice(2))); + } else { + mml = STACKITEM.end().With({name: env}); + } + } else { + if (++this.macroCount > TEX.config.MAXMACROS) { + TEX.Error(["MaxMacroSub2", + "MathJax maximum substitution count exceeded; " + + "is there a recursive latex environment?"]); + } + if (cmd[0] && this[cmd[0]]) {mml = this[cmd[0]].apply(this,[mml].concat(cmd.slice(2)))} + } + this.Push(mml); + }, + envFindName: function (name) { + return (TEXDEF.environment.hasOwnProperty(name) ? TEXDEF.environment[name] : null); + }, + + Equation: function (begin,row) {return row}, + + ExtensionEnv: function (begin,file) {this.Extension(begin.name,file,"environment")}, + + Array: function (begin,open,close,align,spacing,vspacing,style,raggedHeight) { + if (!align) {align = this.GetArgument("\\begin{"+begin.name+"}")} + var lines = ("c"+align).replace(/[^clr|:]/g,'').replace(/[^|:]([|:])+/g,'$1'); + align = align.replace(/[^clr]/g,'').split('').join(' '); + align = align.replace(/l/g,'left').replace(/r/g,'right').replace(/c/g,'center'); + var array = STACKITEM.array().With({ + arraydef: { + columnalign: align, + columnspacing: (spacing||"1em"), + rowspacing: (vspacing||"4pt") + } + }); + if (lines.match(/[|:]/)) { + if (lines.charAt(0).match(/[|:]/)) {array.frame.push("left"); array.frame.dashed = lines.charAt(0) === ":"} + if (lines.charAt(lines.length-1).match(/[|:]/)) {array.frame.push("right")} + lines = lines.substr(1,lines.length-2); + array.arraydef.columnlines = + lines.split('').join(' ').replace(/[^|: ]/g,'none').replace(/\|/g,'solid').replace(/:/g,'dashed'); + } + if (open) {array.open = this.convertDelimiter(open)} + if (close) {array.close = this.convertDelimiter(close)} + if (style === "D") {array.arraydef.displaystyle = true} + else if (style) {array.arraydef.displaystyle = false} + if (style === "S") {array.arraydef.scriptlevel = 1} // FIXME: should use mstyle? + if (raggedHeight) {array.arraydef.useHeight = false} + this.Push(begin); + return array; + }, + + AlignedArray: function (begin) { + var align = this.GetBrackets("\\begin{"+begin.name+"}"); + return this.setArrayAlign(this.Array.apply(this,arguments),align); + }, + setArrayAlign: function (array,align) { + align = this.trimSpaces(align||""); + if (align === "t") {array.arraydef.align = "baseline 1"} + else if (align === "b") {array.arraydef.align = "baseline -1"} + else if (align === "c") {array.arraydef.align = "center"} + else if (align) {array.arraydef.align = align} // FIXME: should be an error? + return array; + }, + + /************************************************************************/ + /* + * String handling routines + */ + + /* + * Convert delimiter to character + */ + convertDelimiter: function (c) { + if (c) {c = (TEXDEF.delimiter.hasOwnProperty(c) ? TEXDEF.delimiter[c] : null)} + if (c == null) {return null} + if (isArray(c)) {c = c[0]} + if (c.length === 4) {c = String.fromCharCode(parseInt(c,16))} + return c; + }, + + /* + * Trim spaces from a string + */ + trimSpaces: function (text) { + if (typeof(text) != 'string') {return text} + var TEXT = text.replace(/^\s+|\s+$/g,''); + if (TEXT.match(/\\$/) && text.match(/ $/)) TEXT += " "; + return TEXT; + }, + + /* + * Check if the next character is a space + */ + nextIsSpace: function () { + return this.string.charAt(this.i).match(/\s/); + }, + + /* + * Get the next non-space character + */ + GetNext: function () { + while (this.nextIsSpace()) {this.i++} + return this.string.charAt(this.i); + }, + + /* + * Get and return a control-sequence name + */ + GetCS: function () { + var CS = this.string.slice(this.i).match(/^([a-z]+|.) ?/i); + if (CS) {this.i += CS[1].length; return CS[1]} else {this.i++; return " "} + }, + + /* + * Get and return a TeX argument (either a single character or control sequence, + * or the contents of the next set of braces). + */ + GetArgument: function (name,noneOK) { + switch (this.GetNext()) { + case "": + if (!noneOK) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} + return null; + case '}': + if (!noneOK) { + TEX.Error(["ExtraCloseMissingOpen", + "Extra close brace or missing open brace"]); + } + return null; + case '\\': + this.i++; return "\\"+this.GetCS(); + case '{': + var j = ++this.i, parens = 1; + while (this.i < this.string.length) { + switch (this.string.charAt(this.i++)) { + case '\\': this.i++; break; + case '{': parens++; break; + case '}': + if (--parens == 0) {return this.string.slice(j,this.i-1)} + break; + } + } + TEX.Error(["MissingCloseBrace","Missing close brace"]); + break; + } + return this.string.charAt(this.i++); + }, + + /* + * Get an optional LaTeX argument in brackets + */ + GetBrackets: function (name,def) { + if (this.GetNext() != '[') {return def}; + var j = ++this.i, parens = 0; + while (this.i < this.string.length) { + switch (this.string.charAt(this.i++)) { + case '{': parens++; break; + case '\\': this.i++; break; + case '}': + if (parens-- <= 0) { + TEX.Error(["ExtraCloseLooking", + "Extra close brace while looking for %1","']'"]); + } + break; + case ']': + if (parens == 0) {return this.string.slice(j,this.i-1)} + break; + } + } + TEX.Error(["MissingCloseBracket", + "Couldn't find closing ']' for argument to %1",name]); + }, + + /* + * Get the name of a delimiter (check it in the delimiter list). + */ + GetDelimiter: function (name,braceOK) { + while (this.nextIsSpace()) {this.i++} + var c = this.string.charAt(this.i); this.i++; + if (this.i <= this.string.length) { + if (c == "\\") { + c += this.GetCS(name); + } else if (c === "{" && braceOK) { + this.i--; + c = this.GetArgument(name).replace(/^\s+/,'').replace(/\s+$/,''); + } + if (TEXDEF.delimiter.hasOwnProperty(c)) {return this.convertDelimiter(c)} + } + TEX.Error(["MissingOrUnrecognizedDelim", + "Missing or unrecognized delimiter for %1",name]); + }, + + /* + * Get a dimension (including its units). + */ + GetDimen: function (name) { + var dimen; + if (this.nextIsSpace()) {this.i++} + if (this.string.charAt(this.i) == '{') { + dimen = this.GetArgument(name); + if (dimen.match(/^\s*([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/)) + {return dimen.replace(/ /g,"").replace(/,/,".")} + } else { + dimen = this.string.slice(this.i); + var match = dimen.match(/^\s*(([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/); + if (match) { + this.i += match[0].length; + return match[1].replace(/ /g,"").replace(/,/,"."); + } + } + TEX.Error(["MissingDimOrUnits", + "Missing dimension or its units for %1",name]); + }, + + /* + * Get everything up to the given control sequence (token) + */ + GetUpTo: function (name,token) { + while (this.nextIsSpace()) {this.i++} + var j = this.i, k, c, parens = 0; + while (this.i < this.string.length) { + k = this.i; c = this.string.charAt(this.i++); + switch (c) { + case '\\': c += this.GetCS(); break; + case '{': parens++; break; + case '}': + if (parens == 0) { + TEX.Error(["ExtraCloseLooking", + "Extra close brace while looking for %1",token]) + } + parens--; + break; + } + if (parens == 0 && c == token) {return this.string.slice(j,k)} + } + TEX.Error(["TokenNotFoundForCommand", + "Couldn't find %1 for %2",token,name]); + }, + + /* + * Parse various substrings + */ + ParseArg: function (name) {return TEX.Parse(this.GetArgument(name),this.stack.env).mml()}, + ParseUpTo: function (name,token) {return TEX.Parse(this.GetUpTo(name,token),this.stack.env).mml()}, + + /* + * Break up a string into text and math blocks + */ + InternalMath: function (text,level) { + var def = (this.stack.env.font ? {mathvariant: this.stack.env.font} : {}); + var mml = [], i = 0, k = 0, c, match = '', braces = 0; + if (text.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)) { + while (i < text.length) { + c = text.charAt(i++); + if (c === '$') { + if (match === '$' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-1),{}).mml())); + match = ''; k = i; + } else if (match === '') { + if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); + match = '$'; k = i; + } + } else if (c === '{' && match !== '') { + braces++; + } else if (c === '}') { + if (match === '}' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i),{}).mml().With(def))); + match = ''; k = i; + } else if (match !== '') { + if (braces) braces--; + } + } else if (c === '\\') { + if (match === '' && text.substr(i).match(/^(eq)?ref\s*\{/)) { + var len = RegExp["$&"].length; + if (k < i-1) mml.push(this.InternalText(text.slice(k,i-1),def)); + match = '}'; k = i-1; i += len; + } else { + c = text.charAt(i++); + if (c === '(' && match === '') { + if (k < i-2) mml.push(this.InternalText(text.slice(k,i-2),def)); + match = ')'; k = i; + } else if (c === ')' && match === ')' && braces === 0) { + mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-2),{}).mml())); + match = ''; k = i; + } else if (c.match(/[${}\\]/) && match === '') { + i--; text = text.substr(0,i-1) + text.substr(i); // remove \ from \$, \{, \}, or \\ + } + } + } + } + if (match !== '') TEX.Error(["MathNotTerminated","Math not terminated in text box"]); + } + if (k < text.length) mml.push(this.InternalText(text.slice(k),def)); + if (level != null) { + mml = [MML.mstyle.apply(MML,mml).With({displaystyle:false,scriptlevel:level})]; + } else if (mml.length > 1) { + mml = [MML.mrow.apply(MML,mml)]; + } + return mml; + }, + InternalText: function (text,def) { + text = text.replace(/^\s+/,NBSP).replace(/\s+$/,NBSP); + return MML.mtext(MML.chars(text)).With(def); + }, + + /* + * Routines to set the macro and environment definitions + * (overridden by begingroup to make localized versions) + */ + setDef: function (name,value) {value.isUser = true; TEXDEF.macros[name] = value}, + setEnv: function (name,value) {value.isUser = true; TEXDEF.environment[name] = value}, + + /* + * Replace macro parameters with their values + */ + SubstituteArgs: function (args,string) { + var text = ''; var newstring = ''; var c; var i = 0; + while (i < string.length) { + c = string.charAt(i++); + if (c === "\\") {text += c + string.charAt(i++)} + else if (c === '#') { + c = string.charAt(i++); + if (c === '#') {text += c} else { + if (!c.match(/[1-9]/) || c > args.length) { + TEX.Error(["IllegalMacroParam", + "Illegal macro parameter reference"]); + } + newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]); + text = ''; + } + } else {text += c} + } + return this.AddArgs(newstring,text); + }, + + /* + * Make sure that macros are followed by a space if their names + * could accidentally be continued into the following text. + */ + AddArgs: function (s1,s2) { + if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '} + if (s1.length + s2.length > TEX.config.MAXBUFFER) { + TEX.Error(["MaxBufferSize", + "MathJax internal buffer size exceeded; is there a recursive macro call?"]); + } + return s1+s2; + } + + }); + + /************************************************************************/ + + TEX.Augment({ + Stack: STACK, Parse: PARSE, Definitions: TEXDEF, Startup: STARTUP, + + config: { + MAXMACROS: 10000, // maximum number of macro substitutions per equation + MAXBUFFER: 5*1024 // maximum size of TeX string to process + }, + + sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"], + annotationEncoding: "application/x-tex", + + prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX + postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX + + // + // Check if AMSmath extension must be loaded and push + // it on the extensions array, if needed + // + Config: function () { + this.SUPER(arguments).Config.apply(this,arguments); + if (this.config.equationNumbers.autoNumber !== "none") { + if (!this.config.extensions) {this.config.extensions = []} + this.config.extensions.push("AMSmath.js"); + } + }, + + // + // Convert TeX to ElementJax + // + Translate: function (script) { + var mml, isError = false, math = MathJax.HTML.getScript(script); + var display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null); + var data = {math:math, display:display, script:script}; + var callback = this.prefilterHooks.Execute(data); if (callback) return callback; + math = data.math; + try { + mml = TEX.Parse(math).mml(); + } catch(err) { + if (!err.texError) {throw err} + mml = this.formatError(err,math,display,script); + isError = true; + } + if (mml.isa(MML.mtable) && mml.displaystyle === "inherit") mml.displaystyle = display; // for tagged equations + if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)} + if (display) {mml.root.display = "block"} + if (isError) {mml.texError = true} + data.math = mml; + return this.postfilterHooks.Execute(data) || data.math; + }, + prefilterMath: function (math,displaystyle,script) { + return math; + }, + postfilterMath: function (math,displaystyle,script) { + this.combineRelations(math.root); + return math; + }, + formatError: function (err,math,display,script) { + var message = err.message.replace(/\n.*/,""); + HUB.signal.Post(["TeX Jax - parse error",message,math,display,script]); + return MML.Error(message); + }, + + // + // Produce an error and stop processing this equation + // + Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (isArray(message)) {message = _.apply(_,message)} + throw HUB.Insert(Error(message),{texError: true}); + }, + + // + // Add a user-defined macro to the macro list + // + Macro: function (name,def,argn) { + TEXDEF.macros[name] = ['Macro'].concat([].slice.call(arguments,1)); + TEXDEF.macros[name].isUser = true; + }, + + /* + * Create an mrow that has stretchy delimiters at either end, as needed + */ + fenced: function (open,mml,close) { + var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.INNER}); + mrow.Append( + MML.mo(open).With({fence:true, stretchy:true, symmetric:true, texClass:MML.TEXCLASS.OPEN}) + ); + if (mml.type === "mrow" && mml.inferred) { + mrow.Append.apply(mrow, mml.data); + } else { + mrow.Append(mml); + } + mrow.Append( + MML.mo(close).With({fence:true, stretchy:true, symmetric:true, texClass:MML.TEXCLASS.CLOSE}) + ); + return mrow; + }, + /* + * Create an mrow that has \mathchoice using \bigg and \big for the delimiters + */ + fixedFence: function (open,mml,close) { + var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.ORD}); + if (open) {mrow.Append(this.mathPalette(open,"l"))} + if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)} + if (close) {mrow.Append(this.mathPalette(close,"r"))} + return mrow; + }, + mathPalette: function (fence,side) { + if (fence === '{' || fence === '}') {fence = "\\"+fence} + var D = '{\\bigg'+side+' '+fence+'}', T = '{\\big'+side+' '+fence+'}'; + return TEX.Parse('\\mathchoice'+D+T+T+T,{}).mml(); + }, + + // + // Combine adjacent elements that are relations + // (since MathML treats the spacing very differently) + // + combineRelations: function (mml) { + var i, m, m1, m2; + for (i = 0, m = mml.data.length; i < m; i++) { + if (mml.data[i]) { + if (mml.isa(MML.mrow)) { + while (i+1 < m && (m1 = mml.data[i]) && (m2 = mml.data[i+1]) && + m1.isa(MML.mo) && m2.isa(MML.mo) && + m1.Get("texClass") === MML.TEXCLASS.REL && + m2.Get("texClass") === MML.TEXCLASS.REL) { + if (m1.variantForm == m2.variantForm && + m1.Get("mathvariant") == m2.Get("mathvariant") && m1.style == m2.style && + m1["class"] == m2["class"] && !m1.id && !m2.id) { + m1.Append.apply(m1,m2.data); + mml.data.splice(i+1,1); m--; + } else { + m1.rspace = m2.lspace = "0pt"; i++; + } + } + } + if (!mml.data[i].isToken) {this.combineRelations(mml.data[i])} + } + } + } + }); + + // + // Add the default filters + // + TEX.prefilterHooks.Add(function (data) { + data.math = TEX.prefilterMath(data.math,data.display,data.script); + }); + TEX.postfilterHooks.Add(function (data) { + data.math = TEX.postfilterMath(data.math,data.display,data.script); + }); + + TEX.loadComplete("jax.js"); + +})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js b/js/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js new file mode 100644 index 0000000..39acf24 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js @@ -0,0 +1,62 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/annotation-xm;l.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML; + + MML["annotation-xml"].Augment({ + toCommonHTML: function (node) { + var encoding = this.Get("encoding"); + node = this.CHTMLdefaultNode(node,{childOptions:{encoding:encoding}}); + if (this.CHTML.rscale !== 1) this.CHTML.rescale(1/this.CHTML.rscale); + return node; + } + }); + + MML.xml.Augment({ + toCommonHTML: function (node,options) { + var bbox = this.CHTML = CHTML.BBOX.zero(); + for (var i = 0, m = this.data.length; i < m; i++) + {node.appendChild(this.data[i].cloneNode(true))} + // + // Warning: causes reflow + // + var w = node.offsetWidth, h = node.offsetHeight; + var strut = CHTML.addElement(node,"mjx-hd-test",{style:{height:h+"px"}}); + bbox.d = bbox.b = (node.offsetHeight - h)/CHTML.em; + bbox.w = bbox.r = w/CHTML.em; bbox.h = bbox.t = h/CHTML.em - bbox.d; + node.removeChild(strut); + } + }); + + MathJax.Hub.Startup.signal.Post("CommonHTML annotation-xml Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/annotation-xml.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/maction.js b/js/mathjax/jax/output/CommonHTML/autoload/maction.js new file mode 100644 index 0000000..3fdb393 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/maction.js @@ -0,0 +1,180 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/maction.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML; + + var currentTip, hover, clear; + + // + // Add configuration for tooltips + // + var CONFIG = CHTML.config.tooltip = MathJax.Hub.Insert({ + delayPost: 600, delayClear: 600, + offsetX: 10, offsetY: 5 + },CHTML.config.tooltip||{}); + + + MML.maction.Augment({ + CHTMLtooltip: CHTML.addElement(document.body,"div",{id:"MathJax_CHTML_Tooltip"}), + + toCommonHTML: function (node) { + var selected = this.Get("selection"); + node = this.CHTMLcreateNode(node); + this.CHTML = CHTML.BBOX.empty(); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + this.CHTMLaddChild(node,selected-1,{}); + this.CHTML.clean(); + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + + var type = this.Get("actiontype"); + if (this.CHTMLaction[type] && this.CHTMLaction.hasOwnProperty(type)) + this.CHTMLaction[type].call(this,node,selected); + + return node; + }, + CHTMLcoreNode: function (node) {return this.CHTMLchildNode(node,0)}, + + // + // Implementations for the various actions + // + CHTMLaction: { + toggle: function (node,selection) { + this.selection = selection; + node.onclick = MathJax.Callback(["CHTMLclick",this,CHTML.jax]); + node.style.cursor = "pointer"; + }, + + statusline: function (node,selection) { + node.onmouseover = MathJax.Callback(["CHTMLsetStatus",this]); + node.onmouseout = MathJax.Callback(["CHTMLclearStatus",this]); + node.onmouseover.autoReset = node.onmouseout.autoReset = true; + }, + + tooltip: function(node,selection) { + if (this.data[1] && this.data[1].isToken) { + node.title = node.alt = this.data[1].data.join(""); + } else { + node.onmouseover = MathJax.Callback(["CHTMLtooltipOver",this,CHTML.jax]); + node.onmouseout = MathJax.Callback(["CHTMLtooltipOut",this,CHTML.jax]); + node.onmouseover.autoReset = node.onmouseout.autoReset = true; + } + } + }, + + // + // Handle a click on the maction element + // (remove the original rendering and rerender) + // + CHTMLclick: function (jax,event) { + this.selection++; + if (this.selection > this.data.length) this.selection = 1; + var hover = !!jax.hover; + jax.Update(); + if (hover) { + var span = document.getElementById(jax.inputID+"-Span"); + MathJax.Extension.MathEvents.Hover.Hover(jax,span); + } + return MathJax.Extension.MathEvents.Event.False(event); + }, + + // + // Set/Clear the window status message + // + CHTMLsetStatus: function (event) { + // FIXME: Do something better with non-token elements + this.messageID = MathJax.Message.Set + ((this.data[1] && this.data[1].isToken) ? + this.data[1].data.join("") : this.data[1].toString()); + }, + CHTMLclearStatus: function (event) { + if (this.messageID) MathJax.Message.Clear(this.messageID,0); + delete this.messageID; + }, + + // + // Handle tooltips + // + CHTMLtooltipOver: function (jax,event) { + if (!event) event = window.event; + if (clear) {clearTimeout(clear); clear = null} + if (hover) clearTimeout(hover); + var x = event.pageX; var y = event.pageY; + if (x == null) { + x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; + y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop; + } + var callback = MathJax.Callback(["CHTMLtooltipPost",this,jax,x+CONFIG.offsetX,y+CONFIG.offsetY]) + hover = setTimeout(callback,CONFIG.delayPost); + }, + CHTMLtooltipOut: function (jax,event) { + if (hover) {clearTimeout(hover); hover = null} + if (clear) clearTimeout(clear); + var callback = MathJax.Callback(["CHTMLtooltipClear",this,80]); + clear = setTimeout(callback,CONFIG.delayClear); + }, + CHTMLtooltipPost: function (jax,x,y) { + hover = null; if (clear) {clearTimeout(clear); clear = null} + var tip = this.CHTMLtooltip; + tip.style.display = "block"; tip.style.opacity = ""; +// tip.style.filter = CHTML.config.styles["#MathJax_CHTML_Tooltip"].filter; + if (this === currentTip) return; + tip.style.left = x+"px"; tip.style.top = y+"px"; + tip.innerHTML = ''; + CHTML.getMetrics(jax); + try {this.data[1].toCommonHTML(tip.firstChild.firstChild)} catch(err) { + if (!err.restart) throw err; + tip.style.display = "none"; + MathJax.Callback.After(["CHTMLtooltipPost",this,jax,x,y],err.restart); + return; + } + currentTip = this; + }, + CHTMLtooltipClear: function (n) { + var tip = this.CHTMLtooltip; + if (n <= 0) { + tip.style.display = "none"; + tip.style.opacity = tip.style.filter = ""; + clear = null; + } else { + tip.style.opacity = n/100; + tip.style.filter = "alpha(opacity="+n+")"; + clear = setTimeout(MathJax.Callback(["CHTMLtooltipClear",this,n-20]),50); + } + } + }); + + MathJax.Hub.Startup.signal.Post("CommonHTML maction Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/maction.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/menclose.js b/js/mathjax/jax/output/CommonHTML/autoload/menclose.js new file mode 100644 index 0000000..5ba5b02 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/menclose.js @@ -0,0 +1,332 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/menclose.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML; + + var SVGNS = "http://www.w3.org/2000/svg"; + var ARROWX = 4, ARROWDX = 1, ARROWY = 2; + + MML.menclose.Augment({ + toCommonHTML: function (node) { + var values = this.getValues("notation","thickness","padding"); + if (values.thickness == null) values.thickness = ".075em"; + if (values.padding == null) values.padding = ".2em"; + // + // Get DOM nodes + // + node = this.CHTMLdefaultNode(node,{childNodes:"mjx-box", forceChild:true}); + var child = node.firstChild, cbox = this.CHTMLbboxFor(0); + // + // Get the padding and rule thickness + // + var p = this.CHTMLlength2em(values.padding,1/CHTML.em); // padding for enclosure + var t = this.CHTMLlength2em(values.thickness,1/CHTML.em); // thickness of lines + t = Math.max(1,Math.round(t*CHTML.em))/CHTML.em; + var SOLID = CHTML.Px(t)+" solid"; + var bb = {L:p, R:p, T:p, B:p, H:cbox.h+p, D:cbox.d+p, W:cbox.w+2*p}; + child.style.padding = CHTML.Em(p); + // + // Eliminate duplicate notations. + // + var notations = MathJax.Hub.SplitList(values.notation), notation = {}; + for (var i = 0, m = notations.length; i < m; i++) notation[notations[i]] = true; + if (notation[MML.NOTATION.UPDIAGONALARROW]) delete notation[MML.NOTATION.UPDIAGONALSTRIKE]; + // + // Add the needed notations + // + for (var n in notation) { + if (notation.hasOwnProperty(n)) { + if (this.CHTMLnotation[n] && this.CHTMLnotation.hasOwnProperty(n)) + this.CHTMLnotation[n].call(this,child,cbox,bb,p,t,SOLID); + } + } + // + // Adjust the bounding box + // + var BBOX = this.CHTML; + BBOX.w += bb.L + bb.R; BBOX.r += BBOX.L; if (BBOX.w > BBOX.r) BBOX.r = BBOX.w; + BBOX.h += bb.T; if (BBOX.h > BBOX.t) BBOX.t = BBOX.h; + BBOX.d += bb.B; if (BBOX.d > BBOX.b) BBOX.b = BBOX.d; + + return node; + }, + // + // The various notations and their implementations + // + CHTMLnotation: { + + /********************************************************/ + + box: function (child,cbox,bb,p,t,SOLID) { + p -= t; + child.style.padding = CHTML.Em(p); + child.style.border = SOLID; + }, + + /********************************************************/ + + roundedbox: function (child,cbox,bb,p,t,SOLID) { + var r = Math.min(cbox.w,cbox.h+cbox.d+2*p)/4; + CHTML.addElement(child.parentNode,"mjx-box",{ + style: { + padding:CHTML.Em(p-t), border:SOLID, "border-radius":CHTML.Em(r), + height:CHTML.Em(cbox.h+cbox.d), "vertical-align":CHTML.Em(-bb.D), + width:CHTML.Em(cbox.w), "margin-left":CHTML.Em(-bb.W) + } + }); + }, + + /********************************************************/ + + circle: function (child,cbox,bb,p,t,SOLID) { + var H = bb.H, D = bb.D, W = bb.W; + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"ellipse",{ + rx:CHTML.Px(W/2-t/2), ry:CHTML.Px((H+D)/2-t/2), + cx:CHTML.Px(W/2), cy:CHTML.Px((H+D)/2) + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + left: function (child,cbox,bb,p,t,SOLID) { + child.style.borderLeft = SOLID; + child.style.paddingLeft = CHTML.Em(p-t); + }, + + /********************************************************/ + + right: function (child,cbox,bb,p,t,SOLID) { + child.style.borderRight = SOLID; + child.style.paddingRight = CHTML.Em(p-t); + }, + + /********************************************************/ + + top: function (child,cbox,bb,p,t,SOLID) { + child.style.borderTop = SOLID; + child.style.paddingTop = CHTML.Em(p-t); + }, + + /********************************************************/ + + bottom: function (child,cbox,bb,p,t,SOLID) { + child.style.borderBottom = SOLID; + child.style.paddingBottom = CHTML.Em(p-t); + }, + + /********************************************************/ + + actuarial: function (child,cbox,bb,p,t,SOLID) { + child.style.borderTop = child.style.borderRight = SOLID; + child.style.paddingTop = child.style.paddingRight = CHTML.Em(p-t); + }, + + /********************************************************/ + + madruwb: function (child,cbox,bb,p,t,SOLID) { + child.style.borderBottom = child.style.borderRight = SOLID; + child.style.paddingBottom = child.style.paddingRight = CHTML.Em(p-t); + }, + + /********************************************************/ + + verticalstrike: function (child,cbox,bb,p,t,SOLID) { + CHTML.addElement(child.parentNode,"mjx-box",{ + style: { + "border-left":SOLID, + height:CHTML.Em(bb.H+bb.D), "vertical-align":CHTML.Em(-bb.D), + width:CHTML.Em(cbox.w/2+p-t/2), "margin-left":CHTML.Em(-cbox.w/2-p-t/2) + } + }); + }, + + /********************************************************/ + + horizontalstrike: function (child,cbox,bb,p,t,SOLID) { + CHTML.addElement(child.parentNode,"mjx-box",{ + style: { + "border-top":SOLID, + height:CHTML.Em((bb.H+bb.D)/2-t/2), "vertical-align":CHTML.Em(-bb.D), + width:CHTML.Em(bb.W), "margin-left":CHTML.Em(-bb.W) + } + }); + }, + + /********************************************************/ + + updiagonalstrike: function (child,cbox,bb,p,t,SOLID) { + var H = bb.H, D = bb.D, W = bb.W; + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"line",{ + x1:CHTML.Px(t/2), y1:CHTML.Px(H+D-t), x2:CHTML.Px(W-t), y2:CHTML.Px(t/2) + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + downdiagonalstrike: function (child,cbox,bb,p,t,SOLID) { + var H = bb.H, D = bb.D, W = bb.W; + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"line",{ + x1:CHTML.Px(t/2), y1:CHTML.Px(t/2), x2:CHTML.Px(W-t), y2:CHTML.Px(H+D-t) + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + updiagonalarrow: function (child,cbox,bb,p,t,SOLID) { + var H = bb.H + bb.D - t, W = bb.W - t/2; + var a = Math.atan2(H,W)*(-180/Math.PI).toFixed(3); + var R = Math.sqrt(H*H + W*W); + var svg = this.CHTMLsvg(child,bb,t); + var g = this.CHTMLsvgElement(svg.firstChild,"g",{ + fill:"currentColor", + transform:"translate("+this.CHTMLpx(t/2)+" "+this.CHTMLpx(H+t/2)+") rotate("+a+")" + }); + var x = t * ARROWX, dx = t * ARROWDX, y = t * ARROWY; + this.CHTMLsvgElement(g,"line",{ + x1:CHTML.Px(t/2), y1:0, x2:CHTML.Px(R-x), y2:0 + }); + this.CHTMLsvgElement(g,"path",{ + d: "M "+this.CHTMLpx(R-x)+",0 " + + "L "+this.CHTMLpx(R-x-dx)+","+this.CHTMLpx(y) + + "L "+this.CHTMLpx(R)+",0 " + + "L "+this.CHTMLpx(R-x-dx)+","+this.CHTMLpx(-y), + stroke:"none" + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + phasorangle: function (child,cbox,bb,p,t,SOLID) { + var P = p, H = bb.H, D = bb.D; + p = (H+D)/2; + var W = bb.W + p - P; bb.W = W; bb.L = p; + child.style.margin = "0 0 0 "+CHTML.Em(p-P); + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"path",{ + d: "M "+this.CHTMLpx(p)+",1 " + + "L 1,"+this.CHTMLpx(H+D-t)+" L "+this.CHTMLpx(W)+","+this.CHTMLpx(H+D-t) + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + longdiv: function (child,cbox,bb,p,t,SOLID) { + bb.W += 1.5*p; bb.L += 1.5*p; + var H = bb.H, D = bb.D, W = bb.W; + child.style.margin = "0 0 0 "+CHTML.Em(1.5*p); + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"path",{ + d: "M "+this.CHTMLpx(W)+",1 L 1,1 "+ + "a"+this.CHTMLpx(p)+","+this.CHTMLpx((H+D)/2-t/2)+" 0 0,1 1,"+this.CHTMLpx(H+D-1.5*t) + }); + this.CHTMLsvgViewBox(svg); + }, + + /********************************************************/ + + radical: function (child,cbox,bb,p,t,SOLID) { + bb.W += 1.5*p; bb.L += 1.5*p; + var H = bb.H, D = bb.D, W = bb.W; + child.style.margin = "0 0 0 "+CHTML.Em(1.5*p); + var svg = this.CHTMLsvg(child,bb,t); + this.CHTMLsvgElement(svg.firstChild,"path",{ + d: "M 1,"+this.CHTMLpx(.6*(H+D)) + + " L "+this.CHTMLpx(p)+","+this.CHTMLpx(H+D) + + " L "+this.CHTMLpx(2*p)+",1 L "+this.CHTMLpx(W)+",1" + }); + this.CHTMLsvgViewBox(svg); + } + + /********************************************************/ + + }, + + // + // Pixels with no "px" + // + CHTMLpx: function (m) { + m *= CHTML.em; + if (Math.abs(m) < .1) return "0"; + return m.toFixed(1).replace(/\.0$/,""); + }, + + // + // Create the SVG element and position it over the + // contents + // + CHTMLsvg: function (node,bbox,t) { + var svg = document.createElementNS(SVGNS,"svg"); + if (svg.style) { + svg.style.width = CHTML.Em(bbox.W); + svg.style.height = CHTML.Em(bbox.H+bbox.D); + svg.style.verticalAlign = CHTML.Em(-bbox.D); + svg.style.marginLeft = CHTML.Em(-bbox.W); + } + var g = this.CHTMLsvgElement(svg,"g",{"stroke-width":CHTML.Px(t)}); + if (this.CHTML.scale !== 1) { + g.setAttribute('transform', 'scale('+this.CHTML.scale+')'); + } + node.parentNode.appendChild(svg); + return svg; + }, + // + CHTMLsvgViewBox: function (svg) { + var bbox = svg.getBBox(); + svg.setAttribute('viewBox', [bbox.x, bbox.y, bbox.width, bbox.height].join(' ')); + }, + // + // Add an SVG element to the given svg node + // + CHTMLsvgElement: function (svg,type,def) { + var obj = document.createElementNS(SVGNS,type); obj.isMathJax = true; + if (def) {for (var id in def) {if (def.hasOwnProperty(id)) {obj.setAttributeNS(null,id,def[id].toString())}}} + svg.appendChild(obj); + return obj; + } + }); + + // + // Just use default toCommonHTML for EI8 + // + if (!document.createElementNS) delete MML.menclose.prototype.toCommonHTML; + + MathJax.Hub.Startup.signal.Post("CommonHTML menclose Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/menclose.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/mglyph.js b/js/mathjax/jax/output/CommonHTML/autoload/mglyph.js new file mode 100644 index 0000000..3f1f269 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/mglyph.js @@ -0,0 +1,96 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/mglyph.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML, + LOCALE = MathJax.Localization; + + MML.mglyph.Augment({ + toCommonHTML: function (node,options) { + var values = this.getValues("src","width","height","valign","alt"); + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + if (values.src === "") { + var index = this.Get("index"); + this.CHTMLgetVariant(); + if (index && this.CHTMLvariant.style) + this.CHTMLhandleText(node,String.fromCharCode(index),this.CHTMLvariant); + } else { + var bbox = this.CHTML; + if (!bbox.img) bbox.img = MML.mglyph.GLYPH[values.src]; + if (!bbox.img) { + bbox.img = MML.mglyph.GLYPH[values.src] = {img: new Image(), status: "pending"}; + bbox.img.img.onload = MathJax.Callback(["CHTMLimgLoaded",this]); + bbox.img.img.onerror = MathJax.Callback(["CHTMLimgError",this]); + bbox.img.img.src = values.src; + MathJax.Hub.RestartAfter(bbox.img.img.onload); + } + if (bbox.img.status !== "OK") { + var err = MML.Error(LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)); + err.data[0].data[0].mathsize = "75%"; + this.Append(err); err.toCommonHTML(node); this.data.pop(); + bbox.combine(err.CHTML,0,0,1); + } else { + var img = CHTML.addElement(node,"img",{ + isMathJax:true, src:values.src, alt:values.alt, title:values.alt + }); + var w = values.width, h = values.height; + var W = bbox.img.img.width/CHTML.em, H = bbox.img.img.height/CHTML.em; + var WW = W, HH = H; + if (w !== "") {W = this.CHTMLlength2em(w,WW); H = (WW ? W/WW * HH : 0)} + if (h !== "") {H = this.CHTMLlength2em(h,HH); if (w === "") W = (HH ? H/HH * WW : 0)} + img.style.width = CHTML.Em(W); bbox.w = bbox.r = W; + img.style.height = CHTML.Em(H); bbox.h = bbox.t = H; + if (values.valign) { + bbox.d = bbox.b = -this.CHTMLlength2em(values.valign,HH); + img.style.verticalAlign = CHTML.Em(-bbox.d); + bbox.h -= bbox.d; bbox.t = bbox.h; + } + } + } + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + return node; + }, + CHTMLimgLoaded: function (event,status) { + if (typeof(event) === "string") status = event; + this.CHTML.img.status = (status || "OK"); + }, + CHTMLimgError: function () {this.CHTML.img.img.onload("error")} + },{ + GLYPH: {} // global list of all loaded glyphs + }); + + MathJax.Hub.Startup.signal.Post("CommonHTML mglyph Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/mglyph.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js b/js/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js new file mode 100644 index 0000000..e9cce12 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js @@ -0,0 +1,298 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/mmultiscripts.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML; + + MML.mmultiscripts.Augment({ + toCommonHTML: function (node,options) { + var stretch = (options||{}).stretch; + if (!stretch) { + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLgetVariant(); + this.CHTMLhandleScale(node); + } + CHTML.BBOX.empty(this.CHTML); + + // + // Get base node + // + var base, bbox; + if (stretch) { + base = CHTML.getNode(node,"mjx-base"); + } else { + this.CHTMLaddChild(node,0,{type:"mjx-base", noBBox:true, forceChild:true}); + base = node.firstChild; + } + bbox = this.CHTMLbboxFor(0); + if (bbox.ic) { + bbox.R -= bbox.ic; // remove IC (added by mo and mi) + if (!stretch) base.style.marginRight = CHTML.Em(-bbox.ic); + delta = 1.3*bbox.ic + .05; // make faked IC be closer to expeted results + } + + // + // Collect scripts into horizontal boxes and add them into the node + // + var BOX = {}, BBOX = {}; + this.CHTMLgetScripts(BOX,BBOX,stretch,node); + var sub = BOX.sub, sup = BOX.sup, presub = BOX.presub, presup = BOX.presup; + var sbox = BBOX.sub, Sbox = BBOX.sup, pbox = BBOX.presub, Pbox = BBOX.presup; + if (!stretch) this.CHTMLaddBoxes(node,base,BOX); + + // + // Get the initial values for the variables + // + var values = this.getValues("scriptlevel","scriptsizemultiplier"); + var sscale = (this.Get("scriptlevel") < 3 ? values.scriptsizemultiplier : 1); + var ex = CHTML.TEX.x_height, s = CHTML.TEX.scriptspace; + var q = CHTML.TEX.sup_drop * sscale, r = CHTML.TEX.sub_drop * sscale; + var u = bbox.h - q, v = bbox.d + r, delta = 0, p; + var bmml = this.data[this.base]; + if (bmml && (bmml.type === "mi" || bmml.type === "mo")) { + if (CHTML.isChar(bmml.data.join("")) && bbox.rscale === 1 && !bbox.sH && + !bmml.Get("largeop")) {u = v = 0} + } + values = this.getValues("displaystyle","subscriptshift","superscriptshift","texprimestyle"); + values.subscriptshift = (values.subscriptshift === "" ? 0 : this.CHTMLlength2em(values.subscriptshift)); + values.superscriptshift = (values.superscriptshift === "" ? 0 : this.CHTMLlength2em(values.superscriptshift)); + + var dx = (presub ? s+pbox.w : presup ? s+Pbox.w-delta : 0); + this.CHTML.combine(bbox,dx,0); var x = this.CHTML.w; + + // + // Place the scripts as needed + // + if (!sup && !presup) { + v = Math.max(v,CHTML.TEX.sub1,values.subscriptshift); + if (sub) v = Math.max(v,sbox.h-(4/5)*ex); + if (presub) v = Math.max(v,pbox.h-(4/5)*ex); + if (sub) this.CHTMLplaceSubOnly(sub,sbox,x,v,s); + if (presub) this.CHTMLplacePresubOnly(presub,pbox,v,s); + } else { + if (!sub && !presub) { + p = CHTML.TEX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))]; + u = Math.max(u,p,values.superscriptshift); + if (sup) u = Math.max(u,Sbox.d+(1/4)*ex); + if (presup) u = Math.max(u,Pbox.d+(1/4)*ex); + if (sup) this.CHTMLplaceSupOnly(sup,Sbox,x,delta,u,s); + if (presup) this.CHTMLplacePresupOnly(presup,Pbox,delta,u,s); + } else { + v = Math.max(v,CHTML.TEX.sub2); + var t = CHTML.TEX.rule_thickness; + var h = (sbox||pbox).h, d = (Sbox||Pbox).d; + if (presub) h = Math.max(h,pbox.h); + if (presup) d = Math.max(d,Pbox.d); + if ((u - d) - (h - v) < 3*t) { + v = 3*t - u + d + h; q = (4/5)*ex - (u - d); + if (q > 0) {u += q; v -= q} + } + u = Math.max(u,values.superscriptshift); + v = Math.max(v,values.subscriptshift); + if (sup) { + if (sub) {this.CHTMLplaceSubSup(sub,sbox,sup,Sbox,x,delta,u,v,s)} + else {this.CHTMLplaceSupOnly(sup,Sbox,x,delta,u,s)} + } else if (sub) {this.CHTMLplaceSubOnly(sub,sbox,x,v,s)} + if (presup) { + if (presub) {this.CHTMLplacePresubPresup(presub,pbox,presup,Pbox,delta,u,v,s)} + else {this.CHTMLplacePresupOnly(presup,Pbox,delta,u,s)} + } else if (presub) {this.CHTMLplacePresubOnly(presub,pbox,v,s)} + } + } + this.CHTML.clean(); + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + return node; + }, + // + // Get the subscript, superscript, presubscript, and presuperscript + // boxes, with proper spacing, and computer their bounding boxes. + // + CHTMLgetScripts: function (BOX,BBOX,stretch,node) { + if (stretch) { + BOX.sub = CHTML.getNode(node,"mjx-sub"); + BOX.sup = CHTML.getNode(node,"mjx-sup"); + BOX.presub = CHTML.getNode(node,"mjx-presub"); + BOX.presup = CHTML.getNode(node,"mjx-presup"); + BBOX.sub = this.CHTMLbbox.sub; + BBOX.sup = this.CHTMLbbox.sup; + BBOX.presub = this.CHTMLbbox.presub; + BBOX.presup = this.CHTMLbbox.presup; + return; + } + this.CHTMLbbox = BBOX; // save for when stretched + var state = {i:1, w:0, BOX:BOX, BBOX:BBOX}, m = this.data.length; + var sub = "sub", sup = "sup"; + while (state.i < m) { + if ((this.data[state.i]||{}).type === "mprescripts") { + state.i++; state.w = 0; + sub = "presub"; sup = "presup"; + } else { + var sbox = this.CHTMLaddScript(sub,state,node); + var Sbox = this.CHTMLaddScript(sup,state,node); + var w = Math.max((sbox ? sbox.rscale*sbox.w : 0),(Sbox ? Sbox.rscale*Sbox.w : 0)); + this.CHTMLpadScript(sub,w,sbox,state); + this.CHTMLpadScript(sup,w,Sbox,state); + state.w += w; + } + } + if (BBOX.sub) BBOX.sub.clean(); + if (BBOX.sup) BBOX.sup.clean(); + if (BBOX.presub) BBOX.presub.clean(); + if (BBOX.presup) BBOX.presup.clean(); + }, + // + // Add a script to the proper box, creating the box if needed, + // and padding the box to account for any elements. + // Return the bounding box for the script for later use. + // + CHTMLaddScript: function (type,state,node) { + var BOX, BBOX, data = this.data[state.i]; + if (data && data.type !== "none" && data.type !== "mprescripts") { + BOX = state.BOX[type]; + if (!BOX) { + // + // Add the box to the node temporarily so that it is in the DOM + // (so that CHTMLnodeElement() can be used in the toCommonHTML() below). + // See issue #1480. + // + BOX = state.BOX[type] = CHTML.addElement(node,"mjx-"+type); + BBOX = state.BBOX[type] = CHTML.BBOX.empty(); + if (state.w) { + BOX.style.paddingLeft = CHTML.Em(state.w); + BBOX.w = BBOX.r = state.w; BBOX.x = state.w; + } + } + data.toCommonHTML(BOX); + BBOX = data.CHTML; + } + if (data && data.type !== "mprescripts") state.i++; + return BBOX; + }, + // + // Add padding to the script box to make match the width of the + // super- or subscript that is above or below it, and adjust the + // bounding box for the script row. If these are pre-scripts, + // right-justify the scripts, otherwise, left-justify them. + // + CHTMLpadScript: function (type,w,bbox,state) { + if (!bbox) bbox = {w:0, fake:1, rscale:1}; + var BBOX = state.BBOX[type], dx = 0, dw = 0; + if (BBOX) { + if (bbox.rscale*bbox.w < w) { + var BOX = state.BOX[type]; dw = w-bbox.rscale*bbox.w; + var space = CHTML.Element("mjx-spacer",{style:{width:CHTML.Em(dw)}}); + if (type.substr(0,3) === "pre" && !bbox.fake) { + BOX.insertBefore(space,BOX.lastChild); + dx = dw; dw = 0; + } else { + BOX.appendChild(space); + } + } + if (bbox.fake) {BBOX.w += dx} else {BBOX.combine(bbox,BBOX.w+dx,0)} + BBOX.w += dw; + } + }, + // + // Add the boxes into the main node, creating stacks when needed + // + CHTMLaddBoxes: function (node,base,BOX) { + var sub = BOX.sub, sup = BOX.sup, presub = BOX.presub, presup = BOX.presup; + if (presub && presup) { + var prestack = CHTML.Element("mjx-prestack"); node.insertBefore(prestack,base); + prestack.appendChild(presup); prestack.appendChild(presub); + } else { + if (presub) node.insertBefore(presub,base); + if (presup) node.insertBefore(presup,base); + } + if (sub && sup) { + var stack = CHTML.addElement(node,"mjx-stack"); + stack.appendChild(sup); stack.appendChild(sub); + } else { + if (sub) node.appendChild(sub); + if (sup) node.appendChild(sup); + } + }, + // + // Handle positioning the various scripts + // + CHTMLplaceSubOnly: function (sub,sbox,x,v,s) { + sub.style.verticalAlign = CHTML.Em(-v); + sub.style.marginRight = CHTML.Em(s); sbox.w += s; + this.CHTML.combine(sbox,x,-v); + }, + CHTMLplaceSupOnly: function (sup,Sbox,x,delta,u,s) { + sup.style.verticalAlign = CHTML.Em(u); + sup.style.paddingLeft = CHTML.Em(delta); + sup.style.paddingRight = CHTML.Em(s); Sbox.w += s; + this.CHTML.combine(Sbox,x+delta,u); + }, + CHTMLplaceSubSup: function (sub,sbox,sup,Sbox,x,delta,u,v,s) { + sub.style.paddingRight = CHTML.Em(s); sbox.w += s; + sup.style.paddingBottom = CHTML.Em(u+v-Sbox.d-sbox.h); + sup.style.paddingLeft = CHTML.Em(delta+(Sbox.x||0)); + sup.style.paddingRight = CHTML.Em(s); Sbox.w += s; + sup.parentNode.style.verticalAlign = CHTML.Em(-v); + this.CHTML.combine(sbox,x,-v); + this.CHTML.combine(Sbox,x+delta,u); + }, + CHTMLplacePresubOnly: function (presub,pbox,v,s) { + presub.style.verticalAlign = CHTML.Em(-v); + presub.style.marginLeft = CHTML.Em(s); + this.CHTML.combine(pbox,s,-v); + }, + CHTMLplacePresupOnly: function (presup,Pbox,delta,u,s) { + presup.style.verticalAlign = CHTML.Em(u); + presup.style.paddingLeft = CHTML.Em(s); + presup.style.paddingRight = CHTML.Em(-delta); + this.CHTML.combine(Pbox,s,u); + }, + CHTMLplacePresubPresup: function (presub,pbox,presup,Pbox,delta,u,v,s) { + presub.style.paddingLeft = CHTML.Em(s); + presup.style.paddingBottom = CHTML.Em(u+v-Pbox.d-pbox.h); + presup.style.paddingLeft = CHTML.Em(delta+s+(Pbox.x||0)); + presup.style.paddingRight = CHTML.Em(-delta); + presup.parentNode.style.verticalAlign = CHTML.Em(-v); + this.CHTML.combine(pbox,s,-v); + this.CHTML.combine(Pbox,s+delta,u); + }, + // + // Handle stretchy bases + // + CHTMLstretchH: MML.mbase.CHTMLstretchH, + CHTMLstretchV: MML.mbase.CHTMLstretchV + }); + + MathJax.Hub.Startup.signal.Post("CommonHTML mmultiscripts Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/mmultiscripts.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/ms.js b/js/mathjax/jax/output/CommonHTML/autoload/ms.js new file mode 100644 index 0000000..ded30fc --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/ms.js @@ -0,0 +1,75 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/ms.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CHTML = MathJax.OutputJax.CommonHTML; + + MML.ms.Augment({ + toCommonHTML: function (node) { + // + // Create the node and handle its styles and scaling + // Get the variant and an empty bounding box + // + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLgetVariant(); + this.CHTMLhandleScale(node); + CHTML.BBOX.empty(this.CHTML); + // + // Get the quotes to use + // + var values = this.getValues("lquote","rquote","mathvariant"); + if (!this.hasValue("lquote") || values.lquote === '"') values.lquote = "\u201C"; + if (!this.hasValue("rquote") || values.rquote === '"') values.rquote = "\u201D"; + if (values.lquote === "\u201C" && values.mathvariant === "monospace") values.lquote = '"'; + if (values.rquote === "\u201D" && values.mathvariant === "monospace") values.rquote = '"'; + // + // Add the left quote, the child nodes, and the right quote + // + var text = values.lquote+this.data.join("")+values.rquote; // FIXME: handle mglyph? + this.CHTMLhandleText(node,text,this.CHTMLvariant); + // + // Finish the bbox, add any needed space and color + // + this.CHTML.clean(); + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + // + // Return the completed node + // + return node; + } + }); + + MathJax.Hub.Startup.signal.Post("CommonHTML ms Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/ms.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/mtable.js b/js/mathjax/jax/output/CommonHTML/autoload/mtable.js new file mode 100644 index 0000000..2e8b397 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/mtable.js @@ -0,0 +1,604 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/mtable.js + * + * Implements the CommonHTML output for elements. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CONFIG = MathJax.Hub.config, + CHTML = MathJax.OutputJax.CommonHTML, + SPLIT = MathJax.Hub.SplitList; + + var LABEL = -1, + BIGDIMEN = 1000000; + + MML.mtable.Augment({ + toCommonHTML: function (node) { + // + // Create the table nodes and put them in a table + // (so that its bottom is on the baseline, rather than aligned on the top row) + // + var state = {rows:[], labels:[], labeled: false}; + node = this.CHTMLdefaultNode(node,{noBBox:true, childOptions:state}); + var table = CHTML.Element("mjx-table"); + while (node.firstChild) table.appendChild(node.firstChild); + node.appendChild(table); + // + // Get the table attributes + // + var values = this.getValues("columnalign","rowalign","columnspacing","rowspacing", + "columnwidth","equalcolumns","equalrows", + "columnlines","rowlines","frame","framespacing", + "align","width","side","minlabelspacing","useHeight"); + var t = CHTML.TEX.min_rule_thickness/CHTML.em; + state.t = CHTML.Px(t*this.CHTML.scale,1); + // + // Create the table + // + this.CHTMLgetBoxSizes(values,state); + this.CHTMLgetAttributes(values,state); + this.CHTMLadjustCells(values,state); + if (values.frame) table.style.border = state.t+" "+values.frame; + this.CHTMLalignV(values,state,node); + this.CHTMLcolumnWidths(values,state,node); + this.CHTMLstretchCells(values,state); + if (state.labeled) this.CHTMLaddLabels(values,state,node,table); + // + // Set the bounding box (ignores overlapping outside of the table) + // + var BBOX = this.CHTML; + BBOX.w = BBOX.r = state.R; + BBOX.h = BBOX.t = state.T-state.B; + BBOX.d = BBOX.b = state.B; + if (!values.frame && !BBOX.pwidth) { + node.style.padding = "0 "+CHTML.Em(1/6); + BBOX.L = BBOX.R = 1/6; + } + // + // Add any needed space and color + // + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + // + // Return the completed node + // + return node; + }, + // + // Get the natural height, depth, and widths of the rows and columns + // + CHTMLgetBoxSizes: function (values,state) { + var LH = CHTML.FONTDATA.lineH * values.useHeight, + LD = CHTML.FONTDATA.lineD * values.useHeight; + var H = [], D = [], W = [], J = -1, i, m; + for (i = 0, m = this.data.length; i < m; i++) { + var row = this.data[i], s = (row.type === "mtr" ? 0 : LABEL); + H[i] = LH; D[i] = LD; + for (var j = s, M = row.data.length + s; j < M; j++) { + if (W[j] == null) {W[j] = -BIGDIMEN; if (j > J) J = j} + var cbox = row.data[j-s].CHTML; + if (cbox.h > H[i]) H[i] = cbox.h; + if (cbox.d > D[i]) D[i] = cbox.d; + if (cbox.w > W[j]) W[j] = cbox.w; + } + } + if (values.equalrows) { + state.HD = true; + var HH = Math.max.apply(Math,H); + var DD = Math.max.apply(Math,D); + for (i = 0, m = H.length; i < m; i++) {H[i] = HH; D[i] = DD} + } + state.H = H; state.D = D; state.W = W, state.J = J; + }, + // + // Pad the spacing and alignment attributes to match the size of the table + // + CHTMLgetAttributes: function (values,state) { + var CSPACE = SPLIT(values.columnspacing), + RSPACE = SPLIT(values.rowspacing), + CALIGN = SPLIT(values.columnalign), + RALIGN = SPLIT(values.rowalign), + CLINES = SPLIT(values.columnlines), + RLINES = SPLIT(values.rowlines), + CWIDTH = SPLIT(values.columnwidth), + RCALIGN = [], i, m, J = state.J, M = state.rows.length-1; + for (i = 0, m = CSPACE.length; i < m; i++) CSPACE[i] = this.CHTMLlength2em(CSPACE[i]); + for (i = 0, m = RSPACE.length; i < m; i++) RSPACE[i] = this.CHTMLlength2em(RSPACE[i]); + while (CSPACE.length < J) CSPACE.push(CSPACE[CSPACE.length-1]); + while (CALIGN.length <= J) CALIGN.push(CALIGN[CALIGN.length-1]); + while (CLINES.length < J) CLINES.push(CLINES[CLINES.length-1]); + while (CWIDTH.length <= J) CWIDTH.push(CWIDTH[CWIDTH.length-1]); + while (RSPACE.length < M) RSPACE.push(RSPACE[RSPACE.length-1]); + while (RALIGN.length <= M) RALIGN.push(RALIGN[RALIGN.length-1]); + while (RLINES.length < M) RLINES.push(RLINES[RLINES.length-1]); + CALIGN[LABEL] = (values.side.substr(0,1) === "l" ? "left" : "right"); + // + // Override aligment data based on row-specific attributes + // + for (i = 0; i <= M; i++) { + var row = this.data[i]; RCALIGN[i] = []; + if (row.rowalign) RALIGN[i] = row.rowalign; + if (row.columnalign) { + RCALIGN[i] = SPLIT(row.columnalign); + while (RCALIGN[i].length <= J) RCALIGN[i].push(RCALIGN[i][RCALIGN[i].length-1]); + } + } + // + // Handle framespacing + // + var FSPACE = SPLIT(values.framespacing); + if (FSPACE.length != 2) FSPACE = SPLIT(this.defaults.framespacing); + FSPACE[0] = Math.max(0,this.CHTMLlength2em(FSPACE[0])); + FSPACE[1] = Math.max(0,this.CHTMLlength2em(FSPACE[1])); + if (values.columnlines.replace(/none/g,"").replace(/ /g,"") !== "" || + values.rowlines.replace(/none/g,"").replace(/ /g,"") !== "") values.fspace = true; + // + // Pad arrays so that final column can be treated as all the others + // + if (values.frame === MML.LINES.NONE) delete values.frame; else values.fspace = true; + if (values.frame) { + FSPACE[0] = Math.max(0,FSPACE[0]); + FSPACE[1] = Math.max(0,FSPACE[1]); + } + if (values.fspace) { + CSPACE[J] = FSPACE[0]; RSPACE[M] = FSPACE[1]; + } else { + CSPACE[J] = RSPACE[M] = 0; + } + CLINES[J] = RLINES[M] = MML.LINES.NONE; + // + // Save everything in the state + // + state.CSPACE = CSPACE; state.RSPACE = RSPACE; + state.CALIGN = CALIGN; state.RALIGN = RALIGN; + state.CLINES = CLINES; state.RLINES = RLINES; + state.CWIDTH = CWIDTH; state.RCALIGN = RCALIGN; + state.FSPACE = FSPACE; + }, + // + // Add styles to cells to handle borders, spacing, alignment, etc. + // + CHTMLadjustCells: function(values,state) { + var ROWS = state.rows, + CSPACE = state.CSPACE, CLINES = state.CLINES, + RSPACE = state.RSPACE, RLINES = state.RLINES, + CALIGN = state.CALIGN, RALIGN = state.RALIGN, + RCALIGN = state.RCALIGN; + CSPACE[state.J] *= 2; RSPACE[ROWS.length-1] *= 2; // since halved below + var T = "0", B, R, L, border, cbox, align, lastB = 0; + if (values.fspace) { + lastB = state.FSPACE[1]; + T = CHTML.Em(state.FSPACE[1]); + } + state.RHD = []; state.RH = []; + for (var i = 0, m = ROWS.length; i < m; i++) { + var row = ROWS[i], rdata = this.data[i]; + // + // Space and borders between rows + // + B = RSPACE[i]/2; border = null; L = "0"; + if (RLINES[i] !== MML.LINES.NONE && RLINES[i] !== "") border = state.t+" "+RLINES[i]; + if (border || (CLINES[j] !== MML.LINES.NONE && CLINES[j] !== "")) { + while (row.length <= state.J) { + row.push(CHTML.addElement(row.node,"mjx-mtd",null,[['span']])); + } + } + state.RH[i] = lastB + state.H[i]; // distance to baseline in row + lastB = Math.max(0,B); + state.RHD[i] = state.RH[i] + lastB + state.D[i]; // total height of row + B = CHTML.Em(lastB); + // + // Frame space for initial cell + // + if (values.fspace) L = CHTML.Em(state.FSPACE[0]); + // + // The cells in the row + // + for (var j = 0, M = row.length; j < M; j++) { + var s = (rdata.type === "mtr" ? 0 : LABEL); + var mtd = rdata.data[j-s] || {CHTML: CHTML.BBOX.zero()}; + var cell = row[j].style; cbox = mtd.CHTML; + // + // Space and borders between columns + // + R = CSPACE[j]/2; + if (CLINES[j] !== MML.LINES.NONE) { + cell.borderRight = state.t+" "+CLINES[j]; + R -= 1/CHTML.em/2; + } + R = CHTML.Em(Math.max(0,R)); + cell.padding = T+" "+R+" 0px "+L; + if (border) cell.borderBottom = border; + L = R; + // + // Handle vertical alignment + // + align = (mtd.rowalign||(this.data[i]||{}).rowalign||RALIGN[i]); + var H = Math.max(1,cbox.h), D = Math.max(.2,cbox.d), + HD = (state.H[i]+state.D[i]) - (H+D), + child = row[j].firstChild.style; + if (align === MML.ALIGN.TOP) { + if (HD) child.marginBottom = CHTML.Em(HD); + cell.verticalAlign = "top"; + } else if (align === MML.ALIGN.BOTTOM) { + cell.verticalAlign = "bottom"; + if (HD) child.marginTop = CHTML.Em(HD); + } else if (align === MML.ALIGN.CENTER) { + if (HD) child.marginTop = child.marginBottom = CHTML.Em(HD/2); + cell.verticalAlign = "middle"; + } else { + if (H !== state.H[i]) child.marginTop = CHTML.Em(state.H[i]-H); + } + // + // Handle horizontal alignment + // + align = (mtd.columnalign||RCALIGN[i][j]||CALIGN[j]); + if (align !== MML.ALIGN.CENTER) cell.textAlign = align; + } + row.node.style.height = CHTML.Em(state.RHD[i]); + T = B; + } + CSPACE[state.J] /= 2; RSPACE[ROWS.length-1] /= 2; // back to normal + }, + // + // Align the table vertically according to the align attribute + // + CHTMLalignV: function (values,state,node) { + var n, M = state.rows.length, H = state.H, D = state.D, RSPACE = state.RSPACE; + // + // Get alignment type and row number + // + if (typeof(values.align) !== "string") values.align = String(values.align); + if (values.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)) { + n = parseInt(RegExp.$3||"0"); + values.align = RegExp.$1 + if (n < 0) n += state.rows.length + 1; + if (n > M || n <= 0) n = null; + } else { + values.align = this.defaults.align; + } + // + // Get table height and baseline offset + // + var T = 0, B = 0, a = CHTML.TEX.axis_height; + if (values.fspace) T += state.FSPACE[1]; + if (values.frame) {T += 2/CHTML.em; B += 1/CHTML.em} + for (var i = 0; i < M; i++) { + var h = H[i], d = D[i]; + T += h + d + RSPACE[i]; + if (n) { + if (i === n-1) { + B += ({top:h+d, bottom:0, center:(h+d)/2, + baseline:d, axis:a+d})[values.align] + RSPACE[i]; + } + if (i >= n) B += h + d + RSPACE[i]; + } + } + if (!n) B = ({top:T, bottom:0, center:T/2, baseline:T/2, axis:T/2-a})[values.align]; + // + // Place the node and save the values + // + if (B) node.style.verticalAlign = CHTML.Em(-B); + state.T = T; state.B = B; + }, + // + // Determine column widths and set the styles for the columns + // + CHTMLcolumnWidths: function (values,state,node) { + var CWIDTH = state.CWIDTH, CSPACE = state.CSPACE, J = state.J, j; + var WW = 0, setWidths = false, relWidth = values.width.match(/%$/); + var i, m, w; + // + // Handle equal columns by adjusting the CWIDTH array + // + if (values.width !== "auto" && !relWidth) { + WW = Math.max(0,this.CHTMLlength2em(values.width,state.R)); + setWidths = true; + } + if (values.equalcolumns) { + if (relWidth) { + // + // Use percent of total (not perfect, but best we can do) + // + var p = CHTML.Percent(1/(J+1)); + for (j = 0; j <= J; j++) CWIDTH[j] = p; + } else { + // + // For width = auto, make all widths equal the widest, + // otherwise, for specific width, remove intercolumn space + // and divide by number of columns to get widest space. + // + w = Math.max.apply(Math,state.W); + if (values.width !== "auto") { + var S = (values.fspace ? state.FSPACE[0] + (values.frame ? 2/CHTML.em : 0) : 0); + for (j = 0; j <= J; j++) S += CSPACE[j]; + w = Math.max((WW-S)/(J+1),w); + } + w = CHTML.Em(w); + for (j = 0; j <= J; j++) CWIDTH[j] = w; + } + setWidths = true; + } + // + // Compute natural table width + // + var TW = 0; if (values.fspace) TW = state.FSPACE[0]; + var auto = [], fit = [], percent = [], W = []; + var row = state.rows[0]; + for (j = 0; j <= J; j++) { + W[j] = state.W[j]; + if (CWIDTH[j] === "auto") auto.push(j) + else if (CWIDTH[j] === "fit") fit.push(j) + else if (CWIDTH[j].match(/%$/)) percent.push(j) + else W[j] = this.CHTMLlength2em(CWIDTH[j],W[j]); + TW += W[j] + CSPACE[j]; + if (row[j]) row[j].style.width = CHTML.Em(W[j]); + } + if (values.frame) TW += 2/CHTML.em; + var hasFit = (fit.length > 0); + // + // Adjust widths of columns + // + if (setWidths || (relWidth && hasFit)) { + if (relWidth) { + // + // Attach appropriate widths to the columns + // + for (j = 0; j <= J; j++) { + cell = row[j].style; + if (CWIDTH[j] === "auto" && !hasFit) cell.width = ""; + else if (CWIDTH[j] === "fit") cell.width = ""; + else if (CWIDTH[j].match(/%$/)) cell.width = CWIDTH[j]; + else cell.minWidth = cell.maxWidth = cell.width; + } + } else { + // + // Compute percentage widths + // + if (WW > TW) { + var extra = 0; + for (i = 0, m = percent.length; i < m; i++) { + j = percent[i]; + w = Math.max(W[j],this.CHTMLlength2em(CWIDTH[j],WW)); + extra += w-W[j]; W[j] = w; + row[j].style.width = CHTML.Em(w); + } + TW += extra; + } + // + // Compute "fit" widths + // + if (!hasFit) fit = auto; + if (WW > TW && fit.length) { + var dw = (WW - TW) / fit.length; + for (i = 0, m = fit.length; i < m; i++) { + j = fit[i]; W[j] += dw; + row[j].style.width = CHTML.Em(W[j]); + } + TW = WW; + } + } + } + W[LABEL] = state.W[LABEL]; + state.W = W; + state.R = TW; + // + // Set variable width on DOM nodes + // + if (relWidth) { + node.style.width = this.CHTML.pwidth = "100%"; + this.CHTML.mwidth = CHTML.Em(TW); + node.firstChild.style.width = values.width; + node.firstChild.style.margin = "auto"; + } + }, + // + // Stretch any cells that can be stretched + // + CHTMLstretchCells: function (values,state) { + var ROWS = state.rows, H = state.H, D = state.D, W = state.W, + J = state.J, M = ROWS.length-1; + for (var i = 0; i <= M; i++) { + var row = ROWS[i], rdata = this.data[i]; + var h = H[i], d = D[i]; + for (var j = 0; j <= J; j++) { + var cell = row[j], cdata = rdata.data[j]; + if (!cdata) continue; + if (cdata.CHTML.stretch === "V") cdata.CHTMLstretchV(h,d); + else if (cdata.CHTML.stretch === "H") cdata.CHTMLstretchH(cell,W[j]); + } + } + }, + // + // Add labels to a table + // + CHTMLaddLabels: function (values,state,node,table) { + // + // Get indentation and alignment + // + var indent = this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift"); + if (indent.indentalignfirst !== MML.INDENTALIGN.INDENTALIGN) indent.indentalign = indent.indentalignfirst; + if (indent.indentalign === MML.INDENTALIGN.AUTO) indent.indentalign = CONFIG.displayAlign; + if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) indent.indentshift = indent.indentshiftfirst; + if (indent.indentshift === "auto") indent.indentshift = "0"; + var shift = this.CHTMLlength2em(indent.indentshift,CHTML.cwidth); + var labelspace = this.CHTMLlength2em(values.minlabelspacing,.8); + var labelW = labelspace + state.W[LABEL], labelshift = 0, tw = state.R; + var dIndent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth); + var s = (state.CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1); + if (indent.indentalign === MML.INDENTALIGN.CENTER) { + tw += 2 * (labelW - s*(shift + dIndent)); + shift += dIndent; + } else if (state.CALIGN[LABEL] === indent.indentalign) { + if (dIndent < 0) {labelshift = s*dIndent; dIndent = 0} + shift += s*dIndent; if (labelW > s*shift) shift = s*labelW; shift += labelshift; + shift *= s; tw += shift; + } else { + tw += labelW - s*shift + dIndent; + shift -= s*dIndent; shift *= -s; + } + // + // Create boxes for table and labels + // + var box = CHTML.addElement(node,"mjx-box",{ + style:{width:"100%","text-align":indent.indentalign} + }); box.appendChild(table); + var labels = CHTML.Element("mjx-itable"); + table.style.display = "inline-table"; if (!table.style.width) table.style.width = "auto"; + labels.style.verticalAlign = "top"; + table.style.verticalAlign = CHTML.Em(state.T-state.B-state.H[0]); + node.style.verticalAlign = ""; + if (shift) { + if (indent.indentalign === MML.INDENTALIGN.CENTER) { + table.style.marginLeft = CHTML.Em(shift); + table.style.marginRight = CHTML.Em(-shift); + } else { + var margin = "margin" + (indent.indentalign === MML.INDENTALIGN.RIGHT ? "Right" : "Left"); + table.style[margin] = CHTML.Em(shift); + } + } + // + // Add labels on correct side + // + if (state.CALIGN[LABEL] === "left") { + node.insertBefore(labels,box); + labels.style.marginRight = CHTML.Em(-state.W[LABEL]-labelshift); + if (labelshift) labels.style.marginLeft = CHTML.Em(labelshift); + } else { + node.appendChild(labels); + labels.style.marginLeft = CHTML.Em(-state.W[LABEL]+labelshift); + } + // + // Vertically align the labels with their rows + // + var LABELS = state.labels, T = 0; + if (values.fspace) T = state.FSPACE[0] + (values.frame ? 1/CHTML.em : 0); + for (var i = 0, m = LABELS.length; i < m; i++) { + if (LABELS[i] && this.data[i].data[0]) { + labels.appendChild(LABELS[i]); + var lbox = this.data[i].data[0].CHTML; + T = state.RH[i] - Math.max(1,lbox.h); + if (T) LABELS[i].firstChild.firstChild.style.marginTop = CHTML.Em(T); + LABELS[i].style.height = CHTML.Em(state.RHD[i]); + } else { + CHTML.addElement(labels,"mjx-label",{style:{height:CHTML.Em(state.RHD[i])}}); + } + } + // + // Propagate full-width equations, and reserve room for equation plus label + // + node.style.width = this.CHTML.pwidth = "100%"; + node.style.minWidth = this.CHTML.mwidth = CHTML.Em(Math.max(0,tw)); + } + }); + + MML.mtr.Augment({ + toCommonHTML: function (node,options) { + // + // Create the row node + // + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + // + // Add a new row with no label + // + if (!options) options = {rows:[],labels:[]}; + var row = []; options.rows.push(row); row.node = node; + options.labels.push(null); + // + // Add the cells to the row + // + for (var i = 0, m = this.data.length; i < m; i++) + row.push(this.CHTMLaddChild(node,i,options)); + // + this.CHTMLhandleColor(node); + return node; + } + }); + MML.mlabeledtr.Augment({ + toCommonHTML: function (node,options) { + // + // Create the row node + // + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + // + // Add a new row, and get the label + // + if (!options) options = {rows:[],labels:[]}; + var row = []; options.rows.push(row); row.node = node; + var label = CHTML.Element("mjx-label"); options.labels.push(label); + this.CHTMLaddChild(label,0,options); + if (this.data[0]) options.labeled = true; + // + // Add the cells to the row + // + for (var i = 1, m = this.data.length; i < m; i++) + row.push(this.CHTMLaddChild(node,i,options)); + // + this.CHTMLhandleColor(node); + return node; + } + }); + MML.mtd.Augment({ + toCommonHTML: function (node,options) { + node = this.CHTMLdefaultNode(node,options); + CHTML.addElement(node.firstChild,"mjx-strut"); // forces height to 1em (we adjust later) + // + // Determine if this is stretchy or not + // + if (this.isEmbellished()) { + var mo = this.CoreMO(), BBOX = this.CHTML; + if (mo.CHTMLcanStretch("Vertical")) BBOX.stretch = "V"; + else if (mo.CHTMLcanStretch("Horizontal")) BBOX.stretch = "H"; + if (BBOX.stretch) { + var min = mo.Get("minsize",true); + if (min) { + if (BBOX.stretch === "V") { + var HD = BBOX.h + BBOX.d; + if (HD) { + var r = this.CHTMLlength2em(min,HD)/HD; + if (r > 1) {BBOX.h *= r; BBOX.d *= r} + } + } else { + BBOX.w = Math.max(BBOX.w,this.CHTMLlength2em(min,BBOX.w)); + } + } + } + } + return node; + } + }); + + + MathJax.Hub.Startup.signal.Post("CommonHTML mtable Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/mtable.js"); +}); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/autoload/multiline.js b/js/mathjax/jax/output/CommonHTML/autoload/multiline.js new file mode 100644 index 0000000..9d54b99 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/autoload/multiline.js @@ -0,0 +1,799 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/autoload/multiline.js + * + * Implements the CommonHTML output for 's that contain line breaks. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { + var VERSION = "2.7.9"; + var MML = MathJax.ElementJax.mml, + CONFIG = MathJax.Hub.config, + CHTML = MathJax.OutputJax.CommonHTML; + // + // Fake node used for testing end-of-line potential breakpoint + // + var MO = MML.mo().With({CHTML: CHTML.BBOX.empty()}); + + // + // Penalties for the various line breaks + // + var PENALTY = { + newline: 0, + nobreak: 1000000, + goodbreak: [-200], + badbreak: [+200], + auto: [0], + + maxwidth: 1.33, // stop looking for breaks after this time the line-break width + toobig: 800, + nestfactor: 400, + spacefactor: -100, + spaceoffset: 2, + spacelimit: 1, // spaces larger than this get a penalty boost + fence: 500, + close: 500 + }; + + var ENDVALUES = {linebreakstyle: "after"}; + + + /**************************************************************************/ + + MML.mbase.Augment({ + CHTMLlinebreakPenalty: PENALTY, + + /****************************************************************/ + // + // Handle breaking an mrow into separate lines + // + CHTMLmultiline: function (node) { + + // + // Find the parent element and mark it as multiline + // + var parent = this; + while (parent.inferred || (parent.parent && parent.parent.type === "mrow" && + parent.parent.isEmbellished())) {parent = parent.parent} + var isTop = ((parent.type === "math" && parent.Get("display") === "block") || + parent.type === "mtd"); + parent.isMultiline = true; + + // + // Default values for the line-breaking parameters + // + var VALUES = this.getValues( + "linebreak","linebreakstyle","lineleading","linebreakmultchar", + "indentalign","indentshift", + "indentalignfirst","indentshiftfirst", + "indentalignlast","indentshiftlast" + ); + if (VALUES.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE) + VALUES.linebreakstyle = this.Get("infixlinebreakstyle"); + VALUES.lineleading = this.CHTMLlength2em(VALUES.lineleading,0.5); + + // + // Break the math at its best line breaks + // + CHTML.BBOX.empty(this.CHTML); + var stack = CHTML.addElement(node,"mjx-stack"); + var state = { + BBOX: this.CHTML, + n: 0, Y: 0, + scale: (this.CHTML.scale||1), + isTop: isTop, + values: {}, + VALUES: VALUES + }, + align = this.CHTMLgetAlign(state,{}), + shift = this.CHTMLgetShift(state,{},align), + start = [], + end = { + index:[], penalty:PENALTY.nobreak, + w:0, W:shift, shift:shift, scanW:shift, + nest: 0 + }, + broken = false; + + while (this.CHTMLbetterBreak(end,state,true) && + (end.scanW >= CHTML.linebreakWidth || end.penalty === PENALTY.newline)) { + this.CHTMLaddLine(stack,start,end.index,state,end.values,broken); + start = end.index.slice(0); broken = true; + align = this.CHTMLgetAlign(state,end.values); + shift = this.CHTMLgetShift(state,end.values,align); + end.W = end.shift = end.scanW = shift; end.penalty = PENALTY.nobreak; + } + state.isLast = true; + this.CHTMLaddLine(stack,start,[],state,ENDVALUES,broken); + + if (parent.type === "math") { + node.style.width = stack.style.width = this.CHTML.pwidth = "100%"; + } + this.CHTML.mwidth = CHTML.Em(this.CHTML.w); + this.CHTML.isMultiline = parent.CHTML.isMultiline = true; + stack.style.verticalAlign = CHTML.Em(state.d - this.CHTML.d); + + return node; + }, + + /****************************************************************/ + // + // Locate the next linebreak that is better than the current one + // + CHTMLbetterBreak: function (info,state,toplevel) { + if (this.isToken) return false; // FIXME: handle breaking of token elements + if (this.isEmbellished()) { + info.embellished = this; + return this.CoreMO().CHTMLbetterBreak(info,state); + } + if (this.linebreakContainer) return false; + // + // Get the current breakpoint position and other data + // + var index = info.index.slice(0), i = info.index.shift(), + m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false; + if (i == null) i = -1; if (!broken) {i++; info.W += info.w; info.w = 0} + scanW = info.scanW = info.W; info.nest++; + // + // Look through the line for breakpoints, + // (as long as we are not too far past the breaking width) + // + while (i < m && (info.scanW < PENALTY.maxwidth*CHTML.linebreakWidth || info.w === 0)) { + if (this.data[i]) { + if (this.data[i].CHTMLbetterBreak(info,state)) { + better = true; index = [i].concat(info.index); W = info.W; w = info.w; + if (info.penalty === PENALTY.newline) { + info.index = index; + if (info.nest) {info.nest--} + return true; + } + } + scanW = (broken ? info.scanW : this.CHTMLaddWidth(i,info,scanW)); + } + info.index = []; i++; broken = false; + } + // + // Check if end-of-line is a better breakpoint + // + if (toplevel && better) { + MO.parent = this.parent; MO.inherit = this.inherit; + if (MO.CHTMLbetterBreak(info,state)) {better = false; index = info.index} + } + if (info.nest) {info.nest--} + info.index = index; + if (better) {info.W = W; info.w = w} + return better; + }, + CHTMLaddWidth: function (i,info,scanW) { + if (this.data[i]) { + var bbox = this.data[i].CHTML; + scanW += (bbox.w + (bbox.L||0) + (bbox.R||0)) * (bbox.scale || 1); + info.W = info.scanW = scanW; info.w = 0; + } + return scanW; + }, + + /****************************************************************/ + // + // Create a new line and move the required elements into it + // Position it using proper alignment and indenting + // + CHTMLaddLine: function (stack,start,end,state,values,broken) { + // + // Create a box for the line, with empty BBox + // fill it with the proper elements, + // and clean up the bbox + // + var block = CHTML.addElement(stack,"mjx-block",{},[["mjx-box"]]), line = block.firstChild; + var bbox = state.bbox = CHTML.BBOX.empty(); + state.first = broken; state.last = true; + this.CHTMLmoveLine(start,end,line,state,values); + bbox.clean(); + // + // Get the alignment and shift values + // + var align = this.CHTMLgetAlign(state,values), + shift = this.CHTMLgetShift(state,values,align,true); + // + // Set the Y offset based on previous depth, leading, and current height + // + var dY = 0; + if (state.n > 0) { + var LHD = CHTML.FONTDATA.baselineskip; + var leading = (state.values.lineleading == null ? state.VALUES : state.values).lineleading * state.scale; + var Y = state.Y; + state.Y -= Math.max(LHD,state.d + bbox.h + leading); + dY = Y - state.Y - state.d - bbox.h; + } + // + // Place the new line + // + if (shift) line.style.margin = "0 "+CHTML.Em(-shift)+" 0 "+CHTML.Em(shift); + if (align !== MML.INDENTALIGN.LEFT) block.style.textAlign = align; + if (dY) block.style.paddingTop = CHTML.Em(dY); + state.BBOX.combine(bbox,shift,state.Y); + // + // Save the values needed for the future + // + state.d = state.bbox.d; state.values = values; state.n++; + }, + + /****************************************************************/ + // + // Get alignment and shift values from the given data + // + CHTMLgetAlign: function (state,values) { + var cur = values, prev = state.values, def = state.VALUES, align; + if (state.n === 0) align = cur.indentalignfirst || prev.indentalignfirst || def.indentalignfirst; + else if (state.isLast) align = prev.indentalignlast || def.indentalignlast; + else align = prev.indentalign || def.indentalign; + if (align === MML.INDENTALIGN.INDENTALIGN) align = prev.indentalign || def.indentalign; + if (align === MML.INDENTALIGN.AUTO) align = (state.isTop ? CONFIG.displayAlign : MML.INDENTALIGN.LEFT); + return align; + }, + CHTMLgetShift: function (state,values,align,noadjust) { + var cur = values, prev = state.values, def = state.VALUES, shift; + if (state.n === 0) shift = cur.indentshiftfirst || prev.indentshiftfirst || def.indentshiftfirst; + else if (state.isLast) shift = prev.indentshiftlast || def.indentshiftlast; + else shift = prev.indentshift || def.indentshift; + if (shift === MML.INDENTSHIFT.INDENTSHIFT) shift = prev.indentshift || def.indentshift; + if (shift === "auto" || shift === "") shift = "0"; + shift = this.CHTMLlength2em(shift,CHTML.cwidth); + if (state.isTop && CONFIG.displayIndent !== "0") { + var indent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth); + shift += (align === MML.INDENTALIGN.RIGHT ? -indent : indent); + } + return (align === MML.INDENTALIGN.RIGHT && !noadjust ? -shift : shift); + }, + + /****************************************************************/ + // + // Move the selected elements into the new line's box, + // moving whole items when possible, and parts of ones + // that are split by a line break. + // + CHTMLmoveLine: function (start,end,node,state,values) { + var i = start[0], j = end[0]; + if (i == null) i = -1; if (j == null) j = this.data.length-1; + if (i === j && start.length > 1) { + // + // If starting and ending in the same element move the subpiece to the new line + // + this.data[i].CHTMLmoveSlice(start.slice(1),end.slice(1),node,state,values,"marginLeft"); + } else { + // + // Otherwise, move the remainder of the initial item + // and any others up to the last one + // + var last = state.last; state.last = false; + while (i < j) { + if (this.data[i]) { + if (start.length <= 1) this.data[i].CHTMLmoveNode(node,state,values); + else this.data[i].CHTMLmoveSlice(start.slice(1),[],node,state,values,"marginLeft"); + } + i++; state.first = false; start = []; + } + // + // If the last item is complete, move it, + // otherwise move the first part of it up to the split + // + state.last = last; + if (this.data[i]) { + if (end.length <= 1) this.data[i].CHTMLmoveNode(node,state,values); + else this.data[i].CHTMLmoveSlice([],end.slice(1),node,state,values,"marginRight"); + } + } + }, + + /****************************************************************/ + // + // Split an element and copy the selected items into the new part + // + CHTMLmoveSlice: function (start,end,node,state,values,margin) { + // + // Create a new box for the slice of the element + // Move the selected portion into the slice + // If it is the last slice + // Remove the original (now empty) node + // Rename the Continue-0 node with the original name (for CHTMLnodeElement) + // + var slice = this.CHTMLcreateSliceNode(node); + this.CHTMLmoveLine(start,end,slice,state,values); + if (slice.style[margin]) slice.style[margin] = ""; + if (this.CHTML.L) { + if (margin !== "marginLeft") state.bbox.w += this.CHTML.L; + else slice.className = slice.className.replace(/ MJXc-space\d/,""); + } + if (this.CHTML.R && margin !== "marginRight") state.bbox.w += this.CHTML.R; + if (end.length === 0) { + node = this.CHTMLnodeElement(); + if (this.href) node = node.parentNode; + node.parentNode.removeChild(node); + node.nextMathJaxNode.id = node.id; + } + return slice; + }, + + /****************************************************************/ + // + // Create a new node for an element that is split in two + // Clone the original and update its ID. + // Link the old node to the new one so we can find it later + // + CHTMLcreateSliceNode: function (node) { + var NODE = this.CHTMLnodeElement(), n = 0; + if (this.href) NODE = NODE.parentNode; + var LAST = NODE; while (LAST.nextMathJaxNode) {LAST = LAST.nextMathJaxNode; n++} + var SLICE = NODE.cloneNode(false); LAST.nextMathJaxNode = SLICE; SLICE.nextMathJaxNode = null; + SLICE.id += "-MJX-Continue-"+n; + return node.appendChild(SLICE); + }, + + /****************************************************************/ + // + // Move an element from its original node to its new location in + // a split element or the new line's node + // + CHTMLmoveNode: function (line,state,values) { + // FIXME: handle linebreakstyle === "duplicate" + // FIXME: handle linebreakmultchar + if (!(state.first || state.last) || + (state.first && state.values.linebreakstyle === MML.LINEBREAKSTYLE.BEFORE) || + (state.last && values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER)) { + // + // Move node + // + var node = this.CHTMLnodeElement(); + if (this.href) node = node.parentNode; + line.appendChild(node); + if (this.CHTML.pwidth && !line.style.width) line.style.width = this.CHTML.pwidth; + // + // If it is last, remove right margin + // If it is first, remove left margin + // + if (state.last) node.style.marginRight = ""; + if (state.first || state.nextIsFirst) { + node.style.marginLeft = ""; this.CHTML.L = 0; + node.className = node.className.replace(/ MJXc-space\d/,""); + } + if (state.first && this.CHTML.w === 0) state.nextIsFirst = true; + else delete state.nextIsFirst; + // + // Update bounding box + // + state.bbox.combine(this.CHTML,state.bbox.w,0); + } + } + }); + + /**************************************************************************/ + + MML.mfenced.Augment({ + CHTMLbetterBreak: function (info,state) { + // + // Get the current breakpoint position and other data + // + var index = info.index.slice(0), i = info.index.shift(), + m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false; + if (i == null) i = -1; if (!broken) {i++; info.W += info.w; info.w = 0} + scanW = info.scanW = info.W; info.nest++; + // + // Create indices that include the delimiters and separators + // + if (!this.dataI) { + this.dataI = []; + if (this.data.open) this.dataI.push("open"); + if (m) this.dataI.push(0); + for (var j = 1; j < m; j++) { + if (this.data["sep"+j]) this.dataI.push("sep"+j); + this.dataI.push(j); + } + if (this.data.close) this.dataI.push("close"); + } + m = this.dataI.length; + // + // Look through the line for breakpoints, including the open, close, and separators + // (as long as we are not too far past the breaking width) + // + while (i < m && (info.scanW < PENALTY.maxwidth*CHTML.linebreakWidth || info.w === 0)) { + var k = this.dataI[i]; + if (this.data[k]) { + if (this.data[k].CHTMLbetterBreak(info,state)) { + better = true; index = [i].concat(info.index); W = info.W; w = info.w; + if (info.penalty === PENALTY.newline) { + info.index = index; + if (info.nest) info.nest--; + return true; + } + } + scanW = (broken ? info.scanW : this.CHTMLaddWidth(i,info,scanW)); + } + info.index = []; i++; broken = false; + } + if (info.nest) info.nest--; + info.index = index; + if (better) {info.W = W; info.w = w} + return better; + }, + + CHTMLmoveLine: function (start,end,node,state,values) { + var i = start[0], j = end[0]; + if (i == null) i = -1; if (j == null) j = this.dataI.length-1; + if (i === j && start.length > 1) { + // + // If starting and ending in the same element move the subpiece to the new line + // + this.data[this.dataI[i]].CHTMLmoveSlice(start.slice(1),end.slice(1),node,state,values,"marginLeft"); + } else { + // + // Otherwise, move the remainder of the initial item + // and any others (including open and separators) up to the last one + // + var last = state.last; state.last = false; var k = this.dataI[i]; + while (i < j) { + if (this.data[k]) { + if (start.length <= 1) this.data[k].CHTMLmoveNode(node,state,values); + else this.data[k].CHTMLmoveSlice(start.slice(1),[],node,state,values,"marginLeft"); + } + i++; k = this.dataI[i]; state.first = false; start = []; + } + // + // If the last item is complete, move it + // + state.last = last; + if (this.data[k]) { + if (end.length <= 1) this.data[k].CHTMLmoveNode(node,state,values); + else this.data[k].CHTMLmoveSlice([],end.slice(1),node,state,values,"marginRight"); + } + } + } + + }); + + /**************************************************************************/ + + MML.msubsup.Augment({ + CHTMLbetterBreak: function (info,state) { + if (!this.data[this.base]) {return false} + // + // Get the current breakpoint position and other data + // + var index = info.index.slice(0), i = info.index.shift(), + W, w, scanW, broken = (info.index.length > 0), better = false; + if (!broken) {info.W += info.w; info.w = 0} + scanW = info.scanW = info.W; + // + // Record the width of the base and the super- and subscripts + // + if (i == null) { + this.CHTML.baseW = this.data[this.base].CHTML.w; + this.CHTML.dw = this.CHTML.w - this.CHTML.baseW; + } + // + // Check if the base can be broken + // + if (this.data[this.base].CHTMLbetterBreak(info,state)) { + better = true; index = [this.base].concat(info.index); W = info.W; w = info.w; + if (info.penalty === PENALTY.newline) better = broken = true; + } + // + // Add in the base if it is unbroken, and add the scripts + // + if (!broken) this.CHTMLaddWidth(this.base,info,scanW); + info.scanW += this.CHTML.dw; info.W = info.scanW; + info.index = []; if (better) {info.W = W; info.w = w; info.index = index} + return better; + }, + + CHTMLmoveLine: function (start,end,node,state,values) { + // + // Move the proper part of the base + // + if (this.data[this.base]) { + var base = CHTML.addElement(node,"mjx-base"); + var ic = this.data[this.base].CHTML.ic; + if (ic) base.style.marginRight = CHTML.Em(-ic); + if (start.length > 1) { + this.data[this.base].CHTMLmoveSlice(start.slice(1),end.slice(1),base,state,values,"marginLeft"); + } else { + if (end.length <= 1) this.data[this.base].CHTMLmoveNode(base,state,values); + else this.data[this.base].CHTMLmoveSlice([],end.slice(1),base,state,values,"marginRight"); + } + } + // + // If this is the end, check for super and subscripts, and move those + // by moving the elements that contains them. Adjust the bounding box + // to include the super and subscripts. + // + if (end.length === 0) { + var NODE = this.CHTMLnodeElement(), + stack = CHTML.getNode(NODE,"mjx-stack"), + sup = CHTML.getNode(NODE,"mjx-sup"), + sub = CHTML.getNode(NODE,"mjx-sub"); + if (stack) node.appendChild(stack); + else if (sup) node.appendChild(sup); + else if (sub) node.appendChild(sub); + var w = state.bbox.w, bbox; + if (sup) { + bbox = this.data[this.sup].CHTML; + state.bbox.combine(bbox,w,bbox.Y); + } + if (sub) { + bbox = this.data[this.sub].CHTML; + state.bbox.combine(bbox,w,bbox.Y); + } + } + } + + }); + + /**************************************************************************/ + + MML.mmultiscripts.Augment({ + CHTMLbetterBreak: function (info,state) { + if (!this.data[this.base]) return false; + // + // Get the current breakpoint position and other data + // + var index = info.index.slice(0); info.index.shift(); + var W, w, scanW, broken = (info.index.length > 0), better = false; + if (!broken) {info.W += info.w; info.w = 0} + info.scanW = info.W; + // + // Get the bounding boxes and the width of the scripts + // + var bbox = this.CHTML, base = this.data[this.base].CHTML; + var dw = bbox.w - base.w - (bbox.X||0); + // + // Add in the width of the prescripts + // + info.scanW += bbox.X||0; scanW = info.scanW; + // + // Check if the base can be broken + // + if (this.data[this.base].CHTMLbetterBreak(info,state)) { + better = true; index = [this.base].concat(info.index); W = info.W; w = info.w; + if (info.penalty === PENALTY.newline) better = broken = true; + } + // + // Add in the base if it is unbroken, and add the scripts + // + if (!broken) this.CHTMLaddWidth(this.base,info,scanW); + info.scanW += dw; info.W = info.scanW; + info.index = []; if (better) {info.W = W; info.w = w; info.index = index} + return better; + }, + + CHTMLmoveLine: function (start,end,node,state,values) { + var NODE, BOX = this.CHTMLbbox, w; + // + // If this is the start, move the prescripts, if any. + // + if (start.length < 1) { + NODE = this.CHTMLnodeElement(); + var prestack = CHTML.getNode(NODE,"mjx-prestack"), + presup = CHTML.getNode(NODE,"mjx-presup"), + presub = CHTML.getNode(NODE,"mjx-presub"); + if (prestack) node.appendChild(prestack); + else if (presup) node.appendChild(presup); + else if (presub) node.appendChild(presub); + w = state.bbox.w; + if (presup) state.bbox.combine(BOX.presup,w+BOX.presup.X,BOX.presup.Y); + if (presub) state.bbox.combine(BOX.presub,w+BOX.presub.X,BOX.presub.Y); + } + // + // Move the proper part of the base + // + if (this.data[this.base]) { + var base = CHTML.addElement(node,"mjx-base"); + if (start.length > 1) { + this.data[this.base].CHTMLmoveSlice(start.slice(1),end.slice(1),base,state,values,"marginLeft"); + } else { + if (end.length <= 1) this.data[this.base].CHTMLmoveNode(base,state,values); + else this.data[this.base].CHTMLmoveSlice([],end.slice(1),base,state,values,"marginRight"); + } + } + // + // If this is the end, check for super and subscripts, and move those + // by moving the elements that contains them. Adjust the bounding box + // to include the super and subscripts. + // + if (end.length === 0) { + NODE = this.CHTMLnodeElement(); + var stack = CHTML.getNode(NODE,"mjx-stack"), + sup = CHTML.getNode(NODE,"mjx-sup"), + sub = CHTML.getNode(NODE,"mjx-sub"); + if (stack) node.appendChild(stack); + else if (sup) node.appendChild(sup); + else if (sub) node.appendChild(sub); + w = state.bbox.w; + if (sup) state.bbox.combine(BOX.sup,w,BOX.sup.Y); + if (sub) state.bbox.combine(BOX.sub,w,BOX.sub.Y); + } + } + + }); + + /**************************************************************************/ + + MML.mo.Augment({ + // + // Override the method for checking line breaks to properly handle + // + CHTMLbetterBreak: function (info,state) { + if (info.values && info.values.id === this.CHTMLnodeID) return false; + var values = this.getValues( + "linebreak","linebreakstyle","lineleading","linebreakmultchar", + "indentalign","indentshift", + "indentalignfirst","indentshiftfirst", + "indentalignlast","indentshiftlast", + "texClass", "fence" + ); + if (values.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE) + values.linebreakstyle = this.Get("infixlinebreakstyle"); + // + // Adjust nesting by TeX class (helps output that does not include + // mrows for nesting, but can leave these unbalanced. + // + if (values.texClass === MML.TEXCLASS.OPEN) info.nest++; + if (values.texClass === MML.TEXCLASS.CLOSE && info.nest) info.nest--; + // + // Get the default penalty for this location + // + var W = info.scanW; delete info.embellished; + var w = this.CHTML.w + (this.CHTML.L||0) + (this.CHTML.R||0); + if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0} + if (W - info.shift === 0 && values.linebreak !== MML.LINEBREAK.NEWLINE) + return false; // don't break at zero width (FIXME?) + var offset = CHTML.linebreakWidth - W; + // Adjust offest for explicit first-line indent and align + if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst || + values.indentalignfirst !== state.VALUES.indentalignfirst)) { + var align = this.CHTMLgetAlign(state,values), + shift = this.CHTMLgetShift(state,values,align); + offset += (info.shift - shift); + } + // + var penalty = Math.floor(offset / CHTML.linebreakWidth * 1000); + if (penalty < 0) penalty = PENALTY.toobig - 3*penalty; + if (values.fence) penalty += PENALTY.fence; + if ((values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER && + values.texClass === MML.TEXCLASS.OPEN) || + values.texClass === MML.TEXCLASS.CLOSE) penalty += PENALTY.close; + penalty += info.nest * PENALTY.nestfactor; + // + // Get the penalty for this type of break and + // use it to modify the default penalty + // + var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]||0; + if (!MathJax.Object.isArray(linebreak)) { + // for breaks past the width, keep original penalty for newline + if (linebreak || offset >= 0) {penalty = linebreak * info.nest} + } else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)} + // + // If the penalty is no better than the current one, return false + // Otherwise save the data for this breakpoint and return true + // + if (penalty >= info.penalty) return false; + info.penalty = penalty; info.values = values; info.W = W; info.w = w; + values.lineleading = this.CHTMLlength2em(values.lineleading,state.VALUES.lineleading); + values.id = this.CHTMLnodeID; + return true; + } + }); + + /**************************************************************************/ + + MML.mspace.Augment({ + // + // Override the method for checking line breaks to properly handle + // + CHTMLbetterBreak: function (info,state) { + if (info.values && info.values.id === this.CHTMLnodeID) return false; + var values = this.getValues("linebreak"); + var linebreakValue = values.linebreak; + if (!linebreakValue || this.hasDimAttr()) { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + linebreakValue = MML.LINEBREAK.AUTO; + } + // + // Get the default penalty for this location + // + var W = info.scanW, w = this.CHTML.w + (this.CHTML.L||0) + (this.CHTML.R||0); + if (W - info.shift === 0) return false; // don't break at zero width (FIXME?) + var offset = CHTML.linebreakWidth - W; + // + var penalty = Math.floor(offset / CHTML.linebreakWidth * 1000); + if (penalty < 0) penalty = PENALTY.toobig - 3*penalty; + penalty += info.nest * PENALTY.nestfactor; + // + // Get the penalty for this type of break and + // use it to modify the default penalty + // + var linebreak = PENALTY[linebreakValue]||0; + if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit && + !this.mathbackground && !this.background) + linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]; + if (!MathJax.Object.isArray(linebreak)) { + // for breaks past the width, keep original penalty for newline + if (linebreak || offset >= 0) {penalty = linebreak * info.nest} + } else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)} + // + // If the penalty is no better than the current one, return false + // Otherwise save the data for this breakpoint and return true + // + if (penalty >= info.penalty) return false; + info.penalty = penalty; info.values = values; info.W = W; info.w = w; + values.lineleading = state.VALUES.lineleading; + values.linebreakstyle = "before"; values.id = this.CHTMLnodeID; + return true; + } + }); + + // + // Hook into the mathchoice extension + // + MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function () { + MML.TeXmathchoice.Augment({ + CHTMLbetterBreak: function (info,state) { + return this.Core().CHTMLbetterBreak(info,state); + }, + CHTMLmoveLine: function (start,end,node,state,values) { + return this.Core().CHTMLmoveSlice(start,end,node,state,values); + } + }); + }); + + // + // Have maction process only the selected item + // + MML.maction.Augment({ + CHTMLbetterBreak: function (info,state) { + return this.Core().CHTMLbetterBreak(info,state); + }, + CHTMLmoveLine: function (start,end,node,state,values) { + return this.Core().CHTMLmoveSlice(start,end,node,state,values); + } + }); + + // + // Have semantics only do the first element + // (FIXME: do we need to do anything special about annotation-xml?) + // + MML.semantics.Augment({ + CHTMLbetterBreak: function (info,state) { + return (this.data[0] ? this.data[0].CHTMLbetterBreak(info,state) : false); + }, + CHTMLmoveLine: function (start,end,node,state,values) { + return (this.data[0] ? this.data[0].CHTMLmoveSlice(start,end,node,state,values) : null); + } + }); + + /**************************************************************************/ + + MathJax.Hub.Startup.signal.Post("CommonHTML multiline Ready"); + MathJax.Ajax.loadComplete(CHTML.autoloadDir+"/multiline.js"); + +}); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/config.js b/js/mathjax/jax/output/CommonHTML/config.js new file mode 100644 index 0000000..9708c55 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/config.js @@ -0,0 +1,66 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/HTML2/config.js + * + * Initializes the HTML2 OutputJax (the main definition is in + * MathJax/jax/input/HTML2/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.OutputJax.CommonHTML = MathJax.OutputJax({ + id: "CommonHTML", + version: "2.7.9", + directory: MathJax.OutputJax.directory + "/CommonHTML", + extensionDir: MathJax.OutputJax.extensionDir + "/CommonHTML", + autoloadDir: MathJax.OutputJax.directory + "/CommonHTML/autoload", + fontDir: MathJax.OutputJax.directory + "/CommonHTML/fonts", // fontname added later + webfontDir: MathJax.OutputJax.fontDir + "/HTML-CSS", // fontname added later + + config: { + matchFontHeight: true, // try to match math font height to surrounding font? + scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor + mtextFontInherit: false, // to make be in page font rather than MathJax font + undefinedFamily: "STIXGeneral,'Cambria Math','Arial Unicode MS',serif", + + EqnChunk: (MathJax.Hub.Browser.isMobile ? 20: 100), + // number of equations to process before showing them + EqnChunkFactor: 1.5, // chunk size is multiplied by this after each chunk + EqnChunkDelay: 100, // milliseconds to delay between chunks (to let browser + // respond to other events) + + linebreaks: { + automatic: false, // when false, only process linebreak="newline", + // when true, insert line breaks automatically in long expressions. + + width: "container" // maximum width of a line for automatic line breaks (e.g. "30em"). + // use "container" to compute size from containing element, + // use "nn% container" for a portion of the container, + // use "nn%" for a portion of the window size + } + + } +}); + +if (!MathJax.Hub.config.delayJaxRegistration) {MathJax.OutputJax.CommonHTML.Register("jax/mml")} + +MathJax.OutputJax.CommonHTML.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js new file mode 100644 index 0000000..4057716 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js @@ -0,0 +1,291 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_AMS'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 270, ascent: 1003, descent: 463, + 0x20: [0,0,250,0,0], // SPACE + 0x41: [701,1,722,17,703], // LATIN CAPITAL LETTER A + 0x42: [683,1,667,11,620], // LATIN CAPITAL LETTER B + 0x43: [702,19,722,39,684], // LATIN CAPITAL LETTER C + 0x44: [683,1,722,16,688], // LATIN CAPITAL LETTER D + 0x45: [683,1,667,12,640], // LATIN CAPITAL LETTER E + 0x46: [683,1,611,12,584], // LATIN CAPITAL LETTER F + 0x47: [702,19,778,39,749], // LATIN CAPITAL LETTER G + 0x48: [683,1,778,14,762], // LATIN CAPITAL LETTER H + 0x49: [683,1,389,20,369], // LATIN CAPITAL LETTER I + 0x4A: [683,77,500,6,478], // LATIN CAPITAL LETTER J + 0x4B: [683,1,778,22,768], // LATIN CAPITAL LETTER K + 0x4C: [683,1,667,12,640], // LATIN CAPITAL LETTER L + 0x4D: [683,1,944,17,926], // LATIN CAPITAL LETTER M + 0x4E: [683,20,722,20,702], // LATIN CAPITAL LETTER N + 0x4F: [701,19,778,34,742], // LATIN CAPITAL LETTER O + 0x50: [683,1,611,16,597], // LATIN CAPITAL LETTER P + 0x51: [701,181,778,34,742], // LATIN CAPITAL LETTER Q + 0x52: [683,1,722,16,705], // LATIN CAPITAL LETTER R + 0x53: [702,12,556,28,528], // LATIN CAPITAL LETTER S + 0x54: [683,1,667,33,635], // LATIN CAPITAL LETTER T + 0x55: [683,19,722,16,709], // LATIN CAPITAL LETTER U + 0x56: [683,20,722,0,719], // LATIN CAPITAL LETTER V + 0x57: [683,19,1000,5,994], // LATIN CAPITAL LETTER W + 0x58: [683,1,722,16,705], // LATIN CAPITAL LETTER X + 0x59: [683,1,722,16,704], // LATIN CAPITAL LETTER Y + 0x5A: [683,1,667,29,635], // LATIN CAPITAL LETTER Z + 0x6B: [683,1,556,17,534], // LATIN SMALL LETTER K + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0xA5: [683,0,750,11,738], // YEN SIGN + 0xAE: [709,175,947,32,915], // REGISTERED SIGN + 0xF0: [749,21,556,42,509], // LATIN SMALL LETTER ETH + 0x127: [695,13,540,42,562], // LATIN SMALL LETTER H WITH STROKE + 0x2C6: [845,-561,2333,-14,2346], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2DC: [899,-628,2333,1,2330], // SMALL TILDE + 0x302: [845,-561,0,-2347,13], // COMBINING CIRCUMFLEX ACCENT + 0x303: [899,-628,0,-2332,-3], // COMBINING TILDE + 0x3DD: [605,85,778,55,719], // GREEK SMALL LETTER DIGAMMA + 0x3F0: [434,6,667,37,734], // GREEK KAPPA SYMBOL + 0x2035: [560,-43,275,12,244], // REVERSED PRIME + 0x210F: [695,13,540,42,562], // stix-/hbar - Planck's over 2pi + 0x2127: [684,22,722,44,675], // INVERTED OHM SIGN + 0x2132: [695,1,556,55,497], // TURNED CAPITAL F + 0x2136: [763,21,667,-22,687], // BET SYMBOL + 0x2137: [764,43,444,-22,421], // GIMEL SYMBOL + 0x2138: [764,43,667,54,640], // DALET SYMBOL + 0x2141: [705,23,639,37,577], // TURNED SANS-SERIF CAPITAL G + 0x2190: [437,-64,500,64,422], // LEFTWARDS ARROW + 0x2192: [437,-64,500,58,417], // RIGHTWARDS ARROW + 0x219A: [437,-60,1000,56,942], // LEFTWARDS ARROW WITH STROKE + 0x219B: [437,-60,1000,54,942], // RIGHTWARDS ARROW WITH STROKE + 0x219E: [417,-83,1000,56,944], // LEFTWARDS TWO HEADED ARROW + 0x21A0: [417,-83,1000,55,943], // RIGHTWARDS TWO HEADED ARROW + 0x21A2: [417,-83,1111,56,1031], // LEFTWARDS ARROW WITH TAIL + 0x21A3: [417,-83,1111,79,1054], // RIGHTWARDS ARROW WITH TAIL + 0x21AB: [575,41,1000,56,964], // LEFTWARDS ARROW WITH LOOP + 0x21AC: [575,41,1000,35,943], // RIGHTWARDS ARROW WITH LOOP + 0x21AD: [417,-83,1389,57,1331], // LEFT RIGHT WAVE ARROW + 0x21AE: [437,-60,1000,56,942], // LEFT RIGHT ARROW WITH STROKE + 0x21B0: [722,0,500,56,444], // UPWARDS ARROW WITH TIP LEFTWARDS + 0x21B1: [722,0,500,55,443], // UPWARDS ARROW WITH TIP RIGHTWARDS + 0x21B6: [461,1,1000,17,950], // ANTICLOCKWISE TOP SEMICIRCLE ARROW + 0x21B7: [460,1,1000,46,982], // CLOCKWISE TOP SEMICIRCLE ARROW + 0x21BA: [650,83,778,56,722], // ANTICLOCKWISE OPEN CIRCLE ARROW + 0x21BB: [650,83,778,56,721], // CLOCKWISE OPEN CIRCLE ARROW + 0x21BE: [694,194,417,188,375], // UPWARDS HARPOON WITH BARB RIGHTWARDS + 0x21BF: [694,194,417,41,228], // UPWARDS HARPOON WITH BARB LEFTWARDS + 0x21C2: [694,194,417,188,375], // DOWNWARDS HARPOON WITH BARB RIGHTWARDS + 0x21C3: [694,194,417,41,228], // DOWNWARDS HARPOON WITH BARB LEFTWARDS + 0x21C4: [667,0,1000,55,944], // RIGHTWARDS ARROW OVER LEFTWARDS ARROW + 0x21C6: [667,0,1000,55,944], // LEFTWARDS ARROW OVER RIGHTWARDS ARROW + 0x21C7: [583,83,1000,55,944], // LEFTWARDS PAIRED ARROWS + 0x21C8: [694,193,833,83,749], // UPWARDS PAIRED ARROWS + 0x21C9: [583,83,1000,55,944], // RIGHTWARDS PAIRED ARROWS + 0x21CA: [694,194,833,83,749], // DOWNWARDS PAIRED ARROWS + 0x21CB: [514,14,1000,55,944], // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON + 0x21CC: [514,14,1000,55,944], // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON + 0x21CD: [534,35,1000,54,942], // LEFTWARDS DOUBLE ARROW WITH STROKE + 0x21CE: [534,37,1000,32,965], // LEFT RIGHT DOUBLE ARROW WITH STROKE + 0x21CF: [534,35,1000,55,943], // RIGHTWARDS DOUBLE ARROW WITH STROKE + 0x21DA: [611,111,1000,76,944], // LEFTWARDS TRIPLE ARROW + 0x21DB: [611,111,1000,55,923], // RIGHTWARDS TRIPLE ARROW + 0x21DD: [417,-83,1000,56,943], // RIGHTWARDS SQUIGGLE ARROW + 0x21E0: [437,-64,1334,64,1251], // LEFTWARDS DASHED ARROW + 0x21E2: [437,-64,1334,84,1251], // RIGHTWARDS DASHED ARROW + 0x2201: [846,21,500,56,444], // COMPLEMENT + 0x2204: [860,166,556,55,497], // THERE DOES NOT EXIST + 0x2205: [587,3,778,54,720], // EMPTY SET + 0x220D: [440,1,429,102,456], // SMALL CONTAINS AS MEMBER + 0x2212: [270,-230,500,84,417], // MINUS SIGN + 0x2214: [766,93,778,57,722], // DOT PLUS + 0x2216: [430,23,778,91,685], // SET MINUS + 0x221D: [472,-28,778,56,722], // PROPORTIONAL TO + 0x2220: [694,0,722,55,666], // ANGLE + 0x2221: [714,20,722,55,666], // MEASURED ANGLE + 0x2222: [551,51,722,55,666], // SPHERICAL ANGLE + 0x2223: [430,23,222,91,131], // DIVIDES + 0x2224: [750,252,278,-21,297], // DOES NOT DIVIDE + 0x2225: [431,23,389,55,331], // PARALLEL TO + 0x2226: [750,250,500,-20,518], // NOT PARALLEL TO + 0x2234: [471,82,667,24,643], // THEREFORE + 0x2235: [471,82,667,23,643], // BECAUSE + 0x223C: [365,-132,778,55,719], // TILDE OPERATOR + 0x223D: [367,-133,778,56,722], // REVERSED TILDE + 0x2241: [467,-32,778,55,719], // stix-not, vert, similar + 0x2242: [463,-34,778,55,720], // MINUS TILDE + 0x2246: [652,155,778,54,720], // APPROXIMATELY BUT NOT ACTUALLY EQUAL TO + 0x2248: [481,-50,778,55,719], // ALMOST EQUAL TO + 0x224A: [579,39,778,51,725], // ALMOST EQUAL OR EQUAL TO + 0x224E: [492,-8,778,56,722], // GEOMETRICALLY EQUIVALENT TO + 0x224F: [492,-133,778,56,722], // DIFFERENCE BETWEEN + 0x2251: [609,108,778,56,722], // GEOMETRICALLY EQUAL TO + 0x2252: [601,101,778,15,762], // APPROXIMATELY EQUAL TO OR THE IMAGE OF + 0x2253: [601,102,778,14,762], // IMAGE OF OR APPROXIMATELY EQUAL TO + 0x2256: [367,-133,778,56,722], // RING IN EQUAL TO + 0x2257: [721,-133,778,56,722], // RING EQUAL TO + 0x225C: [859,-133,778,56,723], // DELTA EQUAL TO + 0x2266: [753,175,778,83,694], // LESS-THAN OVER EQUAL TO + 0x2267: [753,175,778,83,694], // GREATER-THAN OVER EQUAL TO + 0x2268: [752,286,778,82,693], // stix-less, vert, not double equals + 0x2269: [752,286,778,82,693], // stix-gt, vert, not double equals + 0x226C: [750,250,500,74,425], // BETWEEN + 0x226E: [708,209,778,82,693], // stix-not, vert, less-than + 0x226F: [708,209,778,82,693], // stix-not, vert, greater-than + 0x2270: [801,303,778,82,694], // stix-not, vert, less-than-or-equal + 0x2271: [801,303,778,82,694], // stix-not, vert, greater-than-or-equal + 0x2272: [732,228,778,56,722], // stix-less-than or (contour) similar + 0x2273: [732,228,778,56,722], // stix-greater-than or (contour) similar + 0x2276: [681,253,778,44,734], // LESS-THAN OR GREATER-THAN + 0x2277: [681,253,778,83,694], // GREATER-THAN OR LESS-THAN + 0x227C: [580,153,778,83,694], // PRECEDES OR EQUAL TO + 0x227D: [580,154,778,82,694], // SUCCEEDS OR EQUAL TO + 0x227E: [732,228,778,56,722], // PRECEDES OR EQUIVALENT TO + 0x227F: [732,228,778,56,722], // SUCCEEDS OR EQUIVALENT TO + 0x2280: [705,208,778,82,693], // DOES NOT PRECEDE + 0x2281: [705,208,778,82,693], // stix-not (vert) succeeds + 0x2288: [801,303,778,83,693], // stix-/nsubseteq N: not (vert) subset, equals + 0x2289: [801,303,778,82,691], // stix-/nsupseteq N: not (vert) superset, equals + 0x228A: [635,241,778,84,693], // stix-subset, not equals, variant + 0x228B: [635,241,778,82,691], // stix-superset, not equals, variant + 0x228F: [539,41,778,83,694], // SQUARE IMAGE OF + 0x2290: [539,41,778,64,714], // SQUARE ORIGINAL OF + 0x229A: [582,82,778,57,721], // CIRCLED RING OPERATOR + 0x229B: [582,82,778,57,721], // CIRCLED ASTERISK OPERATOR + 0x229D: [582,82,778,57,721], // CIRCLED DASH + 0x229E: [689,0,778,55,722], // SQUARED PLUS + 0x229F: [689,0,778,55,722], // SQUARED MINUS + 0x22A0: [689,0,778,55,722], // SQUARED TIMES + 0x22A1: [689,0,778,55,722], // SQUARED DOT OPERATOR + 0x22A8: [694,0,611,55,555], // TRUE + 0x22A9: [694,0,722,55,666], // FORCES + 0x22AA: [694,0,889,55,833], // TRIPLE VERTICAL BAR RIGHT TURNSTILE + 0x22AC: [695,1,611,-55,554], // DOES NOT PROVE + 0x22AD: [695,1,611,-55,554], // NOT TRUE + 0x22AE: [695,1,722,-55,665], // DOES NOT FORCE + 0x22AF: [695,1,722,-55,665], // NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE + 0x22B2: [539,41,778,83,694], // NORMAL SUBGROUP OF + 0x22B3: [539,41,778,83,694], // CONTAINS AS NORMAL SUBGROUP + 0x22B4: [636,138,778,83,694], // NORMAL SUBGROUP OF OR EQUAL TO + 0x22B5: [636,138,778,83,694], // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO + 0x22B8: [408,-92,1111,55,1055], // MULTIMAP + 0x22BA: [431,212,556,57,500], // INTERCALATE + 0x22BB: [716,0,611,55,555], // XOR + 0x22BC: [716,0,611,55,555], // NAND + 0x22C5: [189,0,278,55,222], // DOT OPERATOR + 0x22C7: [545,44,778,55,720], // DIVISION TIMES + 0x22C9: [492,-8,778,146,628], // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT + 0x22CA: [492,-8,778,146,628], // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT + 0x22CB: [694,22,778,55,722], // LEFT SEMIDIRECT PRODUCT + 0x22CC: [694,22,778,55,722], // RIGHT SEMIDIRECT PRODUCT + 0x22CD: [464,-36,778,56,722], // REVERSED TILDE EQUALS + 0x22CE: [578,21,760,83,676], // CURLY LOGICAL OR + 0x22CF: [578,22,760,83,676], // CURLY LOGICAL AND + 0x22D0: [540,40,778,84,694], // DOUBLE SUBSET + 0x22D1: [540,40,778,83,693], // DOUBLE SUPERSET + 0x22D2: [598,22,667,55,611], // DOUBLE INTERSECTION + 0x22D3: [598,22,667,55,611], // DOUBLE UNION + 0x22D4: [736,22,667,56,611], // PITCHFORK + 0x22D6: [541,41,778,82,693], // LESS-THAN WITH DOT + 0x22D7: [541,41,778,82,693], // GREATER-THAN WITH DOT + 0x22D8: [568,67,1333,56,1277], // VERY MUCH LESS-THAN + 0x22D9: [568,67,1333,55,1277], // VERY MUCH GREATER-THAN + 0x22DA: [886,386,778,83,674], // stix-less, equal, slanted, greater + 0x22DB: [886,386,778,83,674], // stix-greater, equal, slanted, less + 0x22DE: [734,0,778,83,694], // EQUAL TO OR PRECEDES + 0x22DF: [734,0,778,82,694], // EQUAL TO OR SUCCEEDS + 0x22E0: [801,303,778,82,693], // stix-not (vert) precedes or contour equals + 0x22E1: [801,303,778,82,694], // stix-not (vert) succeeds or contour equals + 0x22E6: [730,359,778,55,719], // LESS-THAN BUT NOT EQUIVALENT TO + 0x22E7: [730,359,778,55,719], // GREATER-THAN BUT NOT EQUIVALENT TO + 0x22E8: [730,359,778,55,719], // PRECEDES BUT NOT EQUIVALENT TO + 0x22E9: [730,359,778,55,719], // SUCCEEDS BUT NOT EQUIVALENT TO + 0x22EA: [706,208,778,82,693], // NOT NORMAL SUBGROUP OF + 0x22EB: [706,208,778,82,693], // DOES NOT CONTAIN AS NORMAL SUBGROUP + 0x22EC: [802,303,778,82,693], // stix-not, vert, left triangle, equals + 0x22ED: [801,303,778,82,693], // stix-not, vert, right triangle, equals + 0x2322: [378,-122,778,55,722], // stix-small down curve + 0x2323: [378,-143,778,55,722], // stix-small up curve + 0x24C8: [709,175,902,8,894], // CIRCLED LATIN CAPITAL LETTER S + 0x250C: [694,-306,500,55,444], // BOX DRAWINGS LIGHT DOWN AND RIGHT + 0x2510: [694,-306,500,55,444], // BOX DRAWINGS LIGHT DOWN AND LEFT + 0x2514: [366,22,500,55,444], // BOX DRAWINGS LIGHT UP AND RIGHT + 0x2518: [366,22,500,55,444], // BOX DRAWINGS LIGHT UP AND LEFT + 0x2571: [694,195,889,0,860], // BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT + 0x2572: [694,195,889,0,860], // BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT + 0x25A0: [689,0,778,55,722], // BLACK SQUARE + 0x25A1: [689,0,778,55,722], // WHITE SQUARE + 0x25B2: [575,20,722,84,637], // BLACK UP-POINTING TRIANGLE + 0x25B3: [575,20,722,84,637], // WHITE UP-POINTING TRIANGLE + 0x25B6: [539,41,778,83,694], // BLACK RIGHT-POINTING TRIANGLE + 0x25BC: [576,19,722,84,637], // BLACK DOWN-POINTING TRIANGLE + 0x25BD: [576,19,722,84,637], // WHITE DOWN-POINTING TRIANGLE + 0x25C0: [539,41,778,83,694], // BLACK LEFT-POINTING TRIANGLE + 0x25CA: [716,132,667,56,611], // LOZENGE + 0x2605: [694,111,944,49,895], // BLACK STAR + 0x2713: [706,34,833,84,749], // CHECK MARK + 0x2720: [716,22,833,48,786], // MALTESE CROSS + 0x29EB: [716,132,667,56,611], // BLACK LOZENGE + 0x2A5E: [813,97,611,55,555], // LOGICAL AND WITH DOUBLE OVERBAR + 0x2A7D: [636,138,778,83,694], // LESS-THAN OR SLANTED EQUAL TO + 0x2A7E: [636,138,778,83,694], // GREATER-THAN OR SLANTED EQUAL TO + 0x2A85: [762,290,778,55,722], // LESS-THAN OR APPROXIMATE + 0x2A86: [762,290,778,55,722], // GREATER-THAN OR APPROXIMATE + 0x2A87: [635,241,778,82,693], // LESS-THAN AND SINGLE-LINE NOT EQUAL TO + 0x2A88: [635,241,778,82,693], // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO + 0x2A89: [761,387,778,57,718], // LESS-THAN AND NOT APPROXIMATE + 0x2A8A: [761,387,778,57,718], // GREATER-THAN AND NOT APPROXIMATE + 0x2A8B: [1003,463,778,83,694], // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN + 0x2A8C: [1003,463,778,83,694], // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN + 0x2A95: [636,138,778,83,694], // SLANTED EQUAL TO OR LESS-THAN + 0x2A96: [636,138,778,83,694], // SLANTED EQUAL TO OR GREATER-THAN + 0x2AB5: [752,286,778,82,693], // PRECEDES ABOVE NOT EQUAL TO + 0x2AB6: [752,286,778,82,693], // SUCCEEDS ABOVE NOT EQUAL TO + 0x2AB7: [761,294,778,57,717], // PRECEDES ABOVE ALMOST EQUAL TO + 0x2AB8: [761,294,778,57,717], // SUCCEEDS ABOVE ALMOST EQUAL TO + 0x2AB9: [761,337,778,57,718], // PRECEDES ABOVE NOT ALMOST EQUAL TO + 0x2ABA: [761,337,778,57,718], // SUCCEEDS ABOVE NOT ALMOST EQUAL TO + 0x2AC5: [753,215,778,84,694], // SUBSET OF ABOVE EQUALS SIGN + 0x2AC6: [753,215,778,83,694], // SUPERSET OF ABOVE EQUALS SIGN + 0x2ACB: [783,385,778,82,693], // stix-subset not double equals, variant + 0x2ACC: [783,385,778,82,693], // SUPERSET OF ABOVE NOT EQUAL TO + 0xE006: [430,23,222,-20,240], // ?? + 0xE007: [431,24,389,-20,407], // ?? + 0xE008: [605,85,778,55,719], // ?? + 0xE009: [434,6,667,37,734], // ?? + 0xE00C: [752,284,778,82,693], // ?? + 0xE00D: [752,284,778,82,693], // ?? + 0xE00E: [919,421,778,82,694], // stix-not greater, double equals + 0xE00F: [801,303,778,82,694], // stix-not greater-or-equal, slanted + 0xE010: [801,303,778,82,694], // stix-not less-or-equal, slanted + 0xE011: [919,421,778,82,694], // stix-not less, double equals + 0xE016: [828,330,778,82,694], // stix-not subset, double equals + 0xE017: [752,332,778,82,694], // ?? + 0xE018: [828,330,778,82,694], // stix-not superset, double equals + 0xE019: [752,333,778,82,693], // ?? + 0xE01A: [634,255,778,84,693], // ?? + 0xE01B: [634,254,778,82,691] // ?? +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js new file mode 100644 index 0000000..8de81a8 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js @@ -0,0 +1,101 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Caligraphic-Bold'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 315, ascent: 840, descent: 211, + weight: 'bold', + skew: { + 0x41: 0.224, + 0x42: 0.16, + 0x43: 0.16, + 0x44: 0.0958, + 0x45: 0.128, + 0x46: 0.128, + 0x47: 0.128, + 0x48: 0.128, + 0x49: 0.0319, + 0x4A: 0.192, + 0x4B: 0.0639, + 0x4C: 0.16, + 0x4D: 0.16, + 0x4E: 0.0958, + 0x4F: 0.128, + 0x50: 0.0958, + 0x51: 0.128, + 0x52: 0.0958, + 0x53: 0.16, + 0x54: 0.0319, + 0x55: 0.0958, + 0x56: 0.0319, + 0x57: 0.0958, + 0x58: 0.16, + 0x59: 0.0958, + 0x5A: 0.16 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x30: [460,17,575,46,528], // DIGIT ZERO + 0x31: [461,0,575,80,494], // DIGIT ONE + 0x32: [460,0,575,51,517], // DIGIT TWO + 0x33: [461,211,575,48,525], // DIGIT THREE + 0x34: [469,194,575,32,542], // DIGIT FOUR + 0x35: [461,211,575,57,517], // DIGIT FIVE + 0x36: [660,17,575,48,526], // DIGIT SIX + 0x37: [476,211,575,64,558], // DIGIT SEVEN + 0x38: [661,17,575,48,526], // DIGIT EIGHT + 0x39: [461,210,575,48,526], // DIGIT NINE + 0x41: [751,49,921,39,989], // LATIN CAPITAL LETTER A + 0x42: [705,17,748,40,740], // LATIN CAPITAL LETTER B + 0x43: [703,20,613,20,599], // LATIN CAPITAL LETTER C + 0x44: [686,0,892,20,885], // LATIN CAPITAL LETTER D + 0x45: [703,16,607,37,627], // LATIN CAPITAL LETTER E + 0x46: [686,30,814,17,930], // LATIN CAPITAL LETTER F + 0x47: [703,113,682,50,671], // LATIN CAPITAL LETTER G + 0x48: [686,48,987,20,946], // LATIN CAPITAL LETTER H + 0x49: [686,0,642,-27,746], // LATIN CAPITAL LETTER I + 0x4A: [686,114,779,53,937], // LATIN CAPITAL LETTER J + 0x4B: [703,17,871,40,834], // LATIN CAPITAL LETTER K + 0x4C: [703,17,788,41,751], // LATIN CAPITAL LETTER L + 0x4D: [703,49,1378,38,1353], // LATIN CAPITAL LETTER M + 0x4E: [840,49,937,-24,1105], // LATIN CAPITAL LETTER N + 0x4F: [703,17,906,63,882], // LATIN CAPITAL LETTER O + 0x50: [686,67,810,20,846], // LATIN CAPITAL LETTER P + 0x51: [703,146,939,120,905], // LATIN CAPITAL LETTER Q + 0x52: [686,17,990,20,981], // LATIN CAPITAL LETTER R + 0x53: [703,16,696,25,721], // LATIN CAPITAL LETTER S + 0x54: [720,69,644,38,947], // LATIN CAPITAL LETTER T + 0x55: [686,24,715,-10,771], // LATIN CAPITAL LETTER U + 0x56: [686,77,737,25,774], // LATIN CAPITAL LETTER V + 0x57: [686,77,1169,25,1206], // LATIN CAPITAL LETTER W + 0x58: [686,-1,817,56,906], // LATIN CAPITAL LETTER X + 0x59: [686,164,759,36,797], // LATIN CAPITAL LETTER Y + 0x5A: [686,0,818,46,853], // LATIN CAPITAL LETTER Z + 0xA0: [0,0,250,0,0] // NO-BREAK SPACE +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js new file mode 100644 index 0000000..2715d24 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js @@ -0,0 +1,127 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Fraktur-Bold'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 259, ascent: 740, descent: 223, + weight: 'bold', + 0x20: [0,0,250,0,0], // SPACE + 0x21: [689,12,349,107,241], // EXCLAMATION MARK + 0x22: [695,-432,254,10,231], // QUOTATION MARK + 0x26: [696,16,871,44,839], // AMPERSAND + 0x27: [695,-436,250,80,158], // APOSTROPHE + 0x28: [737,186,459,134,347], // LEFT PARENTHESIS + 0x29: [735,187,459,105,326], // RIGHT PARENTHESIS + 0x2A: [692,-449,328,40,277], // ASTERISK + 0x2B: [598,82,893,56,837], // PLUS SIGN + 0x2C: [107,191,328,118,253], // COMMA + 0x2D: [275,-236,893,54,833], // HYPHEN-MINUS + 0x2E: [102,15,328,103,237], // FULL STOP + 0x2F: [721,182,593,41,550], // SOLIDUS + 0x30: [501,12,593,42,533], // DIGIT ZERO + 0x31: [489,0,593,54,548], // DIGIT ONE + 0x32: [491,-2,593,44,563], // DIGIT TWO + 0x33: [487,193,593,31,523], // DIGIT THREE + 0x34: [495,196,593,13,565], // DIGIT FOUR + 0x35: [481,190,593,19,518], // DIGIT FIVE + 0x36: [704,12,593,48,547], // DIGIT SIX + 0x37: [479,197,593,54,591], // DIGIT SEVEN + 0x38: [714,5,593,45,542], // DIGIT EIGHT + 0x39: [487,195,593,29,549], // DIGIT NINE + 0x3A: [457,12,255,57,197], // COLON + 0x3B: [458,190,255,56,211], // SEMICOLON + 0x3D: [343,-168,582,22,559], // EQUALS SIGN + 0x3F: [697,14,428,40,422], // QUESTION MARK + 0x41: [686,31,847,29,827], // LATIN CAPITAL LETTER A + 0x42: [684,31,1044,57,965], // LATIN CAPITAL LETTER B + 0x43: [676,32,723,72,726], // LATIN CAPITAL LETTER C + 0x44: [683,29,982,31,896], // LATIN CAPITAL LETTER D + 0x45: [686,29,783,74,728], // LATIN CAPITAL LETTER E + 0x46: [684,146,722,17,727], // LATIN CAPITAL LETTER F + 0x47: [687,29,927,74,844], // LATIN CAPITAL LETTER G + 0x48: [683,126,851,6,752], // LATIN CAPITAL LETTER H + 0x49: [681,25,655,32,623], // LATIN CAPITAL LETTER I + 0x4A: [680,141,652,-8,616], // LATIN CAPITAL LETTER J + 0x4B: [681,26,789,20,806], // LATIN CAPITAL LETTER K + 0x4C: [683,28,786,30,764], // LATIN CAPITAL LETTER L + 0x4D: [683,32,1239,27,1232], // LATIN CAPITAL LETTER M + 0x4E: [679,30,983,26,973], // LATIN CAPITAL LETTER N + 0x4F: [726,30,976,12,881], // LATIN CAPITAL LETTER O + 0x50: [688,223,977,33,943], // LATIN CAPITAL LETTER P + 0x51: [726,83,976,12,918], // LATIN CAPITAL LETTER Q + 0x52: [688,28,978,31,978], // LATIN CAPITAL LETTER R + 0x53: [685,31,978,82,905], // LATIN CAPITAL LETTER S + 0x54: [686,30,790,31,802], // LATIN CAPITAL LETTER T + 0x55: [688,39,851,18,871], // LATIN CAPITAL LETTER U + 0x56: [685,29,982,25,966], // LATIN CAPITAL LETTER V + 0x57: [683,30,1235,26,1240], // LATIN CAPITAL LETTER W + 0x58: [681,35,849,32,835], // LATIN CAPITAL LETTER X + 0x59: [688,214,984,34,878], // LATIN CAPITAL LETTER Y + 0x5A: [677,148,711,-4,624], // LATIN CAPITAL LETTER Z + 0x5B: [740,130,257,36,226], // LEFT SQUARE BRACKET + 0x5D: [738,132,257,14,208], // RIGHT SQUARE BRACKET + 0x5E: [734,-452,590,1,584], // CIRCUMFLEX ACCENT + 0x61: [472,32,603,80,586], // LATIN SMALL LETTER A + 0x62: [690,32,590,86,504], // LATIN SMALL LETTER B + 0x63: [473,26,464,87,424], // LATIN SMALL LETTER C + 0x64: [632,28,589,-1,511], // LATIN SMALL LETTER D + 0x65: [471,27,472,81,428], // LATIN SMALL LETTER E + 0x66: [687,222,388,35,372], // LATIN SMALL LETTER F + 0x67: [472,208,595,17,541], // LATIN SMALL LETTER G + 0x68: [687,207,615,89,507], // LATIN SMALL LETTER H + 0x69: [686,25,331,3,327], // LATIN SMALL LETTER I + 0x6A: [682,203,332,-19,238], // LATIN SMALL LETTER J + 0x6B: [682,25,464,34,432], // LATIN SMALL LETTER K + 0x6C: [681,24,337,100,312], // LATIN SMALL LETTER L + 0x6D: [476,31,921,16,900], // LATIN SMALL LETTER M + 0x6E: [473,28,654,5,608], // LATIN SMALL LETTER N + 0x6F: [482,34,609,107,515], // LATIN SMALL LETTER O + 0x70: [557,207,604,-1,519], // LATIN SMALL LETTER P + 0x71: [485,211,596,87,515], // LATIN SMALL LETTER Q + 0x72: [472,26,460,13,453], // LATIN SMALL LETTER R + 0x73: [479,34,523,-23,481], // LATIN SMALL LETTER S + 0x74: [648,27,393,43,407], // LATIN SMALL LETTER T + 0x75: [472,32,589,9,603], // LATIN SMALL LETTER U + 0x76: [546,27,604,56,507], // LATIN SMALL LETTER V + 0x77: [549,32,918,55,815], // LATIN SMALL LETTER W + 0x78: [471,188,459,8,441], // LATIN SMALL LETTER X + 0x79: [557,221,589,60,512], // LATIN SMALL LETTER Y + 0x7A: [471,214,461,-7,378], // LATIN SMALL LETTER Z + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2018: [708,-411,254,53,187], // LEFT SINGLE QUOTATION MARK + 0x2019: [692,-394,254,58,193], // RIGHT SINGLE QUOTATION MARK + 0xE301: [630,27,587,64,512], // stix-MATHEMATICAL BOLD CAPITAL GAMMA SLASHED + 0xE302: [693,212,394,37,408], // stix-capital Delta, Greek slashed + 0xE303: [681,219,387,36,384], // stix-MATHEMATICAL BOLD CAPITAL DELTA SLASHED + 0xE304: [473,212,593,67,531], // stix-capital Epsilon, Greek slashed + 0xE305: [684,27,393,33,387], // stix-MATHEMATICAL BOLD CAPITAL EPSILON SLASHED + 0xE308: [679,220,981,32,875], // stix-capital Eta, Greek slashed + 0xE309: [717,137,727,17,633] // stix-MATHEMATICAL BOLD CAPITAL ETA SLASHED +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js new file mode 100644 index 0000000..1c9a35c --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js @@ -0,0 +1,127 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Fraktur'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 258, ascent: 740, descent: 224, + 0x20: [0,0,250,0,0], // SPACE + 0x21: [689,12,296,91,204], // EXCLAMATION MARK + 0x22: [695,-432,215,8,196], // QUOTATION MARK + 0x26: [698,11,738,49,733], // AMPERSAND + 0x27: [695,-436,212,69,134], // APOSTROPHE + 0x28: [737,186,389,114,293], // LEFT PARENTHESIS + 0x29: [735,187,389,89,276], // RIGHT PARENTHESIS + 0x2A: [692,-449,278,33,234], // ASTERISK + 0x2B: [598,82,756,47,709], // PLUS SIGN + 0x2C: [107,191,278,99,213], // COMMA + 0x2D: [275,-236,756,46,706], // HYPHEN-MINUS + 0x2E: [102,15,278,87,200], // FULL STOP + 0x2F: [721,182,502,34,466], // SOLIDUS + 0x30: [492,13,502,42,456], // DIGIT ZERO + 0x31: [468,2,502,47,460], // DIGIT ONE + 0x32: [474,-1,502,60,484], // DIGIT TWO + 0x33: [473,182,502,39,429], // DIGIT THREE + 0x34: [476,191,502,10,481], // DIGIT FOUR + 0x35: [458,184,502,47,440], // DIGIT FIVE + 0x36: [700,13,502,45,471], // DIGIT SIX + 0x37: [468,181,502,37,498], // DIGIT SEVEN + 0x38: [705,10,502,40,461], // DIGIT EIGHT + 0x39: [469,182,502,28,466], // DIGIT NINE + 0x3A: [457,12,216,50,168], // COLON + 0x3B: [458,189,216,47,179], // SEMICOLON + 0x3D: [368,-132,756,54,725], // EQUALS SIGN + 0x3F: [693,11,362,46,357], // QUESTION MARK + 0x41: [696,26,718,22,708], // LATIN CAPITAL LETTER A + 0x42: [691,27,884,48,820], // LATIN CAPITAL LETTER B + 0x43: [685,24,613,59,607], // LATIN CAPITAL LETTER C + 0x44: [685,27,832,27,745], // LATIN CAPITAL LETTER D + 0x45: [685,24,663,86,634], // LATIN CAPITAL LETTER E + 0x46: [686,153,611,11,612], // LATIN CAPITAL LETTER F + 0x47: [690,26,785,66,710], // LATIN CAPITAL LETTER G + 0x48: [666,133,720,1,644], // LATIN CAPITAL LETTER H + 0x49: [686,26,554,30,532], // LATIN CAPITAL LETTER I + 0x4A: [686,139,552,-10,522], // LATIN CAPITAL LETTER J + 0x4B: [680,27,668,17,682], // LATIN CAPITAL LETTER K + 0x4C: [686,26,666,33,644], // LATIN CAPITAL LETTER L + 0x4D: [692,27,1050,27,1048], // LATIN CAPITAL LETTER M + 0x4E: [686,25,832,27,825], // LATIN CAPITAL LETTER N + 0x4F: [729,27,827,12,744], // LATIN CAPITAL LETTER O + 0x50: [692,218,828,28,804], // LATIN CAPITAL LETTER P + 0x51: [729,69,827,11,782], // LATIN CAPITAL LETTER Q + 0x52: [686,26,828,27,824], // LATIN CAPITAL LETTER R + 0x53: [692,27,829,66,756], // LATIN CAPITAL LETTER S + 0x54: [701,27,669,34,676], // LATIN CAPITAL LETTER T + 0x55: [697,27,646,-25,665], // LATIN CAPITAL LETTER U + 0x56: [686,26,831,26,825], // LATIN CAPITAL LETTER V + 0x57: [686,27,1046,32,1054], // LATIN CAPITAL LETTER W + 0x58: [688,27,719,28,709], // LATIN CAPITAL LETTER X + 0x59: [686,218,833,27,740], // LATIN CAPITAL LETTER Y + 0x5A: [729,139,602,11,532], // LATIN CAPITAL LETTER Z + 0x5B: [740,130,278,117,278], // LEFT SQUARE BRACKET + 0x5D: [738,131,278,-4,160], // RIGHT SQUARE BRACKET + 0x5E: [734,-452,500,0,495], // CIRCUMFLEX ACCENT + 0x61: [470,35,500,66,497], // LATIN SMALL LETTER A + 0x62: [685,31,513,87,442], // LATIN SMALL LETTER B + 0x63: [466,29,389,72,359], // LATIN SMALL LETTER C + 0x64: [609,33,499,13,428], // LATIN SMALL LETTER D + 0x65: [467,30,401,70,364], // LATIN SMALL LETTER E + 0x66: [681,221,326,30,323], // LATIN SMALL LETTER F + 0x67: [470,209,504,17,455], // LATIN SMALL LETTER G + 0x68: [688,205,521,77,434], // LATIN SMALL LETTER H + 0x69: [673,20,279,14,267], // LATIN SMALL LETTER I + 0x6A: [672,208,281,-9,196], // LATIN SMALL LETTER J + 0x6B: [689,25,389,24,362], // LATIN SMALL LETTER K + 0x6C: [685,20,280,98,276], // LATIN SMALL LETTER L + 0x6D: [475,26,767,8,753], // LATIN SMALL LETTER M + 0x6E: [475,22,527,20,514], // LATIN SMALL LETTER N + 0x6F: [480,28,489,67,412], // LATIN SMALL LETTER O + 0x70: [541,212,500,12,430], // LATIN SMALL LETTER P + 0x71: [479,219,489,60,419], // LATIN SMALL LETTER Q + 0x72: [474,21,389,17,387], // LATIN SMALL LETTER R + 0x73: [478,29,443,-18,406], // LATIN SMALL LETTER S + 0x74: [640,20,333,27,348], // LATIN SMALL LETTER T + 0x75: [474,23,517,9,513], // LATIN SMALL LETTER U + 0x76: [530,28,512,55,434], // LATIN SMALL LETTER V + 0x77: [532,28,774,45,688], // LATIN SMALL LETTER W + 0x78: [472,188,389,10,363], // LATIN SMALL LETTER X + 0x79: [528,218,499,45,431], // LATIN SMALL LETTER Y + 0x7A: [471,214,391,-7,314], // LATIN SMALL LETTER Z + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2018: [708,-410,215,45,158], // LEFT SINGLE QUOTATION MARK + 0x2019: [692,-395,215,49,163], // RIGHT SINGLE QUOTATION MARK + 0xE300: [683,32,497,75,430], // stix-capital Gamma, Greek slashed + 0xE301: [616,30,498,35,432], // stix-MATHEMATICAL BOLD CAPITAL GAMMA SLASHED + 0xE302: [680,215,333,29,339], // stix-capital Delta, Greek slashed + 0xE303: [679,224,329,28,318], // stix-MATHEMATICAL BOLD CAPITAL DELTA SLASHED + 0xE304: [471,214,503,52,449], // stix-capital Epsilon, Greek slashed + 0xE305: [686,20,333,26,315], // stix-MATHEMATICAL BOLD CAPITAL EPSILON SLASHED + 0xE306: [577,21,334,29,347], // stix-capital Zeta, Greek slashed + 0xE307: [475,22,501,10,514] // stix-MATHEMATICAL BOLD CAPITAL ZETA SLASHED +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js new file mode 100644 index 0000000..1dd2251 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js @@ -0,0 +1,210 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +(function (CHTML) { + +var font = 'MathJax_Main-Bold'; + +MathJax.Hub.Insert(CHTML.FONTDATA.FONTS[font],{ + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0xA8: [695,-535,575,96,478], // DIAERESIS + 0xAC: [371,-61,767,64,702], // NOT SIGN + 0xAF: [607,-540,575,80,494], // MACRON + 0xB0: [702,-536,575,160,414], // DEGREE SIGN + 0xB1: [728,35,894,64,829], // PLUS-MINUS SIGN + 0xB4: [706,-503,575,236,460], // ACUTE ACCENT + 0xD7: [530,28,894,168,726], // MULTIPLICATION SIGN + 0xF7: [597,96,894,64,828], // DIVISION SIGN + 0x131: [452,8,394,24,367], // LATIN SMALL LETTER DOTLESS I + 0x237: [451,201,439,-12,420], // LATIN SMALL LETTER DOTLESS J + 0x2C6: [694,-520,575,126,448], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2C7: [660,-515,575,130,444], // CARON + 0x2C9: [607,-540,575,80,494], // MODIFIER LETTER MACRON + 0x2CA: [706,-503,575,236,460], // MODIFIER LETTER ACUTE ACCENT + 0x2CB: [706,-503,575,114,338], // MODIFIER LETTER GRAVE ACCENT + 0x2D8: [694,-500,575,102,472], // BREVE + 0x2D9: [695,-525,575,202,372], // DOT ABOVE + 0x2DA: [702,-536,575,160,414], // RING ABOVE + 0x2DC: [694,-552,575,96,478], // SMALL TILDE + 0x300: [706,-503,0,-461,-237], // COMBINING GRAVE ACCENT + 0x301: [706,-503,0,-339,-115], // COMBINING ACUTE ACCENT + 0x302: [694,-520,0,-449,-127], // COMBINING CIRCUMFLEX ACCENT + 0x303: [694,-552,0,-479,-97], // COMBINING TILDE + 0x304: [607,-540,0,-495,-81], // COMBINING MACRON + 0x306: [694,-500,0,-473,-103], // COMBINING BREVE + 0x307: [695,-525,0,-373,-203], // COMBINING DOT ABOVE + 0x308: [695,-535,0,-479,-97], // COMBINING DIAERESIS + 0x30A: [702,-536,0,-415,-161], // COMBINING RING ABOVE + 0x30B: [714,-511,0,-442,-82], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [660,-515,0,-445,-131], // COMBINING CARON + 0x338: [711,210,0,-734,-161], // COMBINING LONG SOLIDUS OVERLAY + 0x2002: [0,0,500,0,0], // ?? + 0x2003: [0,0,999,0,0], // ?? + 0x2004: [0,0,333,0,0], // ?? + 0x2005: [0,0,250,0,0], // ?? + 0x2006: [0,0,167,0,0], // ?? + 0x2009: [0,0,167,0,0], // ?? + 0x200A: [0,0,83,0,0], // ?? + 0x2013: [300,-249,575,0,574], // EN DASH + 0x2014: [300,-249,1150,0,1149], // EM DASH + 0x2018: [694,-329,319,58,245], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-329,319,74,261], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-329,603,110,564], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-329,603,38,492], // RIGHT DOUBLE QUOTATION MARK + 0x2020: [702,211,511,64,446], // DAGGER + 0x2021: [702,202,511,64,446], // DOUBLE DAGGER + 0x2026: [171,-1,1295,74,1221], // HORIZONTAL ELLIPSIS + 0x2032: [563,-33,344,35,331], // PRIME + 0x20D7: [723,-513,0,-542,-33], // COMBINING RIGHT ARROW ABOVE + 0x210F: [694,8,668,45,642], // stix-/hbar - Planck's over 2pi + 0x2111: [702,8,831,64,798], // BLACK-LETTER CAPITAL I + 0x2113: [702,19,474,-1,446], // SCRIPT SMALL L + 0x2118: [461,210,740,72,726], // SCRIPT CAPITAL P + 0x211C: [711,16,831,42,824], // BLACK-LETTER CAPITAL R + 0x2135: [694,0,703,64,638], // ALEF SYMBOL + 0x2190: [518,17,1150,64,1084], // LEFTWARDS ARROW + 0x2191: [694,193,575,14,561], // UPWARDS ARROW + 0x2192: [518,17,1150,65,1085], // RIGHTWARDS ARROW + 0x2193: [694,194,575,14,561], // DOWNWARDS ARROW + 0x2194: [518,17,1150,64,1085], // LEFT RIGHT ARROW + 0x2195: [767,267,575,14,561], // UP DOWN ARROW + 0x2196: [724,194,1150,64,1084], // NORTH WEST ARROW + 0x2197: [724,193,1150,64,1085], // NORTH EAST ARROW + 0x2198: [694,224,1150,65,1085], // SOUTH EAST ARROW + 0x2199: [694,224,1150,64,1085], // SOUTH WEST ARROW + 0x21A6: [518,17,1150,65,1085], // RIGHTWARDS ARROW FROM BAR + 0x21A9: [518,17,1282,64,1218], // LEFTWARDS ARROW WITH HOOK + 0x21AA: [518,17,1282,65,1217], // RIGHTWARDS ARROW WITH HOOK + 0x21BC: [518,-220,1150,64,1084], // LEFTWARDS HARPOON WITH BARB UPWARDS + 0x21BD: [281,17,1150,64,1084], // LEFTWARDS HARPOON WITH BARB DOWNWARDS + 0x21C0: [518,-220,1150,65,1085], // RIGHTWARDS HARPOON WITH BARB UPWARDS + 0x21C1: [281,17,1150,64,1085], // RIGHTWARDS HARPOON WITH BARB DOWNWARDS + 0x21CC: [718,17,1150,64,1085], // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON + 0x21D0: [547,46,1150,64,1085], // LEFTWARDS DOUBLE ARROW + 0x21D1: [694,193,703,30,672], // UPWARDS DOUBLE ARROW + 0x21D2: [547,46,1150,64,1084], // RIGHTWARDS DOUBLE ARROW + 0x21D3: [694,194,703,30,672], // DOWNWARDS DOUBLE ARROW + 0x21D4: [547,46,1150,47,1102], // LEFT RIGHT DOUBLE ARROW + 0x21D5: [767,267,703,30,672], // UP DOWN DOUBLE ARROW + 0x2200: [694,16,639,1,640], // FOR ALL + 0x2202: [710,17,628,60,657], // PARTIAL DIFFERENTIAL + 0x2203: [694,-1,639,64,574], // THERE EXISTS + 0x2205: [767,73,575,46,528], // EMPTY SET + 0x2207: [686,24,958,56,901], // NABLA + 0x2208: [587,86,767,97,670], // ELEMENT OF + 0x2209: [711,210,767,97,670], // stix-negated (vert) set membership, variant + 0x220B: [587,86,767,96,670], // CONTAINS AS MEMBER + 0x2212: [281,-221,894,96,797], // MINUS SIGN + 0x2213: [537,227,894,64,829], // MINUS-OR-PLUS SIGN + 0x2215: [750,250,575,63,511], // DIVISION SLASH + 0x2216: [750,250,575,63,511], // SET MINUS + 0x2217: [472,-28,575,73,501], // ASTERISK OPERATOR + 0x2218: [474,-28,575,64,510], // RING OPERATOR + 0x2219: [474,-28,575,64,510], // BULLET OPERATOR + 0x221A: [820,180,958,78,988], // SQUARE ROOT + 0x221D: [451,8,894,65,830], // PROPORTIONAL TO + 0x221E: [452,8,1150,65,1084], // INFINITY + 0x2220: [714,0,722,55,676], // ANGLE + 0x2223: [750,249,319,129,190], // DIVIDES + 0x2225: [750,248,575,145,430], // PARALLEL TO + 0x2227: [604,17,767,64,702], // LOGICAL AND + 0x2228: [604,16,767,64,702], // LOGICAL OR + 0x2229: [603,16,767,64,702], // stix-intersection, serifs + 0x222A: [604,16,767,64,702], // stix-union, serifs + 0x222B: [711,211,569,64,632], // INTEGRAL + 0x223C: [391,-109,894,64,828], // TILDE OPERATOR + 0x2240: [583,82,319,64,254], // WREATH PRODUCT + 0x2243: [502,3,894,64,829], // ASYMPTOTICALLY EQUAL TO + 0x2245: [638,27,1000,64,829], // APPROXIMATELY EQUAL TO + 0x2248: [524,-32,894,64,829], // ALMOST EQUAL TO + 0x224D: [533,32,894,64,829], // EQUIVALENT TO + 0x2250: [721,-109,894,64,829], // APPROACHES THE LIMIT + 0x2260: [711,210,894,64,829], // stix-not (vert) equals + 0x2261: [505,3,894,64,829], // IDENTICAL TO + 0x2264: [697,199,894,96,797], // LESS-THAN OR EQUAL TO + 0x2265: [697,199,894,96,797], // GREATER-THAN OR EQUAL TO + 0x226A: [617,116,1150,64,1085], // MUCH LESS-THAN + 0x226B: [618,116,1150,64,1085], // MUCH GREATER-THAN + 0x227A: [585,86,894,96,797], // PRECEDES + 0x227B: [586,86,894,96,797], // SUCCEEDS + 0x2282: [587,85,894,96,797], // SUBSET OF + 0x2283: [587,86,894,96,796], // SUPERSET OF + 0x2286: [697,199,894,96,797], // SUBSET OF OR EQUAL TO + 0x2287: [697,199,894,96,796], // SUPERSET OF OR EQUAL TO + 0x228E: [604,16,767,64,702], // MULTISET UNION + 0x2291: [697,199,894,96,828], // SQUARE IMAGE OF OR EQUAL TO + 0x2292: [697,199,894,66,797], // SQUARE ORIGINAL OF OR EQUAL TO + 0x2293: [604,-1,767,70,696], // stix-square intersection, serifs + 0x2294: [604,-1,767,70,696], // stix-square union, serifs + 0x2295: [632,132,894,64,828], // stix-circled plus (with rim) + 0x2296: [632,132,894,64,828], // CIRCLED MINUS + 0x2297: [632,132,894,64,828], // stix-circled times (with rim) + 0x2298: [632,132,894,64,828], // CIRCLED DIVISION SLASH + 0x2299: [632,132,894,64,828], // CIRCLED DOT OPERATOR + 0x22A2: [693,-1,703,65,637], // RIGHT TACK + 0x22A3: [693,-1,703,64,638], // LEFT TACK + 0x22A4: [694,-1,894,64,829], // DOWN TACK + 0x22A5: [693,-1,894,65,829], // UP TACK + 0x22A8: [750,249,974,129,918], // TRUE + 0x22C4: [523,21,575,15,560], // DIAMOND OPERATOR + 0x22C5: [336,-166,319,74,245], // DOT OPERATOR + 0x22C6: [502,0,575,24,550], // STAR OPERATOR + 0x22C8: [540,39,1000,33,967], // BOWTIE + 0x22EE: [951,29,319,74,245], // VERTICAL ELLIPSIS + 0x22EF: [336,-166,1295,74,1221], // MIDLINE HORIZONTAL ELLIPSIS + 0x22F1: [871,-101,1323,129,1194], // DOWN RIGHT DIAGONAL ELLIPSIS + 0x2308: [750,248,511,194,493], // LEFT CEILING + 0x2309: [750,248,511,17,317], // RIGHT CEILING + 0x230A: [749,248,511,194,493], // LEFT FLOOR + 0x230B: [749,248,511,17,317], // RIGHT FLOOR + 0x2322: [405,-108,1150,65,1084], // stix-small down curve + 0x2323: [392,-126,1150,64,1085], // stix-small up curve + 0x25B3: [711,-1,1022,69,953], // WHITE UP-POINTING TRIANGLE + 0x25B9: [540,39,575,33,542], // WHITE RIGHT-POINTING SMALL TRIANGLE + 0x25BD: [500,210,1022,68,953], // WHITE DOWN-POINTING TRIANGLE + 0x25C3: [539,38,575,33,542], // WHITE LEFT-POINTING SMALL TRIANGLE + 0x25EF: [711,211,1150,65,1084], // LARGE CIRCLE + 0x2660: [719,129,894,64,829], // BLACK SPADE SUIT + 0x2661: [711,24,894,65,828], // WHITE HEART SUIT + 0x2662: [719,154,894,64,828], // WHITE DIAMOND SUIT + 0x2663: [719,129,894,32,861], // BLACK CLUB SUIT + 0x266D: [750,17,447,64,381], // MUSIC FLAT SIGN + 0x266E: [741,223,447,57,389], // MUSIC NATURAL SIGN + 0x266F: [724,224,447,63,382], // MUSIC SHARP SIGN + 0x27E8: [750,249,447,127,382], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [750,249,447,64,319], // MATHEMATICAL RIGHT ANGLE BRACKET + 0x27F5: [518,17,1805,64,1741], // LONG LEFTWARDS ARROW + 0x27F6: [518,17,1833,96,1773], // LONG RIGHTWARDS ARROW + 0x27F7: [518,17,2126,64,2061], // LONG LEFT RIGHT ARROW + 0x27F8: [547,46,1868,64,1804], // LONG LEFTWARDS DOUBLE ARROW + 0x27F9: [547,46,1870,64,1804], // LONG RIGHTWARDS DOUBLE ARROW + 0x27FA: [547,46,2126,64,2060], // LONG LEFT RIGHT DOUBLE ARROW + 0x27FC: [518,17,1833,65,1773], // LONG RIGHTWARDS ARROW FROM BAR + 0x2A3F: [686,0,900,39,860], // AMALGAMATION OR COPRODUCT + 0x2AAF: [696,199,894,96,797], // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN + 0x2AB0: [697,199,894,96,797] // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN +}); + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js new file mode 100644 index 0000000..b6c46d3 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js @@ -0,0 +1,210 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/HTML-CSS/fonts/TeX/Math/BoldItalic/Main.js + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Math-BoldItalic'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 255, ascent: 725, descent: 216, + weight: 'bold', + style: 'italic', + skew: { + 0x41: 0.16, + 0x42: 0.0958, + 0x43: 0.0958, + 0x44: 0.0639, + 0x45: 0.0958, + 0x46: 0.0958, + 0x47: 0.0958, + 0x48: 0.0639, + 0x49: 0.128, + 0x4A: 0.192, + 0x4B: 0.0639, + 0x4C: 0.0319, + 0x4D: 0.0958, + 0x4E: 0.0958, + 0x4F: 0.0958, + 0x50: 0.0958, + 0x51: 0.0958, + 0x52: 0.0958, + 0x53: 0.0958, + 0x54: 0.0958, + 0x55: 0.0319, + 0x58: 0.0958, + 0x5A: 0.0958, + 0x63: 0.0639, + 0x64: 0.192, + 0x65: 0.0639, + 0x66: 0.192, + 0x67: 0.0319, + 0x68: -0.0319, + 0x6C: 0.0958, + 0x6F: 0.0639, + 0x70: 0.0958, + 0x71: 0.0958, + 0x72: 0.0639, + 0x73: 0.0639, + 0x74: 0.0958, + 0x75: 0.0319, + 0x76: 0.0319, + 0x77: 0.0958, + 0x78: 0.0319, + 0x79: 0.0639, + 0x7A: 0.0639, + 0x393: 0.0958, + 0x394: 0.192, + 0x398: 0.0958, + 0x39B: 0.192, + 0x39E: 0.0958, + 0x3A0: 0.0639, + 0x3A3: 0.0958, + 0x3A5: 0.0639, + 0x3A6: 0.0958, + 0x3A8: 0.0639, + 0x3A9: 0.0958, + 0x3B1: 0.0319, + 0x3B2: 0.0958, + 0x3B4: 0.0639, + 0x3B5: 0.0958, + 0x3B6: 0.0958, + 0x3B7: 0.0639, + 0x3B8: 0.0958, + 0x3B9: 0.0639, + 0x3BC: 0.0319, + 0x3BD: 0.0319, + 0x3BE: 0.128, + 0x3BF: 0.0639, + 0x3C1: 0.0958, + 0x3C2: 0.0958, + 0x3C4: 0.0319, + 0x3C5: 0.0319, + 0x3C6: 0.0958, + 0x3C7: 0.0639, + 0x3C8: 0.128, + 0x3D1: 0.0958, + 0x3D5: 0.0958, + 0x3F1: 0.0958, + 0x3F5: 0.0639 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x2F: [711,210,894,160,733], // SOLIDUS + 0x41: [711,0,869,45,839], // LATIN CAPITAL LETTER A + 0x42: [686,0,866,43,853], // LATIN CAPITAL LETTER B + 0x43: [703,17,817,55,855], // LATIN CAPITAL LETTER C + 0x44: [686,0,938,43,914], // LATIN CAPITAL LETTER D + 0x45: [680,0,810,43,825], // LATIN CAPITAL LETTER E + 0x46: [680,0,689,43,809], // LATIN CAPITAL LETTER F + 0x47: [703,16,887,56,854], // LATIN CAPITAL LETTER G + 0x48: [686,0,982,43,1027], // LATIN CAPITAL LETTER H + 0x49: [686,0,511,30,573], // LATIN CAPITAL LETTER I + 0x4A: [686,17,631,42,694], // LATIN CAPITAL LETTER J + 0x4B: [686,0,971,43,1003], // LATIN CAPITAL LETTER K + 0x4C: [686,0,756,43,711], // LATIN CAPITAL LETTER L + 0x4D: [686,0,1142,43,1219], // LATIN CAPITAL LETTER M + 0x4E: [686,0,950,43,1027], // LATIN CAPITAL LETTER N + 0x4F: [703,17,837,53,815], // LATIN CAPITAL LETTER O + 0x50: [686,0,723,43,847], // LATIN CAPITAL LETTER P + 0x51: [703,194,869,53,815], // LATIN CAPITAL LETTER Q + 0x52: [686,17,872,43,881], // LATIN CAPITAL LETTER R + 0x53: [703,17,693,63,714], // LATIN CAPITAL LETTER S + 0x54: [675,0,637,22,772], // LATIN CAPITAL LETTER T + 0x55: [686,16,800,63,877], // LATIN CAPITAL LETTER U + 0x56: [686,16,678,62,886], // LATIN CAPITAL LETTER V + 0x57: [686,17,1093,61,1207], // LATIN CAPITAL LETTER W + 0x58: [686,0,947,38,953], // LATIN CAPITAL LETTER X + 0x59: [686,0,675,40,876], // LATIN CAPITAL LETTER Y + 0x5A: [686,0,773,68,805], // LATIN CAPITAL LETTER Z + 0x61: [452,8,633,38,607], // LATIN SMALL LETTER A + 0x62: [694,8,521,45,513], // LATIN SMALL LETTER B + 0x63: [451,8,513,40,509], // LATIN SMALL LETTER C + 0x64: [694,8,610,38,612], // LATIN SMALL LETTER D + 0x65: [452,8,554,42,509], // LATIN SMALL LETTER E + 0x66: [701,201,568,64,624], // LATIN SMALL LETTER F + 0x67: [452,202,545,0,540], // LATIN SMALL LETTER G + 0x68: [694,8,668,45,642], // LATIN SMALL LETTER H + 0x69: [694,8,405,24,367], // LATIN SMALL LETTER I + 0x6A: [694,202,471,-12,456], // LATIN SMALL LETTER J + 0x6B: [694,8,604,45,578], // LATIN SMALL LETTER K + 0x6C: [694,8,348,27,296], // LATIN SMALL LETTER L + 0x6D: [452,8,1032,24,1006], // LATIN SMALL LETTER M + 0x6E: [452,8,713,24,687], // LATIN SMALL LETTER N + 0x6F: [452,8,585,39,576], // LATIN SMALL LETTER O + 0x70: [452,194,601,-23,593], // LATIN SMALL LETTER P + 0x71: [452,194,542,38,550], // LATIN SMALL LETTER Q + 0x72: [452,8,529,24,500], // LATIN SMALL LETTER R + 0x73: [451,8,531,57,476], // LATIN SMALL LETTER S + 0x74: [643,7,415,21,387], // LATIN SMALL LETTER T + 0x75: [452,8,681,24,655], // LATIN SMALL LETTER U + 0x76: [453,8,567,24,540], // LATIN SMALL LETTER V + 0x77: [453,8,831,24,796], // LATIN SMALL LETTER W + 0x78: [452,8,659,43,599], // LATIN SMALL LETTER X + 0x79: [452,202,590,24,587], // LATIN SMALL LETTER Y + 0x7A: [452,8,555,34,539], // LATIN SMALL LETTER Z + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x393: [680,0,657,43,777], // GREEK CAPITAL LETTER GAMMA + 0x394: [711,0,958,59,904], // GREEK CAPITAL LETTER DELTA + 0x398: [702,17,867,54,844], // GREEK CAPITAL LETTER THETA + 0x39B: [711,0,806,44,776], // GREEK CAPITAL LETTER LAMDA + 0x39E: [675,0,841,62,867], // GREEK CAPITAL LETTER XI + 0x3A0: [680,0,982,43,1026], // GREEK CAPITAL LETTER PI + 0x3A3: [686,0,885,69,902], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [703,0,671,32,802], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [686,0,767,29,737], // GREEK CAPITAL LETTER PHI + 0x3A8: [686,0,714,22,790], // GREEK CAPITAL LETTER PSI + 0x3A9: [703,0,879,93,886], // GREEK CAPITAL LETTER OMEGA + 0x3B1: [452,8,761,39,712], // GREEK SMALL LETTER ALPHA + 0x3B2: [701,194,660,28,637], // GREEK SMALL LETTER BETA + 0x3B3: [451,211,590,5,617], // GREEK SMALL LETTER GAMMA + 0x3B4: [725,8,522,39,513], // GREEK SMALL LETTER DELTA + 0x3B5: [461,17,529,36,481], // GREEK SMALL LETTER EPSILON + 0x3B6: [711,202,508,48,521], // GREEK SMALL LETTER ZETA + 0x3B7: [452,211,600,24,600], // GREEK SMALL LETTER ETA + 0x3B8: [702,8,562,40,554], // GREEK SMALL LETTER THETA + 0x3B9: [452,8,412,38,386], // GREEK SMALL LETTER IOTA + 0x3BA: [452,8,668,45,642], // GREEK SMALL LETTER KAPPA + 0x3BB: [694,13,671,40,652], // GREEK SMALL LETTER LAMDA + 0x3BC: [452,211,708,33,682], // GREEK SMALL LETTER MU + 0x3BD: [452,2,577,38,608], // GREEK SMALL LETTER NU + 0x3BE: [711,201,508,23,490], // GREEK SMALL LETTER XI + 0x3BF: [452,8,585,39,576], // GREEK SMALL LETTER OMICRON + 0x3C0: [444,8,682,23,674], // GREEK SMALL LETTER PI + 0x3C1: [451,211,612,34,603], // GREEK SMALL LETTER RHO + 0x3C2: [451,105,424,33,457], // GREEK SMALL LETTER FINAL SIGMA + 0x3C3: [444,8,686,35,677], // GREEK SMALL LETTER SIGMA + 0x3C4: [444,13,521,23,610], // GREEK SMALL LETTER TAU + 0x3C5: [453,8,631,24,604], // GREEK SMALL LETTER UPSILON + 0x3C6: [452,216,747,53,703], // GREEK SMALL LETTER PHI + 0x3C7: [452,201,718,32,685], // GREEK SMALL LETTER CHI + 0x3C8: [694,202,758,24,732], // GREEK SMALL LETTER PSI + 0x3C9: [453,8,718,24,691], // GREEK SMALL LETTER OMEGA + 0x3D1: [701,8,692,24,656], // GREEK THETA SYMBOL + 0x3D5: [694,202,712,51,693], // GREEK PHI SYMBOL + 0x3D6: [444,8,975,23,961], // GREEK PI SYMBOL + 0x3F1: [451,194,612,75,603], // GREEK RHO SYMBOL + 0x3F5: [444,7,483,44,450] // GREEK LUNATE EPSILON SYMBOL +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js new file mode 100644 index 0000000..42553d0 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js @@ -0,0 +1,154 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_SansSerif-Bold'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 250, ascent: 750, descent: 250, + weight: 'bold', + 0x20: [0,0,250,0,0], // SPACE + 0x21: [694,0,367,110,256], // EXCLAMATION MARK + 0x22: [694,-442,558,37,420], // QUOTATION MARK + 0x23: [694,193,917,61,855], // NUMBER SIGN + 0x24: [750,56,550,49,488], // DOLLAR SIGN + 0x25: [750,56,1029,61,966], // PERCENT SIGN + 0x26: [716,22,831,47,769], // AMPERSAND + 0x27: [694,-442,306,80,226], // APOSTROPHE + 0x28: [750,249,428,79,366], // LEFT PARENTHESIS + 0x29: [750,250,428,61,348], // RIGHT PARENTHESIS + 0x2A: [750,-293,550,67,482], // ASTERISK + 0x2B: [617,116,856,61,794], // PLUS SIGN + 0x2C: [146,106,306,80,226], // COMMA + 0x2D: [273,-186,367,12,305], // HYPHEN-MINUS + 0x2E: [146,0,306,80,226], // FULL STOP + 0x2F: [750,249,550,61,488], // SOLIDUS + 0x30: [715,22,550,43,506], // DIGIT ZERO + 0x31: [716,-1,550,76,473], // DIGIT ONE + 0x32: [716,0,550,46,495], // DIGIT TWO + 0x33: [716,22,550,46,503], // DIGIT THREE + 0x34: [694,0,550,31,518], // DIGIT FOUR + 0x35: [694,22,550,37,494], // DIGIT FIVE + 0x36: [716,22,550,46,503], // DIGIT SIX + 0x37: [695,11,550,46,503], // DIGIT SEVEN + 0x38: [715,22,550,46,503], // DIGIT EIGHT + 0x39: [716,22,550,46,503], // DIGIT NINE + 0x3A: [458,0,306,80,226], // COLON + 0x3B: [458,106,306,80,226], // SEMICOLON + 0x3D: [407,-94,856,61,794], // EQUALS SIGN + 0x3F: [705,0,519,61,457], // QUESTION MARK + 0x40: [704,11,733,61,671], // COMMERCIAL AT + 0x41: [694,0,733,42,690], // LATIN CAPITAL LETTER A + 0x42: [694,-1,733,92,671], // LATIN CAPITAL LETTER B + 0x43: [704,11,703,61,647], // LATIN CAPITAL LETTER C + 0x44: [694,-1,794,92,732], // LATIN CAPITAL LETTER D + 0x45: [691,0,642,92,595], // LATIN CAPITAL LETTER E + 0x46: [691,0,611,92,564], // LATIN CAPITAL LETTER F + 0x47: [705,11,733,61,659], // LATIN CAPITAL LETTER G + 0x48: [694,0,794,92,702], // LATIN CAPITAL LETTER H + 0x49: [694,0,331,85,246], // LATIN CAPITAL LETTER I + 0x4A: [694,22,519,46,427], // LATIN CAPITAL LETTER J + 0x4B: [694,0,764,92,701], // LATIN CAPITAL LETTER K + 0x4C: [694,0,581,92,534], // LATIN CAPITAL LETTER L + 0x4D: [694,0,978,92,886], // LATIN CAPITAL LETTER M + 0x4E: [694,0,794,92,702], // LATIN CAPITAL LETTER N + 0x4F: [716,22,794,62,731], // LATIN CAPITAL LETTER O + 0x50: [694,0,703,92,641], // LATIN CAPITAL LETTER P + 0x51: [716,106,794,62,732], // LATIN CAPITAL LETTER Q + 0x52: [694,0,703,92,654], // LATIN CAPITAL LETTER R + 0x53: [716,22,611,49,549], // LATIN CAPITAL LETTER S + 0x54: [688,0,733,40,692], // LATIN CAPITAL LETTER T + 0x55: [694,22,764,92,672], // LATIN CAPITAL LETTER U + 0x56: [694,-1,733,27,705], // LATIN CAPITAL LETTER V + 0x57: [694,0,1039,24,1014], // LATIN CAPITAL LETTER W + 0x58: [694,0,733,37,694], // LATIN CAPITAL LETTER X + 0x59: [694,0,733,24,708], // LATIN CAPITAL LETTER Y + 0x5A: [694,0,672,61,616], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,343,79,318], // LEFT SQUARE BRACKET + 0x5D: [750,250,343,24,263], // RIGHT SQUARE BRACKET + 0x5E: [694,-537,550,108,441], // CIRCUMFLEX ACCENT + 0x5F: [-23,110,550,0,549], // LOW LINE + 0x61: [475,11,525,31,472], // LATIN SMALL LETTER A + 0x62: [694,10,561,54,523], // LATIN SMALL LETTER B + 0x63: [475,11,489,37,457], // LATIN SMALL LETTER C + 0x64: [694,11,561,37,507], // LATIN SMALL LETTER D + 0x65: [474,10,511,30,480], // LATIN SMALL LETTER E + 0x66: [705,0,336,29,381], // LATIN SMALL LETTER F + 0x67: [469,206,550,17,534], // LATIN SMALL LETTER G + 0x68: [694,0,561,53,508], // LATIN SMALL LETTER H + 0x69: [695,0,256,46,208], // LATIN SMALL LETTER I + 0x6A: [695,205,286,-71,232], // LATIN SMALL LETTER J + 0x6B: [694,0,531,63,496], // LATIN SMALL LETTER K + 0x6C: [694,0,256,54,201], // LATIN SMALL LETTER L + 0x6D: [469,0,867,53,815], // LATIN SMALL LETTER M + 0x6E: [468,0,561,53,508], // LATIN SMALL LETTER N + 0x6F: [474,11,550,32,518], // LATIN SMALL LETTER O + 0x70: [469,194,561,54,523], // LATIN SMALL LETTER P + 0x71: [469,194,561,37,507], // LATIN SMALL LETTER Q + 0x72: [469,0,372,54,356], // LATIN SMALL LETTER R + 0x73: [474,10,422,30,396], // LATIN SMALL LETTER S + 0x74: [589,10,404,20,373], // LATIN SMALL LETTER T + 0x75: [458,11,561,52,508], // LATIN SMALL LETTER U + 0x76: [458,0,500,26,473], // LATIN SMALL LETTER V + 0x77: [458,0,744,24,719], // LATIN SMALL LETTER W + 0x78: [458,0,500,24,475], // LATIN SMALL LETTER X + 0x79: [458,205,500,29,473], // LATIN SMALL LETTER Y + 0x7A: [458,0,476,31,442], // LATIN SMALL LETTER Z + 0x7E: [344,-198,550,92,457], // TILDE + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x131: [458,0,256,54,201], // LATIN SMALL LETTER DOTLESS I + 0x237: [458,205,286,-71,232], // LATIN SMALL LETTER DOTLESS J + 0x300: [694,-537,0,-458,-218], // COMBINING GRAVE ACCENT + 0x301: [694,-537,0,-334,-93], // COMBINING ACUTE ACCENT + 0x302: [694,-537,0,-442,-109], // COMBINING CIRCUMFLEX ACCENT + 0x303: [694,-548,0,-458,-93], // COMBINING TILDE + 0x304: [660,-560,0,-474,-77], // COMBINING MACRON + 0x306: [694,-552,0,-470,-80], // COMBINING BREVE + 0x307: [695,-596,0,-356,-194], // COMBINING DOT ABOVE + 0x308: [695,-595,0,-459,-91], // COMBINING DIAERESIS + 0x30A: [694,-538,0,-365,-119], // COMBINING RING ABOVE + 0x30B: [694,-537,0,-440,-94], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [657,-500,0,-442,-109], // COMBINING CARON + 0x393: [691,0,581,92,534], // GREEK CAPITAL LETTER GAMMA + 0x394: [694,0,917,60,856], // GREEK CAPITAL LETTER DELTA + 0x398: [716,22,856,62,793], // GREEK CAPITAL LETTER THETA + 0x39B: [694,0,672,41,630], // GREEK CAPITAL LETTER LAMDA + 0x39E: [688,0,733,46,686], // GREEK CAPITAL LETTER XI + 0x3A0: [691,0,794,92,702], // GREEK CAPITAL LETTER PI + 0x3A3: [694,0,794,61,732], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [715,0,856,62,793], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [694,0,794,62,732], // GREEK CAPITAL LETTER PHI + 0x3A8: [694,0,856,61,794], // GREEK CAPITAL LETTER PSI + 0x3A9: [716,0,794,49,744], // GREEK CAPITAL LETTER OMEGA + 0x2013: [327,-240,550,0,549], // EN DASH + 0x2014: [327,-240,1100,0,1099], // EM DASH + 0x2018: [694,-443,306,81,226], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-442,306,80,226], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-443,558,138,520], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-442,558,37,420] // RIGHT DOUBLE QUOTATION MARK +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js new file mode 100644 index 0000000..bf70f15 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js @@ -0,0 +1,154 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_SansSerif-Italic'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 250, ascent: 750, descent: 250, + style: 'italic', + 0x20: [0,0,250,0,0], // SPACE + 0x21: [694,0,319,110,355], // EXCLAMATION MARK + 0x22: [694,-471,500,133,472], // QUOTATION MARK + 0x23: [694,194,833,87,851], // NUMBER SIGN + 0x24: [750,56,500,56,565], // DOLLAR SIGN + 0x25: [750,56,833,165,815], // PERCENT SIGN + 0x26: [716,22,758,71,747], // AMPERSAND + 0x27: [694,-471,278,190,335], // APOSTROPHE + 0x28: [750,250,389,104,491], // LEFT PARENTHESIS + 0x29: [750,250,389,2,390], // RIGHT PARENTHESIS + 0x2A: [750,-306,500,156,568], // ASTERISK + 0x2B: [583,83,778,108,775], // PLUS SIGN + 0x2C: [98,125,278,63,209], // COMMA + 0x2D: [259,-186,333,51,332], // HYPHEN-MINUS + 0x2E: [98,0,278,90,209], // FULL STOP + 0x2F: [750,250,500,6,600], // SOLIDUS + 0x30: [678,22,500,88,549], // DIGIT ZERO + 0x31: [678,0,500,88,451], // DIGIT ONE + 0x32: [678,0,500,50,551], // DIGIT TWO + 0x33: [678,22,500,56,544], // DIGIT THREE + 0x34: [656,0,500,62,521], // DIGIT FOUR + 0x35: [656,22,500,50,555], // DIGIT FIVE + 0x36: [678,22,500,94,548], // DIGIT SIX + 0x37: [656,11,500,143,596], // DIGIT SEVEN + 0x38: [678,22,500,77,554], // DIGIT EIGHT + 0x39: [677,22,500,77,545], // DIGIT NINE + 0x3A: [444,0,278,90,282], // COLON + 0x3B: [444,125,278,63,282], // SEMICOLON + 0x3D: [370,-130,778,88,796], // EQUALS SIGN + 0x3F: [704,0,472,173,536], // QUESTION MARK + 0x40: [705,10,667,120,707], // COMMERCIAL AT + 0x41: [694,0,667,28,638], // LATIN CAPITAL LETTER A + 0x42: [694,0,667,90,696], // LATIN CAPITAL LETTER B + 0x43: [705,10,639,124,719], // LATIN CAPITAL LETTER C + 0x44: [694,0,722,88,747], // LATIN CAPITAL LETTER D + 0x45: [691,0,597,86,688], // LATIN CAPITAL LETTER E + 0x46: [691,0,569,86,673], // LATIN CAPITAL LETTER F + 0x47: [705,11,667,125,730], // LATIN CAPITAL LETTER G + 0x48: [694,0,708,86,768], // LATIN CAPITAL LETTER H + 0x49: [694,0,278,87,338], // LATIN CAPITAL LETTER I + 0x4A: [694,22,472,46,535], // LATIN CAPITAL LETTER J + 0x4B: [694,0,694,88,785], // LATIN CAPITAL LETTER K + 0x4C: [694,0,542,87,516], // LATIN CAPITAL LETTER L + 0x4D: [694,0,875,92,929], // LATIN CAPITAL LETTER M + 0x4E: [694,0,708,88,766], // LATIN CAPITAL LETTER N + 0x4F: [716,22,736,118,763], // LATIN CAPITAL LETTER O + 0x50: [694,0,639,88,690], // LATIN CAPITAL LETTER P + 0x51: [716,125,736,118,763], // LATIN CAPITAL LETTER Q + 0x52: [694,0,646,88,698], // LATIN CAPITAL LETTER R + 0x53: [716,22,556,54,609], // LATIN CAPITAL LETTER S + 0x54: [688,0,681,165,790], // LATIN CAPITAL LETTER T + 0x55: [694,22,688,131,747], // LATIN CAPITAL LETTER U + 0x56: [694,0,667,161,799], // LATIN CAPITAL LETTER V + 0x57: [694,0,944,161,1076], // LATIN CAPITAL LETTER W + 0x58: [694,0,667,14,758], // LATIN CAPITAL LETTER X + 0x59: [694,0,667,151,810], // LATIN CAPITAL LETTER Y + 0x5A: [694,0,611,55,702], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,289,41,425], // LEFT SQUARE BRACKET + 0x5D: [750,250,289,-31,353], // RIGHT SQUARE BRACKET + 0x5E: [694,-527,500,190,533], // CIRCUMFLEX ACCENT + 0x5F: [-38,114,500,50,565], // LOW LINE + 0x61: [461,10,481,61,473], // LATIN SMALL LETTER A + 0x62: [694,11,517,75,539], // LATIN SMALL LETTER B + 0x63: [460,11,444,75,499], // LATIN SMALL LETTER C + 0x64: [694,10,517,73,588], // LATIN SMALL LETTER D + 0x65: [460,11,444,71,472], // LATIN SMALL LETTER E + 0x66: [705,0,306,94,494], // LATIN SMALL LETTER F + 0x67: [455,206,500,12,568], // LATIN SMALL LETTER G + 0x68: [694,0,517,73,513], // LATIN SMALL LETTER H + 0x69: [680,0,239,74,315], // LATIN SMALL LETTER I + 0x6A: [680,204,267,-96,336], // LATIN SMALL LETTER J + 0x6B: [694,0,489,76,543], // LATIN SMALL LETTER K + 0x6C: [694,0,239,74,311], // LATIN SMALL LETTER L + 0x6D: [455,0,794,73,790], // LATIN SMALL LETTER M + 0x6E: [454,0,517,73,513], // LATIN SMALL LETTER N + 0x6F: [461,11,500,69,523], // LATIN SMALL LETTER O + 0x70: [455,194,517,34,538], // LATIN SMALL LETTER P + 0x71: [455,194,517,72,538], // LATIN SMALL LETTER Q + 0x72: [455,0,342,74,424], // LATIN SMALL LETTER R + 0x73: [461,11,383,35,436], // LATIN SMALL LETTER S + 0x74: [571,11,361,97,410], // LATIN SMALL LETTER T + 0x75: [444,10,517,90,537], // LATIN SMALL LETTER U + 0x76: [444,0,461,108,540], // LATIN SMALL LETTER V + 0x77: [444,0,683,108,762], // LATIN SMALL LETTER W + 0x78: [444,0,461,1,537], // LATIN SMALL LETTER X + 0x79: [444,205,461,1,540], // LATIN SMALL LETTER Y + 0x7A: [444,0,435,28,494], // LATIN SMALL LETTER Z + 0x7E: [327,-193,500,199,560], // TILDE + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x131: [444,0,239,74,258], // LATIN SMALL LETTER DOTLESS I + 0x237: [444,204,267,-96,286], // LATIN SMALL LETTER DOTLESS J + 0x300: [694,-527,0,-270,-87], // COMBINING GRAVE ACCENT + 0x301: [694,-527,0,-190,63], // COMBINING ACUTE ACCENT + 0x302: [694,-527,0,-310,33], // COMBINING CIRCUMFLEX ACCENT + 0x303: [677,-543,0,-301,60], // COMBINING TILDE + 0x304: [631,-552,0,-314,64], // COMBINING MACRON + 0x306: [694,-508,0,-284,73], // COMBINING BREVE + 0x307: [680,-576,0,-180,-54], // COMBINING DOT ABOVE + 0x308: [680,-582,0,-273,40], // COMBINING DIAERESIS + 0x30A: [693,-527,0,-227,-2], // COMBINING RING ABOVE + 0x30B: [694,-527,0,-287,63], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [654,-487,0,-283,60], // COMBINING CARON + 0x393: [691,0,542,87,646], // GREEK CAPITAL LETTER GAMMA + 0x394: [694,0,833,42,790], // GREEK CAPITAL LETTER DELTA + 0x398: [715,22,778,119,804], // GREEK CAPITAL LETTER THETA + 0x39B: [694,0,611,28,582], // GREEK CAPITAL LETTER LAMDA + 0x39E: [688,0,667,42,765], // GREEK CAPITAL LETTER XI + 0x3A0: [691,0,708,86,768], // GREEK CAPITAL LETTER PI + 0x3A3: [694,0,722,55,813], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [716,0,778,173,843], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [694,0,722,124,743], // GREEK CAPITAL LETTER PHI + 0x3A8: [694,0,778,171,854], // GREEK CAPITAL LETTER PSI + 0x3A9: [716,0,722,44,769], // GREEK CAPITAL LETTER OMEGA + 0x2013: [312,-236,500,50,565], // EN DASH + 0x2014: [312,-236,1000,50,1065], // EM DASH + 0x2018: [694,-471,278,190,336], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-471,278,190,335], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-471,500,274,614], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-471,500,133,472] // RIGHT DOUBLE QUOTATION MARK +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js new file mode 100644 index 0000000..a49d5ad --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js @@ -0,0 +1,154 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_SansSerif'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 250, ascent: 750, descent: 250, + + 0x20: [0,0,250,0,0], // SPACE + 0x21: [694,0,319,110,208], // EXCLAMATION MARK + 0x22: [694,-471,500,32,325], // QUOTATION MARK + 0x23: [694,194,833,56,777], // NUMBER SIGN + 0x24: [750,56,500,44,444], // DOLLAR SIGN + 0x25: [750,56,833,56,776], // PERCENT SIGN + 0x26: [716,22,758,42,702], // AMPERSAND + 0x27: [694,-471,278,89,188], // APOSTROPHE + 0x28: [750,250,389,74,333], // LEFT PARENTHESIS + 0x29: [750,250,389,55,314], // RIGHT PARENTHESIS + 0x2A: [750,-306,500,63,436], // ASTERISK + 0x2B: [583,82,778,56,722], // PLUS SIGN + 0x2C: [98,125,278,89,188], // COMMA + 0x2D: [259,-186,333,11,277], // HYPHEN-MINUS + 0x2E: [98,0,278,90,188], // FULL STOP + 0x2F: [750,250,500,56,445], // SOLIDUS + 0x30: [678,22,500,39,460], // DIGIT ZERO + 0x31: [678,0,500,83,430], // DIGIT ONE + 0x32: [677,0,500,42,449], // DIGIT TWO + 0x33: [678,22,500,42,457], // DIGIT THREE + 0x34: [656,0,500,28,471], // DIGIT FOUR + 0x35: [656,21,500,33,449], // DIGIT FIVE + 0x36: [677,22,500,42,457], // DIGIT SIX + 0x37: [656,11,500,42,457], // DIGIT SEVEN + 0x38: [678,22,500,43,456], // DIGIT EIGHT + 0x39: [677,22,500,42,457], // DIGIT NINE + 0x3A: [444,0,278,90,188], // COLON + 0x3B: [444,125,278,89,188], // SEMICOLON + 0x3D: [370,-130,778,56,722], // EQUALS SIGN + 0x3F: [704,0,472,55,416], // QUESTION MARK + 0x40: [704,11,667,56,612], // COMMERCIAL AT + 0x41: [694,0,667,28,638], // LATIN CAPITAL LETTER A + 0x42: [694,0,667,90,610], // LATIN CAPITAL LETTER B + 0x43: [705,11,639,59,587], // LATIN CAPITAL LETTER C + 0x44: [694,0,722,88,666], // LATIN CAPITAL LETTER D + 0x45: [691,0,597,86,554], // LATIN CAPITAL LETTER E + 0x46: [691,0,569,86,526], // LATIN CAPITAL LETTER F + 0x47: [704,11,667,59,599], // LATIN CAPITAL LETTER G + 0x48: [694,0,708,86,621], // LATIN CAPITAL LETTER H + 0x49: [694,0,278,87,191], // LATIN CAPITAL LETTER I + 0x4A: [694,22,472,42,388], // LATIN CAPITAL LETTER J + 0x4B: [694,0,694,88,651], // LATIN CAPITAL LETTER K + 0x4C: [694,0,542,87,499], // LATIN CAPITAL LETTER L + 0x4D: [694,0,875,92,782], // LATIN CAPITAL LETTER M + 0x4E: [694,0,708,88,619], // LATIN CAPITAL LETTER N + 0x4F: [715,22,736,55,680], // LATIN CAPITAL LETTER O + 0x50: [694,0,639,88,583], // LATIN CAPITAL LETTER P + 0x51: [715,125,736,55,680], // LATIN CAPITAL LETTER Q + 0x52: [694,0,646,88,617], // LATIN CAPITAL LETTER R + 0x53: [716,22,556,44,500], // LATIN CAPITAL LETTER S + 0x54: [688,0,681,36,644], // LATIN CAPITAL LETTER T + 0x55: [694,22,688,87,600], // LATIN CAPITAL LETTER U + 0x56: [694,0,667,14,652], // LATIN CAPITAL LETTER V + 0x57: [694,0,944,14,929], // LATIN CAPITAL LETTER W + 0x58: [694,0,667,14,652], // LATIN CAPITAL LETTER X + 0x59: [694,0,667,3,663], // LATIN CAPITAL LETTER Y + 0x5A: [694,0,611,55,560], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,289,94,266], // LEFT SQUARE BRACKET + 0x5D: [750,250,289,22,194], // RIGHT SQUARE BRACKET + 0x5E: [694,-527,500,78,421], // CIRCUMFLEX ACCENT + 0x5F: [-38,114,500,0,499], // LOW LINE + 0x61: [460,10,481,38,407], // LATIN SMALL LETTER A + 0x62: [694,11,517,75,482], // LATIN SMALL LETTER B + 0x63: [460,10,444,34,415], // LATIN SMALL LETTER C + 0x64: [694,10,517,33,441], // LATIN SMALL LETTER D + 0x65: [461,10,444,28,415], // LATIN SMALL LETTER E + 0x66: [705,0,306,27,347], // LATIN SMALL LETTER F + 0x67: [455,206,500,28,485], // LATIN SMALL LETTER G + 0x68: [694,0,517,73,443], // LATIN SMALL LETTER H + 0x69: [680,0,239,67,171], // LATIN SMALL LETTER I + 0x6A: [680,205,267,-59,192], // LATIN SMALL LETTER J + 0x6B: [694,0,489,76,471], // LATIN SMALL LETTER K + 0x6C: [694,0,239,74,164], // LATIN SMALL LETTER L + 0x6D: [455,0,794,73,720], // LATIN SMALL LETTER M + 0x6E: [455,0,517,73,443], // LATIN SMALL LETTER N + 0x6F: [460,10,500,28,471], // LATIN SMALL LETTER O + 0x70: [455,194,517,75,483], // LATIN SMALL LETTER P + 0x71: [455,194,517,33,441], // LATIN SMALL LETTER Q + 0x72: [455,0,342,74,327], // LATIN SMALL LETTER R + 0x73: [460,10,383,28,360], // LATIN SMALL LETTER S + 0x74: [571,10,361,18,333], // LATIN SMALL LETTER T + 0x75: [444,10,517,73,443], // LATIN SMALL LETTER U + 0x76: [444,0,461,14,446], // LATIN SMALL LETTER V + 0x77: [444,0,683,14,668], // LATIN SMALL LETTER W + 0x78: [444,0,461,0,460], // LATIN SMALL LETTER X + 0x79: [444,204,461,14,446], // LATIN SMALL LETTER Y + 0x7A: [444,0,435,28,402], // LATIN SMALL LETTER Z + 0x7E: [327,-193,500,83,416], // TILDE + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x131: [444,0,239,74,164], // LATIN SMALL LETTER DOTLESS I + 0x237: [444,205,267,-59,192], // LATIN SMALL LETTER DOTLESS J + 0x300: [694,-527,0,-417,-199], // COMBINING GRAVE ACCENT + 0x301: [694,-527,0,-302,-84], // COMBINING ACUTE ACCENT + 0x302: [694,-527,0,-422,-79], // COMBINING CIRCUMFLEX ACCENT + 0x303: [677,-543,0,-417,-84], // COMBINING TILDE + 0x304: [631,-552,0,-431,-70], // COMBINING MACRON + 0x306: [694,-508,0,-427,-74], // COMBINING BREVE + 0x307: [680,-576,0,-302,-198], // COMBINING DOT ABOVE + 0x308: [680,-582,0,-397,-104], // COMBINING DIAERESIS + 0x30A: [694,-527,0,-319,-99], // COMBINING RING ABOVE + 0x30B: [694,-527,0,-399,-84], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [654,-487,0,-422,-79], // COMBINING CARON + 0x393: [691,0,542,87,499], // GREEK CAPITAL LETTER GAMMA + 0x394: [694,0,833,42,790], // GREEK CAPITAL LETTER DELTA + 0x398: [716,21,778,56,722], // GREEK CAPITAL LETTER THETA + 0x39B: [694,0,611,28,582], // GREEK CAPITAL LETTER LAMDA + 0x39E: [688,0,667,42,624], // GREEK CAPITAL LETTER XI + 0x3A0: [691,0,708,86,621], // GREEK CAPITAL LETTER PI + 0x3A3: [694,0,722,55,666], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [716,0,778,55,722], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [694,0,722,55,666], // GREEK CAPITAL LETTER PHI + 0x3A8: [694,0,778,55,722], // GREEK CAPITAL LETTER PSI + 0x3A9: [716,0,722,44,677], // GREEK CAPITAL LETTER OMEGA + 0x2013: [312,-236,500,0,499], // EN DASH + 0x2014: [312,-236,1000,0,999], // EM DASH + 0x2018: [694,-471,278,90,189], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-471,278,89,188], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-471,500,174,467], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-471,500,32,325] // RIGHT DOUBLE QUOTATION MARK +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js new file mode 100644 index 0000000..95ef8d1 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js @@ -0,0 +1,90 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Script'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 211, ascent: 735, descent: 314, + skew: { + 0x41: 0.389, + 0x42: 0.194, + 0x43: 0.278, + 0x44: 0.111, + 0x45: 0.139, + 0x46: 0.222, + 0x47: 0.25, + 0x48: 0.333, + 0x49: 0.333, + 0x4A: 0.417, + 0x4B: 0.361, + 0x4C: 0.306, + 0x4D: 0.444, + 0x4E: 0.389, + 0x4F: 0.167, + 0x50: 0.222, + 0x51: 0.278, + 0x52: 0.194, + 0x53: 0.333, + 0x54: 0.222, + 0x55: 0.25, + 0x56: 0.222, + 0x57: 0.25, + 0x58: 0.278, + 0x59: 0.194, + 0x5A: 0.306 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x41: [717,8,803,35,1016], // LATIN CAPITAL LETTER A + 0x42: [708,28,908,31,928], // LATIN CAPITAL LETTER B + 0x43: [728,26,666,26,819], // LATIN CAPITAL LETTER C + 0x44: [708,31,774,68,855], // LATIN CAPITAL LETTER D + 0x45: [707,8,562,46,718], // LATIN CAPITAL LETTER E + 0x46: [735,36,895,39,990], // LATIN CAPITAL LETTER F + 0x47: [717,37,610,12,738], // LATIN CAPITAL LETTER G + 0x48: [717,36,969,29,1241], // LATIN CAPITAL LETTER H + 0x49: [717,17,809,59,946], // LATIN CAPITAL LETTER I + 0x4A: [717,314,1052,92,1133], // LATIN CAPITAL LETTER J + 0x4B: [717,37,914,29,1204], // LATIN CAPITAL LETTER K + 0x4C: [717,17,874,14,1035], // LATIN CAPITAL LETTER L + 0x4D: [721,50,1080,30,1216], // LATIN CAPITAL LETTER M + 0x4E: [726,36,902,29,1208], // LATIN CAPITAL LETTER N + 0x4F: [707,8,738,96,805], // LATIN CAPITAL LETTER O + 0x50: [716,37,1013,90,1031], // LATIN CAPITAL LETTER P + 0x51: [717,17,883,54,885], // LATIN CAPITAL LETTER Q + 0x52: [717,17,850,-2,887], // LATIN CAPITAL LETTER R + 0x53: [708,36,868,29,1016], // LATIN CAPITAL LETTER S + 0x54: [735,37,747,92,996], // LATIN CAPITAL LETTER T + 0x55: [717,17,800,55,960], // LATIN CAPITAL LETTER U + 0x56: [717,17,622,56,850], // LATIN CAPITAL LETTER V + 0x57: [717,17,805,46,1026], // LATIN CAPITAL LETTER W + 0x58: [717,17,944,103,1131], // LATIN CAPITAL LETTER X + 0x59: [716,17,710,57,959], // LATIN CAPITAL LETTER Y + 0x5A: [717,16,821,83,1032], // LATIN CAPITAL LETTER Z + 0xA0: [0,0,250,0,0] // NO-BREAK SPACE +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js new file mode 100644 index 0000000..66cfd23 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js @@ -0,0 +1,157 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +(function (CHTML) { + +var font = 'MathJax_Typewriter'; + +CHTML.FONTDATA.FONTS[font] = { + className: CHTML.FONTDATA.familyName(font), + centerline: 233, ascent: 694, descent: 229, + + 0x20: [0,0,250,0,0], // SPACE + 0x21: [622,0,525,206,320], // EXCLAMATION MARK + 0x22: [623,-333,525,122,402], // QUOTATION MARK + 0x23: [611,0,525,36,489], // NUMBER SIGN + 0x24: [694,82,525,58,466], // DOLLAR SIGN + 0x25: [694,83,525,35,489], // PERCENT SIGN + 0x26: [622,11,525,28,490], // AMPERSAND + 0x27: [611,-287,525,175,349], // APOSTROPHE + 0x28: [694,82,525,166,437], // LEFT PARENTHESIS + 0x29: [694,82,525,87,358], // RIGHT PARENTHESIS + 0x2A: [520,-90,525,68,456], // ASTERISK + 0x2B: [531,-81,525,38,487], // PLUS SIGN + 0x2C: [140,139,525,173,353], // COMMA + 0x2D: [341,-271,525,57,468], // HYPHEN-MINUS + 0x2E: [140,-1,525,193,332], // FULL STOP + 0x2F: [694,83,525,58,466], // SOLIDUS + 0x30: [621,10,525,42,482], // DIGIT ZERO + 0x31: [622,-1,525,99,450], // DIGIT ONE + 0x32: [622,-1,525,52,472], // DIGIT TWO + 0x33: [622,11,525,44,479], // DIGIT THREE + 0x34: [624,-1,525,29,495], // DIGIT FOUR + 0x35: [611,10,525,52,472], // DIGIT FIVE + 0x36: [622,11,525,45,479], // DIGIT SIX + 0x37: [627,10,525,44,480], // DIGIT SEVEN + 0x38: [621,10,525,45,479], // DIGIT EIGHT + 0x39: [622,11,525,46,479], // DIGIT NINE + 0x3A: [431,-1,525,193,332], // COLON + 0x3B: [431,139,525,175,337], // SEMICOLON + 0x3C: [557,-55,525,57,468], // LESS-THAN SIGN + 0x3D: [417,-195,525,38,487], // EQUALS SIGN + 0x3E: [557,-55,525,57,468], // GREATER-THAN SIGN + 0x3F: [617,0,525,62,462], // QUESTION MARK + 0x40: [617,6,525,44,481], // COMMERCIAL AT + 0x41: [623,-1,525,28,496], // LATIN CAPITAL LETTER A + 0x42: [611,-1,525,17,482], // LATIN CAPITAL LETTER B + 0x43: [622,11,525,40,484], // LATIN CAPITAL LETTER C + 0x44: [611,-1,525,16,485], // LATIN CAPITAL LETTER D + 0x45: [611,-1,525,19,502], // LATIN CAPITAL LETTER E + 0x46: [611,-1,525,22,490], // LATIN CAPITAL LETTER F + 0x47: [622,11,525,38,496], // LATIN CAPITAL LETTER G + 0x48: [611,-1,525,16,508], // LATIN CAPITAL LETTER H + 0x49: [611,-1,525,72,452], // LATIN CAPITAL LETTER I + 0x4A: [611,11,525,57,479], // LATIN CAPITAL LETTER J + 0x4B: [611,-1,525,18,495], // LATIN CAPITAL LETTER K + 0x4C: [611,0,525,25,488], // LATIN CAPITAL LETTER L + 0x4D: [611,-1,525,12,512], // LATIN CAPITAL LETTER M + 0x4E: [611,0,525,20,504], // LATIN CAPITAL LETTER N + 0x4F: [621,10,525,56,468], // LATIN CAPITAL LETTER O + 0x50: [611,-1,525,19,480], // LATIN CAPITAL LETTER P + 0x51: [621,138,525,56,468], // LATIN CAPITAL LETTER Q + 0x52: [611,11,525,16,522], // LATIN CAPITAL LETTER R + 0x53: [622,11,525,52,472], // LATIN CAPITAL LETTER S + 0x54: [611,-1,525,26,498], // LATIN CAPITAL LETTER T + 0x55: [611,11,525,-3,528], // LATIN CAPITAL LETTER U + 0x56: [611,7,525,19,505], // LATIN CAPITAL LETTER V + 0x57: [611,7,525,12,512], // LATIN CAPITAL LETTER W + 0x58: [611,-1,525,28,495], // LATIN CAPITAL LETTER X + 0x59: [611,-1,525,20,505], // LATIN CAPITAL LETTER Y + 0x5A: [611,-1,525,48,481], // LATIN CAPITAL LETTER Z + 0x5B: [694,82,525,214,483], // LEFT SQUARE BRACKET + 0x5C: [694,83,525,58,466], // REVERSE SOLIDUS + 0x5D: [694,82,525,41,310], // RIGHT SQUARE BRACKET + 0x5E: [611,-460,525,96,428], // CIRCUMFLEX ACCENT + 0x5F: [-25,95,525,57,468], // LOW LINE + 0x60: [681,-357,525,176,350], // GRAVE ACCENT + 0x61: [439,6,525,48,524], // LATIN SMALL LETTER A + 0x62: [611,6,525,4,492], // LATIN SMALL LETTER B + 0x63: [440,6,525,66,466], // LATIN SMALL LETTER C + 0x64: [611,6,525,31,520], // LATIN SMALL LETTER D + 0x65: [440,6,525,48,464], // LATIN SMALL LETTER E + 0x66: [617,-1,525,35,437], // LATIN SMALL LETTER F + 0x67: [442,229,525,28,509], // LATIN SMALL LETTER G + 0x68: [611,-1,525,4,520], // LATIN SMALL LETTER H + 0x69: [612,-1,525,72,462], // LATIN SMALL LETTER I + 0x6A: [612,228,525,48,376], // LATIN SMALL LETTER J + 0x6B: [611,-1,525,13,507], // LATIN SMALL LETTER K + 0x6C: [611,-1,525,51,474], // LATIN SMALL LETTER L + 0x6D: [436,-1,525,-12,536], // LATIN SMALL LETTER M + 0x6E: [436,-1,525,4,520], // LATIN SMALL LETTER N + 0x6F: [440,6,525,52,472], // LATIN SMALL LETTER O + 0x70: [437,221,525,4,492], // LATIN SMALL LETTER P + 0x71: [437,221,525,34,545], // LATIN SMALL LETTER Q + 0x72: [437,-1,525,24,487], // LATIN SMALL LETTER R + 0x73: [440,6,525,72,458], // LATIN SMALL LETTER S + 0x74: [554,6,525,25,448], // LATIN SMALL LETTER T + 0x75: [431,5,525,4,520], // LATIN SMALL LETTER U + 0x76: [431,4,525,24,500], // LATIN SMALL LETTER V + 0x77: [431,4,525,16,508], // LATIN SMALL LETTER W + 0x78: [431,-1,525,29,495], // LATIN SMALL LETTER X + 0x79: [431,228,525,26,500], // LATIN SMALL LETTER Y + 0x7A: [431,-1,525,34,475], // LATIN SMALL LETTER Z + 0x7B: [694,83,525,50,475], // LEFT CURLY BRACKET + 0x7C: [694,82,525,228,297], // VERTICAL LINE + 0x7D: [694,83,525,49,475], // RIGHT CURLY BRACKET + 0x7E: [611,-466,525,87,437], // TILDE + 0x7F: [612,-519,525,104,421], // ?? + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x131: [431,-1,525,72,462], // LATIN SMALL LETTER DOTLESS I + 0x237: [431,228,525,48,376], // LATIN SMALL LETTER DOTLESS J + 0x300: [611,-485,0,-409,-195], // COMBINING GRAVE ACCENT + 0x301: [611,-485,0,-331,-117], // COMBINING ACUTE ACCENT + 0x302: [611,-460,0,-429,-97], // COMBINING CIRCUMFLEX ACCENT + 0x303: [611,-466,0,-438,-88], // COMBINING TILDE + 0x304: [577,-500,0,-452,-74], // COMBINING MACRON + 0x306: [611,-504,0,-446,-79], // COMBINING BREVE + 0x308: [612,-519,0,-421,-104], // COMBINING DIAERESIS + 0x30A: [619,-499,0,-344,-182], // COMBINING RING ABOVE + 0x30C: [577,-449,0,-427,-99], // COMBINING CARON + 0x393: [611,0,525,25,488], // GREEK CAPITAL LETTER GAMMA + 0x394: [623,0,525,35,489], // GREEK CAPITAL LETTER DELTA + 0x398: [621,10,525,56,468], // GREEK CAPITAL LETTER THETA + 0x39B: [623,-1,525,30,495], // GREEK CAPITAL LETTER LAMDA + 0x39E: [611,-1,525,33,491], // GREEK CAPITAL LETTER XI + 0x3A0: [611,-1,525,16,508], // GREEK CAPITAL LETTER PI + 0x3A3: [611,-1,525,40,484], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [622,-1,525,38,486], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [611,-1,525,41,483], // GREEK CAPITAL LETTER PHI + 0x3A8: [611,-1,525,37,487], // GREEK CAPITAL LETTER PSI + 0x3A9: [622,-1,525,32,492], // GREEK CAPITAL LETTER OMEGA + 0x7E2: [611,-287,525,175,349], // ?? + 0x7E3: [681,-357,525,176,350], // ?? + 0x2032: [623,-334,525,211,313] // PRIME +}; + +CHTML.fontLoaded("TeX/"+font.substr(8)); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js new file mode 100644 index 0000000..62d7389 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js @@ -0,0 +1,242 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js + * + * Adds extra stretchy characters to the TeX font data. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (CHTML) { + var VERSION = "2.7.9"; + + var DELIMITERS = CHTML.FONTDATA.DELIMITERS; + + var MAIN = "MathJax_Main", + BOLD = "MathJax_Main-Bold", + AMS = "MathJax_AMS", + SIZE1 = "MathJax_Size1", + SIZE4 = "MathJax_Size4"; + var H = "H", V = "V"; + var ARROWREP = [0x2212,MAIN,0,0,0,-.31,-.31]; // remove extra height/depth added below + var DARROWREP = [0x3D,MAIN,0,0,0,0,.1]; // add depth for arrow extender + + var delim = { + 0x003D: // equal sign + { + dir: H, HW: [[.767,MAIN]], stretch: {rep:[0x003D,MAIN]} + }, + 0x219E: // left two-headed arrow + { + dir: H, HW: [[1,AMS]], stretch: {left:[0x219E,AMS], rep:ARROWREP} + }, + 0x21A0: // right two-headed arrow + { + dir: H, HW: [[1,AMS]], stretch: {right:[0x21A0,AMS], rep:ARROWREP} + }, + 0x21A4: // left arrow from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x2190,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]} + }, + 0x21A5: // up arrow from bar + { + dir: V, HW: [], + stretch: {min:.6, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x2191,SIZE1]} + }, + 0x21A6: // right arrow from bar + { + dir: H, HW: [[1,MAIN]], + stretch: {left:[0x2223,SIZE1,-.09,-.05,.9], rep:ARROWREP, right:[0x2192,MAIN]} + }, + 0x21A7: // down arrow from bar + { + dir: V, HW: [], + stretch: {min:.6, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} + }, + 0x21B0: // up arrow with top leftwards + { + dir: V, HW: [[.722,AMS]], + stretch: {top:[0x21B0,AMS], ext:[0x23D0,SIZE1,.097]} + }, + 0x21B1: // up arrow with top right + { + dir: V, HW: [[.722,AMS]], + stretch: {top:[0x21B1,AMS,.27], ext:[0x23D0,SIZE1]} + }, + 0x21BC: // left harpoon with barb up + { + dir: H, HW: [[1,MAIN]], + stretch: {left:[0x21BC,MAIN], rep:ARROWREP} + }, + 0x21BD: // left harpoon with barb down + { + dir: H, HW: [[1,MAIN]], + stretch: {left:[0x21BD,MAIN], rep:ARROWREP} + }, + 0x21BE: // up harpoon with barb right + { + dir: V, HW: [[.888,AMS]], + stretch: {top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} + }, + 0x21BF: // up harpoon with barb left + { + dir: V, HW: [[.888,AMS]], + stretch: {top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} + }, + 0x21C0: // right harpoon with barb up + { + dir: H, HW: [[1,MAIN]], + stretch: {right:[0x21C0,MAIN], rep:ARROWREP} + }, + 0x21C1: // right harpoon with barb down + { + dir: H, HW: [[1,MAIN]], + stretch: {right:[0x21C1,MAIN], rep:ARROWREP} + }, + 0x21C2: // down harpoon with barb right + { + dir: V, HW: [[.888,AMS]], + stretch: {bot:[0x21C2,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} + }, + 0x21C3: // down harpoon with barb left + { + dir: V, HW: [[.888,AMS]], + stretch: {bot:[0x21C3,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]} + }, + 0x21DA: // left triple arrow + { + dir: H, HW: [[1,AMS]], + stretch: {left:[0x21DA,AMS], rep:[0x2261,MAIN]} + }, + 0x21DB: // right triple arrow + { + dir: H, HW: [[1,AMS]], + stretch: {right:[0x21DB,AMS], rep:[0x2261,MAIN]} + }, + 0x23B4: // top square bracket + { + dir: H, HW: [], + stretch: {min:.5, left:[0x250C,AMS,0,-.1], rep:[0x2212,MAIN,0,.35], right:[0x2510,AMS,0,-.1]} + }, + 0x23B5: // bottom square bracket + { + dir: H, HW: [], + stretch: {min:.5, left:[0x2514,AMS,0,.26], rep:[0x2212,MAIN,0,0,0,.25], right:[0x2518,AMS,0,.26]} + }, + 0x23DC: // top paren + { + dir: H, HW: [[.778,AMS,0,0x2322],[1,MAIN,0,0x2322]], + stretch: {left:[0xE150,SIZE4], rep:[0xE154,SIZE4], right:[0xE151,SIZE4]} + }, + 0x23DD: // bottom paren + { + dir: H, HW: [[.778,AMS,0,0x2323],[1,MAIN,0,0x2323]], + stretch: {left:[0xE152,SIZE4], rep:[0xE154,SIZE4], right:[0xE153,SIZE4]} + }, + 0x23E0: // top tortoise shell + { + dir: H, HW: [], + stretch: {min:1.25, left:[0x2CA,MAIN,-.1], rep:[0x2C9,MAIN,0,.13], right:[0x2CB,MAIN], fullExtenders:true} + }, + 0x23E1: // bottom tortoise shell + { + dir: H, HW: [], + stretch: {min:1.5, left:[0x2CB,MAIN,-.1,.1], rep:[0x2C9,MAIN], right:[0x2CA,MAIN,-.1,.1], fullExtenders:true} + }, + 0x2906: // leftwards double arrow from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x21D0,MAIN], rep:DARROWREP, right:[0x2223,SIZE1,0,-.1]} + }, + 0x2907: // rightwards double arrow from bar + { + dir: H, HW: [], + stretch: {min:.7, left:[0x22A8,AMS,0,-.12], rep:DARROWREP, right:[0x21D2,MAIN]} + }, + 0x294E: // left barb up right barb up harpoon + { + dir: H, HW: [], + stretch: {min:.5, left:[0x21BC,MAIN], rep:ARROWREP, right:[0x21C0,MAIN]} + }, + 0x294F: // up barb right down barb right harpoon + { + dir: V, HW: [], + stretch: {min:.5, top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]} + }, + 0x2950: // left barb dow right barb down harpoon + { + dir: H, HW: [], + stretch: {min:.5, left:[0x21BD,MAIN], rep:ARROWREP, right:[0x21C1,MAIN]} + }, + 0x2951: // up barb left down barb left harpoon + { + dir: V, HW: [], + stretch: {min:.5, top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]} + }, + 0x295A: // leftwards harpoon with barb up from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x21BC,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]} + }, + 0x295B: // rightwards harpoon with barb up from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:ARROWREP, right:[0x21C0,MAIN]} + }, + 0x295C: // up harpoon with barb right from bar + { + dir: V, HW: [], + stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BE,AMS,.12,0,1.1]} + }, + 0x295D: // down harpoon with barb right from bar + { + dir: V, HW: [], + stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]} + }, + 0x295E: // leftwards harpoon with barb down from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x21BD,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]} + }, + 0x295F: // rightwards harpoon with barb down from bar + { + dir: H, HW: [], + stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:ARROWREP, right:[0x21C1,MAIN]} + }, + 0x2960: // up harpoon with barb left from bar + { + dir: V, HW: [], + stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BF,AMS,.12,0,1.1]} + }, + 0x2961: // down harpoon with barb left from bar + { + dir: V, HW: [], + stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]} + } + }; + + for (var id in delim) {if (delim.hasOwnProperty(id)) {DELIMITERS[id] = delim[id]}}; + + CHTML.fontLoaded("TeX/fontdata-extra"); + +})(MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js b/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js new file mode 100644 index 0000000..9036c71 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js @@ -0,0 +1,1786 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/fonts/TeX/fontdata.js + * + * Initializes the CommonHTML OutputJax to use the MathJax TeX fonts + * for displaying mathematics. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (CHTML,MML,AJAX) { + var VERSION = "2.7.9"; + + var MAIN = "MathJax_Main", + BOLD = "MathJax_Main-Bold", + ITALIC = "MathJax_Math-Italic", + AMS = "MathJax_AMS", + SIZE1 = "MathJax_Size1", + SIZE2 = "MathJax_Size2", + SIZE3 = "MathJax_Size3", + SIZE4 = "MathJax_Size4"; + var H = "H", V = "V", EXTRAH = {load:"extra", dir:H}, EXTRAV = {load:"extra", dir:V}; + var ARROWREP = [0x2212,MAIN,0,0,0,-.31,-.31]; // remove extra height/depth added below + var DARROWREP = [0x3D,MAIN,0,0,0,0,.1]; // add depth for arrow extender + + var UNDEFINEDFAMILY = CHTML.config.undefinedFamily; + + MathJax.Hub.Insert(CHTML.config.styles,{ + ".MJXc-TeX-unknown-R": {"font-family":UNDEFINEDFAMILY, "font-style":"normal", "font-weight":"normal"}, + ".MJXc-TeX-unknown-I": {"font-family":UNDEFINEDFAMILY, "font-style":"italic", "font-weight":"normal"}, + ".MJXc-TeX-unknown-B": {"font-family":UNDEFINEDFAMILY, "font-style":"normal", "font-weight":"bold"}, + ".MJXc-TeX-unknown-BI": {"font-family":UNDEFINEDFAMILY, "font-style":"italic", "font-weight":"bold"} + }); + + CHTML.TEX = CHTML.TEXDEF; // use default TeX parameters + CHTML.FONTDEF.TeX = { + version: VERSION, + + baselineskip: 1.2, + lineH: .8, lineD: .2, + + FONTS: { +// +// These ones are defined below +// +// "MathJax_Main": +// "MathJax_Main-Bold": +// "MathJax_Main-Italic": +// "MathJax_Math-Italic": +// "MathJax_Caligraphic": +// "MathJax_Size1": +// "MathJax_Size2": +// "MathJax_Size3": +// "MathJax_Size4": + + "MathJax_AMS": "TeX/AMS-Regular.js", + "MathJax_Caligraphic-Bold": "TeX/Caligraphic-Bold.js", + "MathJax_Fraktur": "TeX/Fraktur-Regular.js", + "MathJax_Fraktur-Bold": "TeX/Fraktur-Bold.js", + "MathJax_Math-BoldItalic": "TeX/Math-BoldItalic.js", + "MathJax_SansSerif": "TeX/SansSerif-Regular.js", + "MathJax_SansSerif-Bold": "TeX/SansSerif-Bold.js", + "MathJax_SansSerif-Italic": "TeX/SansSerif-Italic.js", + "MathJax_Script": "TeX/Script-Regular.js", + "MathJax_Typewriter": "TeX/Typewriter-Regular.js" + }, + + UNKNOWN: { + R: {className:"MJXc-TeX-unknown-R"}, + I: {className:"MJXc-TeX-unknown-I"}, + B: {className:"MJXc-TeX-unknown-B"}, + BI: {className:"MJXc-TeX-unknown-BI"} + }, + + VARIANT: { + "normal": {fonts:[MAIN,SIZE1,AMS], cache: {}, + offsetG: 0x03B1, variantG: "italic", + remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, + 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, + 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58, + 0xE160:[0x2192, "-TeX-vec"], // HACK for \vec (#1709) + 0x2016:0x2225, + 0x2216:[0x2216,"-TeX-variant",true], // \smallsetminus + 0x210F:[0x210F,"-TeX-variant",true], // \hbar + 0x2032:[0x27,"sans-serif-italic"], // HACK: a smaller prime + 0x29F8:[0x002F,MML.VARIANT.ITALIC]}}, + "bold": {fonts:[BOLD], bold:true, cache: {}, chain:"normal", + offsetG: 0x03B1, variantG: "bold-italic", + remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, + 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, + 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58, 0x29F8:[0x002F,"bold-italic"], + 0xE160:[0x2192, "-TeX-vec-bold"], // HACK for \vec (#1709) + 0x2016:0x2225, + 0x219A:"\u2190\u0338", 0x219B:"\u2192\u0338", 0x21AE:"\u2194\u0338", + 0x21CD:"\u21D0\u0338", 0x21CE:"\u21D4\u0338", 0x21CF:"\u21D2\u0338", + 0x2204:"\u2203\u0338", 0x2224:"\u2223\u0338", 0x2226:"\u2225\u0338", + 0x2241:"\u223C\u0338", 0x2247:"\u2245\u0338", + 0x226E:"<\u0338", 0x226F:">\u0338", + 0x2270:"\u2264\u0338", 0x2271:"\u2265\u0338", + 0x2280:"\u227A\u0338", 0x2281:"\u227B\u0338", + 0x2288:"\u2286\u0338", 0x2289:"\u2287\u0338", + 0x22AC:"\u22A2\u0338", 0x22AD:"\u22A8\u0338", +// 0x22AE:"\u22A9\u0338", 0x22AF:"\u22AB\u0338", + 0x22E0:"\u227C\u0338", 0x22E1:"\u227D\u0338"//, +// 0x22EA:"\u22B2\u0338", 0x22EB:"\u22B3\u0338", +// 0x22EC:"\u22B4\u0338", 0x22ED:"\u22B5\u0338" + }}, + "italic": {fonts:[ITALIC,"MathJax_Main-Italic"], italic:true, cache: {}, chain:"normal", + remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, + 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, + 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, + "bold-italic": {fonts:["MathJax_Math-BoldItalic"], bold:true, italic:true, + cache: {}, chain:"bold", + remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, + 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, + 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, + "double-struck": {fonts:[AMS,MAIN,SIZE1], cache:{}}, + "fraktur": {fonts:["MathJax_Fraktur"], cache:{}, chain:"normal"}, + "bold-fraktur": {fonts:["MathJax_Fraktur-Bold"], bold:true, cache:{}, chain:"bold"}, + "script": {fonts:["MathJax_Script"], cache:{}, chain:"normal"}, + "bold-script": {fonts:["MathJax_Script"], bold:true, cache:{}, chain:"bold"}, + "sans-serif": {fonts:["MathJax_SansSerif"], cache:{}, chain:"normal"}, + "bold-sans-serif": {fonts:["MathJax_SansSerif-Bold"], bold:true, cache:{}, chain:"bold"}, + "sans-serif-italic": {fonts:["MathJax_SansSerif-Italic"], italic:true, cache:{}, chain:"italic"}, + "sans-serif-bold-italic": {fonts:["MathJax_SansSerif-Italic"], bold:true, italic:true, cache:{}, chain:"italic"}, + "monospace": {fonts:["MathJax_Typewriter"], cache:{}, chain:"normal"}, + "-tex-caligraphic": {fonts:["MathJax_Caligraphic"], offsetA: 0x41, variantA: "italic", cache:{}, chain:"normal"}, + "-tex-oldstyle": {fonts:["MathJax_Caligraphic"], cache:{}, chain:"normal"}, + "-tex-mathit": {fonts:["MathJax_Main-Italic"], italic:true, noIC: true, cache:{}, chain:"normal", + remap: {0x391:0x41, 0x392:0x42, 0x395:0x45, 0x396:0x5A, 0x397:0x48, + 0x399:0x49, 0x39A:0x4B, 0x39C:0x4D, 0x39D:0x4E, 0x39F:0x4F, + 0x3A1:0x50, 0x3A4:0x54, 0x3A7:0x58}}, + "-TeX-variant": {fonts:[AMS,MAIN,SIZE1], cache:{}, // HACK: to get larger prime for \prime + remap: { + 0x2268: 0xE00C, 0x2269: 0xE00D, 0x2270: 0xE011, 0x2271: 0xE00E, + 0x2A87: 0xE010, 0x2A88: 0xE00F, 0x2224: 0xE006, 0x2226: 0xE007, + 0x2288: 0xE016, 0x2289: 0xE018, 0x228A: 0xE01A, 0x228B: 0xE01B, + 0x2ACB: 0xE017, 0x2ACC: 0xE019, 0x03DC: 0xE008, 0x03F0: 0xE009, + 0x2216:[0x2216,MML.VARIANT.NORMAL,true], // \setminus + 0x210F:[0x210F,MML.VARIANT.NORMAL,true] // \hslash + }}, + "-TeX-vec": {fonts: ["MathJax_Vector"], cache:{}}, // HACK: non-combining \vec + "-TeX-vec-bold": {fonts: ["MathJax_Vector-Bold"], cache:{}}, // HACK: non-combining \vec + "-largeOp": {fonts:[SIZE2,SIZE1,MAIN,AMS],cache:{}}, + "-smallOp": {fonts:[SIZE1,MAIN,AMS], cache:{}}, + "-tex-caligraphic-bold": {fonts:["MathJax_Caligraphic-Bold","MathJax_Main-Bold"], bold:true, cache:{}, chain:"normal", + offsetA: 0x41, variantA: "bold-italic"}, + "-tex-oldstyle-bold": {fonts:["MathJax_Caligraphic-Bold","MathJax_Main-Bold"], bold:true, cache:{}, chain:"normal"} + }, + + RANGES: [ + {name: "alpha", low: 0x61, high: 0x7A, offset: "A", add: 32}, + {name: "number", low: 0x30, high: 0x39, offset: "N"}, + {name: "greek", low: 0x03B1, high: 0x03F6, offset: "G"} + ], + + REMAP: { + 0xA: 0x20, // newline + 0x203E: 0x2C9, // overline + 0xFE37: 0x23DE, 0xFE38: 0x23DF, // OverBrace, UnderBrace + + 0xB7: 0x22C5, // center dot + 0x2B9: 0x2032, // prime, + 0x3D2: 0x3A5, // Upsilon + 0x2206: 0x394, // increment + 0x2015: 0x2014, 0x2017: 0x5F, // horizontal bars + 0x2022: 0x2219, 0x2044: 0x2F, // bullet, fraction slash + 0x2305: 0x22BC, 0x2306: 0x2A5E, // barwedge, doublebarwedge + 0x25AA: 0x25A0, 0x25B4: 0x25B2, // blacksquare, blacktriangle + 0x25B5: 0x25B3, 0x25B8: 0x25B6, // triangle, blacktriangleright + 0x25BE: 0x25BC, 0x25BF: 0x25BD, // blacktriangledown, triangledown + 0x25C2: 0x25C0, // blacktriangleleft + 0x2329: 0x27E8, 0x232A: 0x27E9, // langle, rangle + 0x3008: 0x27E8, 0x3009: 0x27E9, // langle, rangle + 0x2758: 0x2223, // VerticalSeparator + 0x2A2F: 0xD7, // cross product + + 0x25FB: 0x25A1, 0x25FC: 0x25A0, // square, blacksquare + + // + // Letter-like symbols (that appear elsewhere) + // + 0x2102: [0x0043,MML.VARIANT.DOUBLESTRUCK], +// 0x210A: [0x0067,MML.VARIANT.SCRIPT], + 0x210B: [0x0048,MML.VARIANT.SCRIPT], + 0x210C: [0x0048,MML.VARIANT.FRAKTUR], + 0x210D: [0x0048,MML.VARIANT.DOUBLESTRUCK], + 0x210E: [0x0068,MML.VARIANT.ITALIC], + 0x2110: [0x004A,MML.VARIANT.SCRIPT], + 0x2111: [0x0049,MML.VARIANT.FRAKTUR], + 0x2112: [0x004C,MML.VARIANT.SCRIPT], + 0x2115: [0x004E,MML.VARIANT.DOUBLESTRUCK], + 0x2119: [0x0050,MML.VARIANT.DOUBLESTRUCK], + 0x211A: [0x0051,MML.VARIANT.DOUBLESTRUCK], + 0x211B: [0x0052,MML.VARIANT.SCRIPT], + 0x211C: [0x0052,MML.VARIANT.FRAKTUR], + 0x211D: [0x0052,MML.VARIANT.DOUBLESTRUCK], + 0x2124: [0x005A,MML.VARIANT.DOUBLESTRUCK], + 0x2126: [0x03A9,MML.VARIANT.NORMAL], + 0x2128: [0x005A,MML.VARIANT.FRAKTUR], + 0x212C: [0x0042,MML.VARIANT.SCRIPT], + 0x212D: [0x0043,MML.VARIANT.FRAKTUR], +// 0x212F: [0x0065,MML.VARIANT.SCRIPT], + 0x2130: [0x0045,MML.VARIANT.SCRIPT], + 0x2131: [0x0046,MML.VARIANT.SCRIPT], + 0x2133: [0x004D,MML.VARIANT.SCRIPT], +// 0x2134: [0x006F,MML.VARIANT.SCRIPT], + + 0x2247: 0x2246, // wrong placement of this character + 0x231C: 0x250C, 0x231D:0x2510, // wrong placement of \ulcorner, \urcorner + 0x231E: 0x2514, 0x231F:0x2518, // wrong placement of \llcorner, \lrcorner + + // + // compound symbols not in these fonts + // + 0x2204: "\u2203\u0338", // \not\exists + 0x220C: "\u220B\u0338", // \not\ni + 0x2244: "\u2243\u0338", // \not\simeq + 0x2249: "\u2248\u0338", // \not\approx + 0x2262: "\u2261\u0338", // \not\equiv + 0x226D: "\u224D\u0338", // \not\asymp + 0x2274: "\u2272\u0338", // \not\lesssim + 0x2275: "\u2273\u0338", // \not\gtrsim + 0x2278: "\u2276\u0338", // \not\lessgtr + 0x2279: "\u2277\u0338", // \not\gtrless + 0x2284: "\u2282\u0338", // \not\subset + 0x2285: "\u2283\u0338", // \not\supset + 0x22E2: "\u2291\u0338", // \not\sqsubseteq + 0x22E3: "\u2292\u0338", // \not\sqsupseteq + + 0x2A0C: "\u222C\u222C", // quadruple integral + + 0x2033: "\u2032\u2032", // double prime + 0x2034: "\u2032\u2032\u2032", // triple prime + 0x2036: "\u2035\u2035", // double back prime + 0x2037: "\u2035\u2035\u2035", // trile back prime + 0x2057: "\u2032\u2032\u2032\u2032", // quadruple prime + }, + + REMAPACCENT: { + "\u0300":"\u02CB", // grave accent + "\u0301":"\u02CA", // acute accent + "\u0302":"\u02C6", // curcumflex + "\u0303":"\u02DC", // tilde accent + "\u0304":"\u02C9", // macron + "\u0306":"\u02D8", // breve + "\u0307":"\u02D9", // dot + "\u0308":"\u00A8", // diaresis + "\u030A":"\u02DA", // ring above + "\u030C":"\u02C7", // caron + "\u20D7":"\uE160", // HACK: for non-combining \vec (#1709) + "\u2192":"\uE160", + "\u2032":"'", + "\u2035":"`", + "\u20D0":"\u21BC", "\u20D1":"\u21C0", // combining left and right harpoons + "\u20D6":"\u2190", "\u20E1":"\u2194", // combining left arrow and lef-right arrow + "\u20F0":"*", // combining asterisk + "\u20DB":"...", // combining three dots above + "\u20DC":"...." // combining four dots above + }, + REMAPACCENTUNDER: { + "\u20EC":"\u21C1", "\u20ED":"\u21BD", // combining low right and left harpoons + "\u20EE":"\u2190", "\u20EF":"\u2192", // combining low left and right arrows + "\u20DB":"...", // combining three dots above + "\u20DC":"...." // combining four dots above + }, + + PLANE1MAP: [ + [0x1D400,0x1D419, 0x41, MML.VARIANT.BOLD], + [0x1D41A,0x1D433, 0x61, MML.VARIANT.BOLD], + [0x1D434,0x1D44D, 0x41, MML.VARIANT.ITALIC], + [0x1D44E,0x1D467, 0x61, MML.VARIANT.ITALIC], + [0x1D468,0x1D481, 0x41, MML.VARIANT.BOLDITALIC], + [0x1D482,0x1D49B, 0x61, MML.VARIANT.BOLDITALIC], + [0x1D49C,0x1D4B5, 0x41, MML.VARIANT.SCRIPT], +// [0x1D4B6,0x1D4CF, 0x61, MML.VARIANT.SCRIPT], +// [0x1D4D0,0x1D4E9, 0x41, MML.VARIANT.BOLDSCRIPT], +// [0x1D4EA,0x1D503, 0x61, MML.VARIANT.BOLDSCRIPT], + [0x1D504,0x1D51D, 0x41, MML.VARIANT.FRAKTUR], + [0x1D51E,0x1D537, 0x61, MML.VARIANT.FRAKTUR], + [0x1D538,0x1D551, 0x41, MML.VARIANT.DOUBLESTRUCK], +// [0x1D552,0x1D56B, 0x61, MML.VARIANT.DOUBLESTRUCK], + [0x1D56C,0x1D585, 0x41, MML.VARIANT.BOLDFRAKTUR], + [0x1D586,0x1D59F, 0x61, MML.VARIANT.BOLDFRAKTUR], + [0x1D5A0,0x1D5B9, 0x41, MML.VARIANT.SANSSERIF], + [0x1D5BA,0x1D5D3, 0x61, MML.VARIANT.SANSSERIF], + [0x1D5D4,0x1D5ED, 0x41, MML.VARIANT.BOLDSANSSERIF], + [0x1D5EE,0x1D607, 0x61, MML.VARIANT.BOLDSANSSERIF], + [0x1D608,0x1D621, 0x41, MML.VARIANT.SANSSERIFITALIC], + [0x1D622,0x1D63B, 0x61, MML.VARIANT.SANSSERIFITALIC], +// [0x1D63C,0x1D655, 0x41, MML.VARIANT.SANSSERIFBOLDITALIC], +// [0x1D656,0x1D66F, 0x61, MML.VARIANT.SANSSERIFBOLDITALIC], + [0x1D670,0x1D689, 0x41, MML.VARIANT.MONOSPACE], + [0x1D68A,0x1D6A3, 0x61, MML.VARIANT.MONOSPACE], + + [0x1D6A8,0x1D6C1, 0x391, MML.VARIANT.BOLD], +// [0x1D6C2,0x1D6E1, 0x3B1, MML.VARIANT.BOLD], + [0x1D6E2,0x1D6FA, 0x391, MML.VARIANT.ITALIC], + [0x1D6FC,0x1D71B, 0x3B1, MML.VARIANT.ITALIC], + [0x1D71C,0x1D734, 0x391, MML.VARIANT.BOLDITALIC], + [0x1D736,0x1D755, 0x3B1, MML.VARIANT.BOLDITALIC], + [0x1D756,0x1D76E, 0x391, MML.VARIANT.BOLDSANSSERIF], +// [0x1D770,0x1D78F, 0x3B1, MML.VARIANT.BOLDSANSSERIF], + [0x1D790,0x1D7A8, 0x391, MML.VARIANT.SANSSERIFBOLDITALIC], +// [0x1D7AA,0x1D7C9, 0x3B1, MML.VARIANT.SANSSERIFBOLDITALIC], + + [0x1D7CE,0x1D7D7, 0x30, MML.VARIANT.BOLD], +// [0x1D7D8,0x1D7E1, 0x30, MML.VARIANT.DOUBLESTRUCK], + [0x1D7E2,0x1D7EB, 0x30, MML.VARIANT.SANSSERIF], + [0x1D7EC,0x1D7F5, 0x30, MML.VARIANT.BOLDSANSSERIF], + [0x1D7F6,0x1D7FF, 0x30, MML.VARIANT.MONOSPACE] + ], + + REMAPGREEK: { + 0x391: 0x41, 0x392: 0x42, 0x395: 0x45, 0x396: 0x5A, + 0x397: 0x48, 0x399: 0x49, 0x39A: 0x4B, 0x39C: 0x4D, + 0x39D: 0x4E, 0x39F: 0x4F, 0x3A1: 0x50, 0x3A2: 0x398, + 0x3A4: 0x54, 0x3A7: 0x58, 0x3AA: 0x2207, + 0x3CA: 0x2202, 0x3CB: 0x3F5, 0x3CC: 0x3D1, 0x3CD: 0x3F0, + 0x3CE: 0x3D5, 0x3CF: 0x3F1, 0x3D0: 0x3D6 + }, + + RemapPlane1: function (n,variant) { + for (var i = 0, m = this.PLANE1MAP.length; i < m; i++) { + if (n < this.PLANE1MAP[i][0]) break; + if (n <= this.PLANE1MAP[i][1]) { + n = n - this.PLANE1MAP[i][0] + this.PLANE1MAP[i][2]; + if (this.REMAPGREEK[n]) {n = this.REMAPGREEK[n]} + variant = this.VARIANT[this.PLANE1MAP[i][3]]; + break; + } + } + return {n: n, variant: variant}; + }, + + DELIMITERS: { + 0x0028: // ( + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top: [0x239B,SIZE4], ext: [0x239C,SIZE4], bot: [0x239D,SIZE4]} + }, + 0x0029: // ) + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x239E,SIZE4], ext:[0x239F,SIZE4], bot:[0x23A0,SIZE4]} + }, + 0x002F: // / + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]] + }, + 0x005B: // [ + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x23A1,SIZE4], ext:[0x23A2,SIZE4], bot:[0x23A3,SIZE4]} + }, + 0x005C: // \ + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]] + }, + 0x005D: // ] + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x23A4,SIZE4], ext:[0x23A5,SIZE4], bot:[0x23A6,SIZE4]} + }, + 0x007B: // { + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x23A7,SIZE4], mid:[0x23A8,SIZE4], bot:[0x23A9,SIZE4], ext:[0x23AA,SIZE4]} + }, + 0x007C: // | + { + dir: V, HW: [[1,MAIN]], stretch: {ext:[0x2223,MAIN]} + }, + 0x007D: // } + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top: [0x23AB,SIZE4], mid:[0x23AC,SIZE4], bot: [0x23AD,SIZE4], ext: [0x23AA,SIZE4]} + }, + 0x00AF: // macron + { + dir: H, HW: [[.59,MAIN]], stretch: {rep:[0xAF,MAIN]} + }, + 0x02C6: // wide hat + { + dir: H, HW: [[.267+.25,MAIN],[.567+.25,SIZE1],[1.005+.33,SIZE2],[1.447+.33,SIZE3],[1.909,SIZE4]] + }, + 0x02DC: // wide tilde + { + dir: H, HW: [[.333+.25,MAIN],[.555+.25,SIZE1],[1+.33,SIZE2],[1.443+.33,SIZE3],[1.887,SIZE4]] + }, + 0x2013: // en-dash + { + dir: H, HW: [[.5,MAIN]], stretch: {rep:[0x2013,MAIN]} + }, + 0x2016: // vertical arrow extension + { + dir: V, HW: [[.602,SIZE1],[1,MAIN,null,0x2225]], stretch: {ext:[0x2225,MAIN]} + }, + 0x2190: // left arrow + { + dir: H, HW: [[1,MAIN]], stretch: {left:[0x2190,MAIN], rep:ARROWREP} + }, + 0x2191: // \uparrow + { + dir: V, HW: [[.888,MAIN]], stretch: {top:[0x2191,SIZE1], ext:[0x23D0,SIZE1]} + }, + 0x2192: // right arrow + { + dir: H, HW: [[1,MAIN]], stretch: {rep:ARROWREP, right:[0x2192,MAIN]} + }, + 0x2193: // \downarrow + { + dir: V, HW: [[.888,MAIN]], stretch: {ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} + }, + 0x2194: // left-right arrow + { + dir: H, HW: [[1,MAIN]], + stretch: {left:[0x2190,MAIN], rep:ARROWREP, right:[0x2192,MAIN]} + }, + 0x2195: // \updownarrow + { + dir: V, HW: [[1.044,MAIN]], + stretch: {top:[0x2191,SIZE1], ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]} + }, + 0x21D0: // left double arrow + { + dir: H, HW: [[1,MAIN]], stretch: {left:[0x21D0,MAIN], rep:DARROWREP} + }, + 0x21D1: // \Uparrow + { + dir: V, HW: [[.888,MAIN]], stretch: {top:[0x21D1,SIZE1], ext:[0x2016,SIZE1]} + }, + 0x21D2: // right double arrow + { + dir: H, HW: [[1,MAIN]], stretch: {rep:DARROWREP, right:[0x21D2,MAIN]} + }, + 0x21D3: // \Downarrow + { + dir: V, HW: [[.888,MAIN]], stretch: {ext:[0x2016,SIZE1], bot:[0x21D3,SIZE1]} + }, + 0x21D4: // left-right double arrow + { + dir: H, HW: [[1,MAIN]], + stretch: {left:[0x21D0,MAIN], rep:DARROWREP, right:[0x21D2,MAIN]} + }, + 0x21D5: // \Updownarrow + { + dir: V, HW: [[1.044,MAIN]], + stretch: {top:[0x21D1,SIZE1], ext:[0x2016,SIZE1], bot:[0x21D3,SIZE1]} + }, + 0x2212: // horizontal line + { + dir: H, HW: [[.778,MAIN]], stretch: {rep:[0x2212,MAIN]} + }, + 0x221A: // \surd + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3,SIZE4]], + stretch: {top:[0xE001,SIZE4], ext:[0xE000,SIZE4], bot:[0x23B7,SIZE4], fullExtenders:true} + }, + 0x2223: // \vert + { + dir: V, HW: [[1,MAIN]], stretch: {ext:[0x2223,MAIN]} + }, + 0x2225: // \Vert + { + dir: V, HW: [[1,MAIN]], stretch: {ext:[0x2225,MAIN]} + }, + 0x2308: // \lceil + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x23A1,SIZE4], ext:[0x23A2,SIZE4]} + }, + 0x2309: // \rceil + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {top:[0x23A4,SIZE4], ext:[0x23A5,SIZE4]} + }, + 0x230A: // \lfloor + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {ext:[0x23A2,SIZE4], bot:[0x23A3,SIZE4]} + }, + 0x230B: // \rfloor + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]], + stretch: {ext:[0x23A5,SIZE4], bot:[0x23A6,SIZE4]} + }, + 0x23AA: // \bracevert + { + dir: V, HW: [[.32,SIZE4]], + stretch: {top:[0x23AA,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AA,SIZE4]} + }, + 0x23B0: // \lmoustache + { + dir: V, HW: [[.989,MAIN]], + stretch: {top:[0x23A7,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AD,SIZE4]} + }, + 0x23B1: // \rmoustache + { + dir: V, HW: [[.989,MAIN]], + stretch: {top:[0x23AB,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23A9,SIZE4]} + }, + 0x23D0: // vertical line extension + { + dir: V, HW: [[.602,SIZE1],[1,MAIN,null,0x2223]], stretch: {ext:[0x2223,MAIN]} + }, + 0x23DE: // horizontal brace down + { + dir: H, HW: [], + stretch: {min:.9, left:[0xE150,SIZE4], mid:[[0xE153,0xE152],SIZE4], right:[0xE151,SIZE4], rep:[0xE154,SIZE4]} + }, + 0x23DF: // horizontal brace up + { + dir: H, HW: [], + stretch: {min:.9, left:[0xE152,SIZE4], mid:[[0xE151,0xE150],SIZE4], right:[0xE153,SIZE4], rep:[0xE154,SIZE4]} + }, + 0x27E8: // \langle + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]] + }, + 0x27E9: // \rangle + { + dir: V, HW: [[1,MAIN],[1.2,SIZE1],[1.8,SIZE2],[2.4,SIZE3],[3.0,SIZE4]] + }, + 0x27EE: // \lgroup + { + dir: V, HW: [[.989,MAIN]], + stretch: {top:[0x23A7,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23A9,SIZE4]} + }, + 0x27EF: // \rgroup + { + dir: V, HW: [[.989,MAIN]], + stretch: {top:[0x23AB,SIZE4], ext:[0x23AA,SIZE4], bot:[0x23AD,SIZE4]} + }, + 0x002D: {alias: 0x2212, dir:H}, // minus + 0x005E: {alias: 0x02C6, dir:H}, // wide hat + 0x005F: {alias: 0x2013, dir:H}, // low line + 0x007E: {alias: 0x02DC, dir:H}, // wide tilde + 0x02C9: {alias: 0x00AF, dir:H}, // macron + 0x0302: {alias: 0x02C6, dir:H}, // wide hat + 0x0303: {alias: 0x02DC, dir:H}, // wide tilde + 0x030C: {alias: 0x02C7, dir:H}, // wide caron + 0x0332: {alias: 0x2013, dir:H}, // combining low line + 0x2014: {alias: 0x2013, dir:H}, // em-dash + 0x2015: {alias: 0x2013, dir:H}, // horizontal line + 0x2017: {alias: 0x2013, dir:H}, // horizontal line + 0x203E: {alias: 0x00AF, dir:H}, // overline + 0x20D7: {alias: 0x2192, dir:H}, // combining over right arrow (vector arrow) + 0x2215: {alias: 0x002F, dir:V}, // division slash + 0x2329: {alias: 0x27E8, dir:V}, // langle + 0x232A: {alias: 0x27E9, dir:V}, // rangle + 0x23AF: {alias: 0x2013, dir:H}, // horizontal line extension + 0x2500: {alias: 0x2013, dir:H}, // horizontal line + 0x2758: {alias: 0x2223, dir:V}, // vertical separator + 0x3008: {alias: 0x27E8, dir:V}, // langle + 0x3009: {alias: 0x27E9, dir:V}, // rangle + 0xFE37: {alias: 0x23DE, dir:H}, // horizontal brace down + 0xFE38: {alias: 0x23DF, dir:H}, // horizontal brace up + + 0x003D: EXTRAH, // equal sign + 0x219E: EXTRAH, // left two-headed arrow + 0x21A0: EXTRAH, // right two-headed arrow + 0x21A4: EXTRAH, // left arrow from bar + 0x21A5: EXTRAV, // up arrow from bar + 0x21A6: EXTRAH, // right arrow from bar + 0x21A7: EXTRAV, // down arrow from bar + 0x21B0: EXTRAV, // up arrow with top leftwards + 0x21B1: EXTRAV, // up arrow with top right + 0x21BC: EXTRAH, // left harpoon with barb up + 0x21BD: EXTRAH, // left harpoon with barb down + 0x21BE: EXTRAV, // up harpoon with barb right + 0x21BF: EXTRAV, // up harpoon with barb left + 0x21C0: EXTRAH, // right harpoon with barb up + 0x21C1: EXTRAH, // right harpoon with barb down + 0x21C2: EXTRAV, // down harpoon with barb right + 0x21C3: EXTRAV, // down harpoon with barb left + 0x21DA: EXTRAH, // left triple arrow + 0x21DB: EXTRAH, // right triple arrow + 0x23B4: EXTRAH, // top square bracket + 0x23B5: EXTRAH, // bottom square bracket + 0x23DC: EXTRAH, // top paren + 0x23DD: EXTRAH, // bottom paren + 0x23E0: EXTRAH, // top tortoise shell + 0x23E1: EXTRAH, // bottom tortoise shell + 0x2906: EXTRAH, // leftwards double arrow from bar + 0x2907: EXTRAH, // rightwards double arrow from bar + 0x294E: EXTRAH, // left barb up right barb up harpoon + 0x294F: EXTRAV, // up barb right down barb right harpoon + 0x2950: EXTRAH, // left barb dow right barb down harpoon + 0x2951: EXTRAV, // up barb left down barb left harpoon + 0x295A: EXTRAH, // leftwards harpoon with barb up from bar + 0x295B: EXTRAH, // rightwards harpoon with barb up from bar + 0x295C: EXTRAV, // up harpoon with barb right from bar + 0x295D: EXTRAV, // down harpoon with barb right from bar + 0x295E: EXTRAH, // leftwards harpoon with barb down from bar + 0x295F: EXTRAH, // rightwards harpoon with barb down from bar + 0x2960: EXTRAV, // up harpoon with barb left from bar + 0x2961: EXTRAV, // down harpoon with barb left from bar + 0x2312: {alias: 0x23DC, dir:H}, // arc + 0x2322: {alias: 0x23DC, dir:H}, // frown + 0x2323: {alias: 0x23DD, dir:H}, // smile + 0x27F5: {alias: 0x2190, dir:H}, // long left arrow + 0x27F6: {alias: 0x2192, dir:H}, // long right arrow + 0x27F7: {alias: 0x2194, dir:H}, // long left-right arrow + 0x27F8: {alias: 0x21D0, dir:H}, // long left double arrow + 0x27F9: {alias: 0x21D2, dir:H}, // long right double arrow + 0x27FA: {alias: 0x21D4, dir:H}, // long left-right double arrow + 0x27FB: {alias: 0x21A4, dir:H}, // long left arrow from bar + 0x27FC: {alias: 0x21A6, dir:H}, // long right arrow from bar + 0x27FD: {alias: 0x2906, dir:H}, // long left double arrow from bar + 0x27FE: {alias: 0x2907, dir:H}, // long right double arrow from bar + 0xE160: {alias: 0x2190, dir:H}, // replacement vector arrow + } + }; + + CHTML.FONTDATA = CHTML.FONTDEF["TeX"]; + + CHTML.FONTDATA.FONTS['MathJax_Caligraphic'] = { + centerline: 287, ascent: 789, descent: 216, + skew: { + 0x41: 0.194, + 0x42: 0.139, + 0x43: 0.139, + 0x44: 0.0833, + 0x45: 0.111, + 0x46: 0.111, + 0x47: 0.111, + 0x48: 0.111, + 0x49: 0.0278, + 0x4A: 0.167, + 0x4B: 0.0556, + 0x4C: 0.139, + 0x4D: 0.139, + 0x4E: 0.0833, + 0x4F: 0.111, + 0x50: 0.0833, + 0x51: 0.111, + 0x52: 0.0833, + 0x53: 0.139, + 0x54: 0.0278, + 0x55: 0.0833, + 0x56: 0.0278, + 0x57: 0.0833, + 0x58: 0.139, + 0x59: 0.0833, + 0x5A: 0.139 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x30: [452,22,500,39,460], // DIGIT ZERO + 0x31: [453,0,500,86,426], // DIGIT ONE + 0x32: [453,0,500,44,449], // DIGIT TWO + 0x33: [452,216,500,42,456], // DIGIT THREE + 0x34: [464,194,500,28,471], // DIGIT FOUR + 0x35: [453,216,500,50,448], // DIGIT FIVE + 0x36: [665,22,500,42,456], // DIGIT SIX + 0x37: [463,216,500,55,485], // DIGIT SEVEN + 0x38: [666,21,500,43,456], // DIGIT EIGHT + 0x39: [453,216,500,42,457], // DIGIT NINE + 0x41: [728,50,798,30,819], // LATIN CAPITAL LETTER A + 0x42: [705,22,657,32,664], // LATIN CAPITAL LETTER B + 0x43: [705,25,527,12,533], // LATIN CAPITAL LETTER C + 0x44: [683,0,771,19,766], // LATIN CAPITAL LETTER D + 0x45: [705,22,528,30,564], // LATIN CAPITAL LETTER E + 0x46: [683,32,719,18,829], // LATIN CAPITAL LETTER F + 0x47: [704,119,595,44,599], // LATIN CAPITAL LETTER G + 0x48: [683,48,845,18,803], // LATIN CAPITAL LETTER H + 0x49: [683,0,545,-30,642], // LATIN CAPITAL LETTER I + 0x4A: [683,119,678,47,839], // LATIN CAPITAL LETTER J + 0x4B: [705,22,762,32,732], // LATIN CAPITAL LETTER K + 0x4C: [705,22,690,32,656], // LATIN CAPITAL LETTER L + 0x4D: [705,50,1201,28,1137], // LATIN CAPITAL LETTER M + 0x4E: [789,50,820,-27,979], // LATIN CAPITAL LETTER N + 0x4F: [705,22,796,58,777], // LATIN CAPITAL LETTER O + 0x50: [683,57,696,19,733], // LATIN CAPITAL LETTER P + 0x51: [705,131,817,114,787], // LATIN CAPITAL LETTER Q + 0x52: [682,22,848,19,837], // LATIN CAPITAL LETTER R + 0x53: [705,22,606,18,642], // LATIN CAPITAL LETTER S + 0x54: [717,68,545,34,833], // LATIN CAPITAL LETTER T + 0x55: [683,28,626,-17,687], // LATIN CAPITAL LETTER U + 0x56: [683,52,613,25,658], // LATIN CAPITAL LETTER V + 0x57: [683,53,988,25,1034], // LATIN CAPITAL LETTER W + 0x58: [683,0,713,52,807], // LATIN CAPITAL LETTER X + 0x59: [683,143,668,31,714], // LATIN CAPITAL LETTER Y + 0x5A: [683,0,725,37,767], // LATIN CAPITAL LETTER Z + 0xA0: [0,0,250,0,0] // NO-BREAK SPACE + }; + + CHTML.FONTDATA.FONTS['MathJax_Main-Bold'] = { + centerline: 342, ascent: 951, descent: 267, + weight: 'bold', + file: "TeX/Main-Bold.js", + Extra: [ + 0xA0, 0xA8, 0xAC, [0xAF,0xB1], 0xB4, 0xD7, 0xF7, + 0x131, 0x237, + [0x2C6,0x2CB],[0x2D8,0x2DC], + [0x300,0x30C], 0x338, + [0x2002,0x2006], 0x2009, 0x200A, 0x2013, 0x2014, 0x2018, 0x2019, + 0x201C, 0x201D, 0x2020, 0x2021, 0x2026, 0x2032, + 0x20D7, + [0x210F,0x2113], 0x2118, 0x211C, 0x2135, + [0x2190,0x2199], 0x21A6, 0x21A9, 0x21AA, 0x21BC, 0x21BD, 0x21C0, + 0x21C1, 0x21CC, [0x21D0,0x21D5], + [0x2200,0x220B], [0x2212,0x221A], [0x221D,0x2220], + [0x2223,0x223C], 0x2240, 0x2243, 0x2245, 0x2248, 0x224D, 0x2250, + 0x2260, 0x2261, 0x2264, 0x2265, 0x226A, 0x226B, 0x227A, 0x227B, + 0x2282, 0x2283, 0x2286, 0x2287, 0x228E, [0x2291,0x2299], + [0x22A2,0x22A5], 0x22A8, [0x22C4,0x22C8], [0x22EE,0x22F1], + [0x2308,0x230B], 0x2322, 0x2323, + 0x25B3, 0x25B9, 0x25BD, 0x25C3, 0x25EF, + [0x2660,0x2663], [0x266D,0x266F], + 0x27E8, 0x27E9, + [0x27F5,0x27FC], + 0x2A3F, 0x2AAF, 0x2AB0 + ], + skew: { + 0x131: 0.0319, + 0x237: 0.0958, + 0x210F: -0.0319, + 0x2113: 0.128, + 0x2202: 0.0958 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x21: [705,-1,350,89,260], // EXCLAMATION MARK + 0x22: [694,-329,603,38,492], // QUOTATION MARK + 0x23: [694,193,958,64,893], // NUMBER SIGN + 0x24: [750,56,575,64,510], // DOLLAR SIGN + 0x25: [750,56,958,65,893], // PERCENT SIGN + 0x26: [705,11,894,48,836], // AMPERSAND + 0x27: [694,-329,319,74,261], // APOSTROPHE + 0x28: [750,249,447,103,382], // LEFT PARENTHESIS + 0x29: [750,249,447,64,343], // RIGHT PARENTHESIS + 0x2A: [750,-306,575,73,501], // ASTERISK + 0x2B: [633,131,894,64,829], // PLUS SIGN + 0x2C: [171,194,319,74,258], // COMMA + 0x2D: [278,-166,383,13,318], // HYPHEN-MINUS + 0x2E: [171,-1,319,74,245], // FULL STOP + 0x2F: [750,250,575,63,511], // SOLIDUS + 0x30: [654,10,575,45,529], // DIGIT ZERO + 0x31: [655,0,575,80,494], // DIGIT ONE + 0x32: [654,0,575,57,517], // DIGIT TWO + 0x33: [655,11,575,47,526], // DIGIT THREE + 0x34: [656,0,575,32,542], // DIGIT FOUR + 0x35: [655,11,575,57,517], // DIGIT FIVE + 0x36: [655,11,575,48,526], // DIGIT SIX + 0x37: [676,11,575,64,558], // DIGIT SEVEN + 0x38: [654,11,575,48,526], // DIGIT EIGHT + 0x39: [654,11,575,48,526], // DIGIT NINE + 0x3A: [444,-1,319,74,245], // COLON + 0x3B: [444,194,319,74,248], // SEMICOLON + 0x3C: [587,85,894,96,797], // LESS-THAN SIGN + 0x3D: [393,-109,894,64,829], // EQUALS SIGN + 0x3E: [587,85,894,96,797], // GREATER-THAN SIGN + 0x3F: [700,-1,543,65,478], // QUESTION MARK + 0x40: [699,6,894,64,829], // COMMERCIAL AT + 0x41: [698,0,869,40,828], // LATIN CAPITAL LETTER A + 0x42: [686,0,818,39,752], // LATIN CAPITAL LETTER B + 0x43: [697,11,831,64,766], // LATIN CAPITAL LETTER C + 0x44: [686,0,882,39,817], // LATIN CAPITAL LETTER D + 0x45: [680,0,756,39,723], // LATIN CAPITAL LETTER E + 0x46: [680,0,724,39,675], // LATIN CAPITAL LETTER F + 0x47: [697,10,904,64,845], // LATIN CAPITAL LETTER G + 0x48: [686,0,900,39,860], // LATIN CAPITAL LETTER H + 0x49: [686,0,436,25,410], // LATIN CAPITAL LETTER I + 0x4A: [686,11,594,8,527], // LATIN CAPITAL LETTER J + 0x4B: [686,0,901,39,852], // LATIN CAPITAL LETTER K + 0x4C: [686,0,692,39,643], // LATIN CAPITAL LETTER L + 0x4D: [686,0,1092,39,1052], // LATIN CAPITAL LETTER M + 0x4E: [686,0,900,39,860], // LATIN CAPITAL LETTER N + 0x4F: [696,10,864,64,798], // LATIN CAPITAL LETTER O + 0x50: [686,0,786,39,721], // LATIN CAPITAL LETTER P + 0x51: [696,193,864,64,805], // LATIN CAPITAL LETTER Q + 0x52: [686,11,862,39,858], // LATIN CAPITAL LETTER R + 0x53: [697,11,639,64,574], // LATIN CAPITAL LETTER S + 0x54: [675,0,800,41,758], // LATIN CAPITAL LETTER T + 0x55: [686,11,885,39,845], // LATIN CAPITAL LETTER U + 0x56: [686,7,869,25,843], // LATIN CAPITAL LETTER V + 0x57: [686,7,1189,24,1164], // LATIN CAPITAL LETTER W + 0x58: [686,0,869,33,835], // LATIN CAPITAL LETTER X + 0x59: [686,0,869,19,849], // LATIN CAPITAL LETTER Y + 0x5A: [686,0,703,64,645], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,319,128,293], // LEFT SQUARE BRACKET + 0x5C: [750,250,575,63,511], // REVERSE SOLIDUS + 0x5D: [750,250,319,25,190], // RIGHT SQUARE BRACKET + 0x5E: [694,-520,575,126,448], // CIRCUMFLEX ACCENT + 0x5F: [-10,61,575,0,574], // LOW LINE + 0x60: [706,-503,575,114,338], // GRAVE ACCENT + 0x61: [453,6,559,32,558], // LATIN SMALL LETTER A + 0x62: [694,6,639,29,600], // LATIN SMALL LETTER B + 0x63: [453,6,511,39,478], // LATIN SMALL LETTER C + 0x64: [694,6,639,38,609], // LATIN SMALL LETTER D + 0x65: [452,6,527,32,494], // LATIN SMALL LETTER E + 0x66: [700,0,351,40,452], // LATIN SMALL LETTER F + 0x67: [455,201,575,30,558], // LATIN SMALL LETTER G + 0x68: [694,0,639,37,623], // LATIN SMALL LETTER H + 0x69: [695,0,319,40,294], // LATIN SMALL LETTER I + 0x6A: [695,200,351,-71,274], // LATIN SMALL LETTER J + 0x6B: [694,0,607,29,587], // LATIN SMALL LETTER K + 0x6C: [694,0,319,40,301], // LATIN SMALL LETTER L + 0x6D: [450,0,958,37,942], // LATIN SMALL LETTER M + 0x6E: [450,0,639,37,623], // LATIN SMALL LETTER N + 0x6F: [452,5,575,32,542], // LATIN SMALL LETTER O + 0x70: [450,194,639,29,600], // LATIN SMALL LETTER P + 0x71: [450,194,607,38,609], // LATIN SMALL LETTER Q + 0x72: [450,0,474,29,442], // LATIN SMALL LETTER R + 0x73: [453,6,454,38,414], // LATIN SMALL LETTER S + 0x74: [635,5,447,21,382], // LATIN SMALL LETTER T + 0x75: [450,6,639,37,623], // LATIN SMALL LETTER U + 0x76: [444,3,607,26,580], // LATIN SMALL LETTER V + 0x77: [444,4,831,25,805], // LATIN SMALL LETTER W + 0x78: [444,0,607,21,586], // LATIN SMALL LETTER X + 0x79: [444,200,607,23,580], // LATIN SMALL LETTER Y + 0x7A: [444,0,511,32,462], // LATIN SMALL LETTER Z + 0x7B: [750,250,575,70,504], // LEFT CURLY BRACKET + 0x7C: [750,249,319,129,190], // VERTICAL LINE + 0x7D: [750,250,575,70,504], // RIGHT CURLY BRACKET + 0x7E: [344,-202,575,96,478], // TILDE + 0x393: [680,0,692,39,643], // GREEK CAPITAL LETTER GAMMA + 0x394: [698,0,958,56,901], // GREEK CAPITAL LETTER DELTA + 0x398: [696,10,894,64,829], // GREEK CAPITAL LETTER THETA + 0x39B: [698,0,806,40,765], // GREEK CAPITAL LETTER LAMDA + 0x39E: [675,0,767,48,718], // GREEK CAPITAL LETTER XI + 0x3A0: [680,0,900,39,860], // GREEK CAPITAL LETTER PI + 0x3A3: [686,0,831,63,766], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [697,0,894,64,829], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [686,0,831,64,766], // GREEK CAPITAL LETTER PHI + 0x3A8: [686,0,894,64,829], // GREEK CAPITAL LETTER PSI + 0x3A9: [696,0,831,51,779] // GREEK CAPITAL LETTER OMEGA + }; + + CHTML.FONTDATA.FONTS['MathJax_Main-Italic'] = { + centerline: 250, ascent: 750, descent: 250, + style: 'italic', + 0x20: [0,0,250,0,0], // SPACE + 0x21: [716,0,307,107,380], // EXCLAMATION MARK + 0x22: [694,-379,514,176,538], // QUOTATION MARK + 0x23: [694,194,818,115,828], // NUMBER SIGN + 0x25: [750,56,818,145,847], // PERCENT SIGN + 0x26: [716,22,767,127,802], // AMPERSAND + 0x27: [694,-379,307,213,377], // APOSTROPHE + 0x28: [750,250,409,144,517], // LEFT PARENTHESIS + 0x29: [750,250,409,17,390], // RIGHT PARENTHESIS + 0x2A: [750,-320,511,195,584], // ASTERISK + 0x2B: [557,57,767,139,753], // PLUS SIGN + 0x2C: [121,194,307,69,232], // COMMA + 0x2D: [251,-180,358,84,341], // HYPHEN-MINUS + 0x2E: [121,0,307,107,231], // FULL STOP + 0x2F: [750,250,511,19,617], // SOLIDUS + 0x30: [665,21,511,110,562], // DIGIT ZERO + 0x31: [666,0,511,110,468], // DIGIT ONE + 0x32: [666,22,511,76,551], // DIGIT TWO + 0x33: [666,22,511,96,562], // DIGIT THREE + 0x34: [666,194,511,46,478], // DIGIT FOUR + 0x35: [666,22,511,106,567], // DIGIT FIVE + 0x36: [665,22,511,120,565], // DIGIT SIX + 0x37: [666,22,511,136,634], // DIGIT SEVEN + 0x38: [666,21,511,99,553], // DIGIT EIGHT + 0x39: [666,22,511,107,553], // DIGIT NINE + 0x3A: [431,0,307,107,308], // COLON + 0x3B: [431,194,307,70,308], // SEMICOLON + 0x3D: [367,-133,767,116,776], // EQUALS SIGN + 0x3F: [716,0,511,195,551], // QUESTION MARK + 0x40: [705,11,767,152,789], // COMMERCIAL AT + 0x41: [716,0,743,58,696], // LATIN CAPITAL LETTER A + 0x42: [683,0,704,57,732], // LATIN CAPITAL LETTER B + 0x43: [705,21,716,150,812], // LATIN CAPITAL LETTER C + 0x44: [683,0,755,56,775], // LATIN CAPITAL LETTER D + 0x45: [680,0,678,54,743], // LATIN CAPITAL LETTER E + 0x46: [680,-1,653,54,731], // LATIN CAPITAL LETTER F + 0x47: [705,22,774,150,812], // LATIN CAPITAL LETTER G + 0x48: [683,0,743,54,860], // LATIN CAPITAL LETTER H + 0x49: [683,0,386,49,508], // LATIN CAPITAL LETTER I + 0x4A: [683,21,525,78,622], // LATIN CAPITAL LETTER J + 0x4B: [683,0,769,54,859], // LATIN CAPITAL LETTER K + 0x4C: [683,0,627,54,628], // LATIN CAPITAL LETTER L + 0x4D: [683,0,897,58,1010], // LATIN CAPITAL LETTER M + 0x4E: [683,0,743,54,860], // LATIN CAPITAL LETTER N + 0x4F: [704,22,767,149,788], // LATIN CAPITAL LETTER O + 0x50: [683,0,678,55,729], // LATIN CAPITAL LETTER P + 0x51: [704,194,767,149,788], // LATIN CAPITAL LETTER Q + 0x52: [683,22,729,55,723], // LATIN CAPITAL LETTER R + 0x53: [705,22,562,74,633], // LATIN CAPITAL LETTER S + 0x54: [677,0,716,171,806], // LATIN CAPITAL LETTER T + 0x55: [683,22,743,194,860], // LATIN CAPITAL LETTER U + 0x56: [683,22,743,205,868], // LATIN CAPITAL LETTER V + 0x57: [683,22,999,205,1124], // LATIN CAPITAL LETTER W + 0x58: [683,0,743,50,825], // LATIN CAPITAL LETTER X + 0x59: [683,0,743,198,875], // LATIN CAPITAL LETTER Y + 0x5A: [683,0,613,80,704], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,307,73,446], // LEFT SQUARE BRACKET + 0x5D: [750,250,307,-14,359], // RIGHT SQUARE BRACKET + 0x5E: [694,-527,511,260,528], // CIRCUMFLEX ACCENT + 0x5F: [-25,62,511,91,554], // LOW LINE + 0x61: [442,11,511,101,543], // LATIN SMALL LETTER A + 0x62: [694,11,460,108,467], // LATIN SMALL LETTER B + 0x63: [441,10,460,103,469], // LATIN SMALL LETTER C + 0x64: [694,11,511,101,567], // LATIN SMALL LETTER D + 0x65: [442,10,460,107,470], // LATIN SMALL LETTER E + 0x66: [705,204,307,-23,450], // LATIN SMALL LETTER F + 0x67: [442,205,460,46,494], // LATIN SMALL LETTER G + 0x68: [694,11,511,69,544], // LATIN SMALL LETTER H + 0x69: [656,10,307,75,340], // LATIN SMALL LETTER I + 0x6A: [656,204,307,-32,364], // LATIN SMALL LETTER J + 0x6B: [694,11,460,69,498], // LATIN SMALL LETTER K + 0x6C: [694,11,256,87,312], // LATIN SMALL LETTER L + 0x6D: [442,11,818,75,851], // LATIN SMALL LETTER M + 0x6E: [442,11,562,75,595], // LATIN SMALL LETTER N + 0x6F: [442,11,511,103,517], // LATIN SMALL LETTER O + 0x70: [442,194,511,6,518], // LATIN SMALL LETTER P + 0x71: [442,194,460,101,504], // LATIN SMALL LETTER Q + 0x72: [442,11,422,75,484], // LATIN SMALL LETTER R + 0x73: [442,11,409,76,418], // LATIN SMALL LETTER S + 0x74: [626,11,332,87,373], // LATIN SMALL LETTER T + 0x75: [441,11,537,75,570], // LATIN SMALL LETTER U + 0x76: [443,10,460,75,492], // LATIN SMALL LETTER V + 0x77: [443,11,664,75,696], // LATIN SMALL LETTER W + 0x78: [442,11,464,58,513], // LATIN SMALL LETTER X + 0x79: [441,205,486,75,522], // LATIN SMALL LETTER Y + 0x7A: [442,11,409,54,466], // LATIN SMALL LETTER Z + 0x7E: [318,-208,511,246,571], // TILDE + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0xA3: [714,11,769,88,699], // POUND SIGN + 0x131: [441,10,307,75,340], // LATIN SMALL LETTER DOTLESS I + 0x237: [442,204,332,-32,327], // LATIN SMALL LETTER DOTLESS J + 0x300: [697,-500,0,-222,-74], // COMBINING GRAVE ACCENT + 0x301: [697,-500,0,-173,39], // COMBINING ACUTE ACCENT + 0x302: [694,-527,0,-251,17], // COMBINING CIRCUMFLEX ACCENT + 0x303: [668,-558,0,-265,60], // COMBINING TILDE + 0x304: [589,-544,0,-282,54], // COMBINING MACRON + 0x306: [694,-515,0,-237,62], // COMBINING BREVE + 0x307: [669,-548,0,-165,-41], // COMBINING DOT ABOVE + 0x308: [669,-554,0,-251,45], // COMBINING DIAERESIS + 0x30A: [716,-542,0,-199,3], // COMBINING RING ABOVE + 0x30B: [697,-503,0,-248,65], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [638,-502,0,-236,29], // COMBINING CARON + 0x393: [680,0,627,54,705], // GREEK CAPITAL LETTER GAMMA + 0x394: [716,0,818,70,751], // GREEK CAPITAL LETTER DELTA + 0x398: [704,22,767,149,788], // GREEK CAPITAL LETTER THETA + 0x39B: [716,0,692,58,646], // GREEK CAPITAL LETTER LAMDA + 0x39E: [677,0,664,74,754], // GREEK CAPITAL LETTER XI + 0x3A0: [680,0,743,54,859], // GREEK CAPITAL LETTER PI + 0x3A3: [683,0,716,80,782], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [705,0,767,213,832], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [683,0,716,159,728], // GREEK CAPITAL LETTER PHI + 0x3A8: [683,0,767,207,824], // GREEK CAPITAL LETTER PSI + 0x3A9: [705,0,716,100,759], // GREEK CAPITAL LETTER OMEGA + 0x2013: [285,-248,511,91,554], // EN DASH + 0x2014: [285,-248,1022,117,1038], // EM DASH + 0x2018: [694,-379,307,197,362], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-379,307,213,377], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-379,514,243,606], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-379,514,176,538], // RIGHT DOUBLE QUOTATION MARK + 0x210F: [695,13,540,42,562] // stix-/hbar - Planck's over 2pi + }; + + CHTML.FONTDATA.FONTS['MathJax_Main'] = { + centerline: 314, ascent: 900, descent: 272, + skew: { + 0x131: 0.0278, + 0x237: 0.0833, + 0x2113: 0.111, + 0x2118: 0.111, + 0x2202: 0.0833 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x21: [716,-1,278,78,199], // EXCLAMATION MARK + 0x22: [694,-379,500,34,372], // QUOTATION MARK + 0x23: [694,194,833,56,777], // NUMBER SIGN + 0x24: [750,56,500,55,444], // DOLLAR SIGN + 0x25: [750,56,833,56,776], // PERCENT SIGN + 0x26: [716,22,778,42,727], // AMPERSAND + 0x27: [694,-379,278,78,212], // APOSTROPHE + 0x28: [750,250,389,94,333], // LEFT PARENTHESIS + 0x29: [750,250,389,55,294], // RIGHT PARENTHESIS + 0x2A: [750,-320,500,64,435], // ASTERISK + 0x2B: [583,82,778,56,722], // PLUS SIGN + 0x2C: [121,194,278,78,210], // COMMA + 0x2D: [252,-179,333,11,277], // HYPHEN-MINUS + 0x2E: [120,0,278,78,199], // FULL STOP + 0x2F: [750,250,500,56,445], // SOLIDUS + 0x30: [666,22,500,39,460], // DIGIT ZERO + 0x31: [666,0,500,83,427], // DIGIT ONE + 0x32: [666,0,500,50,449], // DIGIT TWO + 0x33: [665,22,500,42,457], // DIGIT THREE + 0x34: [677,0,500,28,471], // DIGIT FOUR + 0x35: [666,22,500,50,449], // DIGIT FIVE + 0x36: [666,22,500,42,456], // DIGIT SIX + 0x37: [676,22,500,55,485], // DIGIT SEVEN + 0x38: [666,22,500,43,457], // DIGIT EIGHT + 0x39: [666,22,500,42,456], // DIGIT NINE + 0x3A: [430,0,278,78,199], // COLON + 0x3B: [430,194,278,78,202], // SEMICOLON + 0x3C: [540,40,778,83,694], // LESS-THAN SIGN + 0x3D: [367,-133,778,56,722], // EQUALS SIGN + 0x3E: [540,40,778,83,694], // GREATER-THAN SIGN + 0x3F: [705,-1,472,55,416], // QUESTION MARK + 0x40: [705,11,778,56,722], // COMMERCIAL AT + 0x41: [716,0,750,32,717], // LATIN CAPITAL LETTER A + 0x42: [683,0,708,28,651], // LATIN CAPITAL LETTER B + 0x43: [705,21,722,56,666], // LATIN CAPITAL LETTER C + 0x44: [683,0,764,27,708], // LATIN CAPITAL LETTER D + 0x45: [680,0,681,25,652], // LATIN CAPITAL LETTER E + 0x46: [680,0,653,25,610], // LATIN CAPITAL LETTER F + 0x47: [705,22,785,56,735], // LATIN CAPITAL LETTER G + 0x48: [683,0,750,25,724], // LATIN CAPITAL LETTER H + 0x49: [683,0,361,21,339], // LATIN CAPITAL LETTER I + 0x4A: [683,22,514,25,465], // LATIN CAPITAL LETTER J + 0x4B: [683,0,778,25,736], // LATIN CAPITAL LETTER K + 0x4C: [683,0,625,25,582], // LATIN CAPITAL LETTER L + 0x4D: [683,0,917,29,887], // LATIN CAPITAL LETTER M + 0x4E: [683,0,750,25,724], // LATIN CAPITAL LETTER N + 0x4F: [705,22,778,56,722], // LATIN CAPITAL LETTER O + 0x50: [683,0,681,27,624], // LATIN CAPITAL LETTER P + 0x51: [705,193,778,56,728], // LATIN CAPITAL LETTER Q + 0x52: [683,22,736,27,732], // LATIN CAPITAL LETTER R + 0x53: [705,22,556,55,500], // LATIN CAPITAL LETTER S + 0x54: [677,0,722,36,685], // LATIN CAPITAL LETTER T + 0x55: [683,22,750,25,724], // LATIN CAPITAL LETTER U + 0x56: [683,22,750,19,730], // LATIN CAPITAL LETTER V + 0x57: [683,22,1028,18,1009], // LATIN CAPITAL LETTER W + 0x58: [683,0,750,23,726], // LATIN CAPITAL LETTER X + 0x59: [683,0,750,11,738], // LATIN CAPITAL LETTER Y + 0x5A: [683,0,611,55,560], // LATIN CAPITAL LETTER Z + 0x5B: [750,250,278,118,255], // LEFT SQUARE BRACKET + 0x5C: [750,250,500,56,444], // REVERSE SOLIDUS + 0x5D: [750,250,278,22,159], // RIGHT SQUARE BRACKET + 0x5E: [694,-531,500,112,387], // CIRCUMFLEX ACCENT + 0x5F: [-25,62,500,0,499], // LOW LINE + 0x60: [699,-505,500,106,295], // GRAVE ACCENT + 0x61: [448,11,500,34,493], // LATIN SMALL LETTER A + 0x62: [694,11,556,20,522], // LATIN SMALL LETTER B + 0x63: [448,11,444,34,415], // LATIN SMALL LETTER C + 0x64: [694,11,556,34,535], // LATIN SMALL LETTER D + 0x65: [448,11,444,28,415], // LATIN SMALL LETTER E + 0x66: [705,0,306,26,372], // LATIN SMALL LETTER F + 0x67: [453,206,500,29,485], // LATIN SMALL LETTER G + 0x68: [694,0,556,25,542], // LATIN SMALL LETTER H + 0x69: [669,0,278,26,255], // LATIN SMALL LETTER I + 0x6A: [669,205,306,-55,218], // LATIN SMALL LETTER J + 0x6B: [694,0,528,20,511], // LATIN SMALL LETTER K + 0x6C: [694,0,278,26,263], // LATIN SMALL LETTER L + 0x6D: [442,0,833,25,819], // LATIN SMALL LETTER M + 0x6E: [442,0,556,25,542], // LATIN SMALL LETTER N + 0x6F: [448,10,500,28,471], // LATIN SMALL LETTER O + 0x70: [442,194,556,20,522], // LATIN SMALL LETTER P + 0x71: [442,194,528,33,535], // LATIN SMALL LETTER Q + 0x72: [442,0,392,20,364], // LATIN SMALL LETTER R + 0x73: [448,11,394,33,359], // LATIN SMALL LETTER S + 0x74: [615,10,389,18,333], // LATIN SMALL LETTER T + 0x75: [442,11,556,25,542], // LATIN SMALL LETTER U + 0x76: [431,11,528,19,508], // LATIN SMALL LETTER V + 0x77: [431,11,722,18,703], // LATIN SMALL LETTER W + 0x78: [431,0,528,11,516], // LATIN SMALL LETTER X + 0x79: [431,204,528,19,508], // LATIN SMALL LETTER Y + 0x7A: [431,0,444,28,401], // LATIN SMALL LETTER Z + 0x7B: [750,250,500,65,434], // LEFT CURLY BRACKET + 0x7C: [750,249,278,119,159], // VERTICAL LINE + 0x7D: [750,250,500,65,434], // RIGHT CURLY BRACKET + 0x7E: [318,-215,500,83,416], // TILDE + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0xA8: [669,-554,500,95,404], // DIAERESIS + 0xAC: [356,-89,667,56,611], // NOT SIGN + 0xAF: [590,-544,500,69,430], // MACRON + 0xB0: [715,-542,500,147,352], // DEGREE SIGN + 0xB1: [666,0,778,56,722], // PLUS-MINUS SIGN + 0xB4: [699,-505,500,203,393], // ACUTE ACCENT + 0xD7: [491,-9,778,147,630], // MULTIPLICATION SIGN + 0xF7: [537,36,778,56,721], // DIVISION SIGN + 0x131: [442,0,278,26,255], // LATIN SMALL LETTER DOTLESS I + 0x237: [442,205,306,-55,218], // LATIN SMALL LETTER DOTLESS J + 0x2C6: [694,-531,500,112,387], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2C7: [644,-513,500,114,385], // CARON + 0x2C9: [590,-544,500,69,430], // MODIFIER LETTER MACRON + 0x2CA: [699,-505,500,203,393], // MODIFIER LETTER ACUTE ACCENT + 0x2CB: [699,-505,500,106,295], // MODIFIER LETTER GRAVE ACCENT + 0x2D8: [694,-515,500,92,407], // BREVE + 0x2D9: [669,-549,500,190,309], // DOT ABOVE + 0x2DC: [668,-565,500,83,416], // SMALL TILDE + 0x2DA: [715,-542,500,147,352], // RING ABOVE + 0x300: [699,-505,0,-394,-205], // COMBINING GRAVE ACCENT + 0x301: [699,-505,0,-297,-107], // COMBINING ACUTE ACCENT + 0x302: [694,-531,0,-388,-113], // COMBINING CIRCUMFLEX ACCENT + 0x303: [668,-565,0,-417,-84], // COMBINING TILDE + 0x304: [590,-544,0,-431,-70], // COMBINING MACRON + 0x306: [694,-515,0,-408,-93], // COMBINING BREVE + 0x307: [669,-549,0,-310,-191], // COMBINING DOT ABOVE + 0x308: [669,-554,0,-405,-96], // COMBINING DIAERESIS + 0x30A: [715,-542,0,-353,-148], // COMBINING RING ABOVE + 0x30B: [701,-510,0,-378,-80], // COMBINING DOUBLE ACUTE ACCENT + 0x30C: [644,-513,0,-386,-115], // COMBINING CARON + 0x338: [716,215,0,-639,-140], // COMBINING LONG SOLIDUS OVERLAY + 0x393: [680,0,625,25,582], // GREEK CAPITAL LETTER GAMMA + 0x394: [716,0,833,46,786], // GREEK CAPITAL LETTER DELTA + 0x398: [705,22,778,56,722], // GREEK CAPITAL LETTER THETA + 0x39B: [716,0,694,32,661], // GREEK CAPITAL LETTER LAMDA + 0x39E: [677,0,667,42,624], // GREEK CAPITAL LETTER XI + 0x3A0: [680,0,750,25,724], // GREEK CAPITAL LETTER PI + 0x3A3: [683,0,722,55,666], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [705,0,778,55,722], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [683,0,722,56,665], // GREEK CAPITAL LETTER PHI + 0x3A8: [683,0,778,55,722], // GREEK CAPITAL LETTER PSI + 0x3A9: [704,0,722,44,677], // GREEK CAPITAL LETTER OMEGA + 0x2002: [0,0,500,0,0], // ?? + 0x2003: [0,0,999,0,0], // ?? + 0x2004: [0,0,333,0,0], // ?? + 0x2005: [0,0,250,0,0], // ?? + 0x2006: [0,0,167,0,0], // ?? + 0x2009: [0,0,167,0,0], // ?? + 0x200A: [0,0,83,0,0], // ?? + 0x2013: [285,-248,500,0,499], // EN DASH + 0x2014: [285,-248,1000,0,999], // EM DASH + 0x2018: [694,-379,278,64,198], // LEFT SINGLE QUOTATION MARK + 0x2019: [694,-379,278,78,212], // RIGHT SINGLE QUOTATION MARK + 0x201C: [694,-379,500,128,466], // LEFT DOUBLE QUOTATION MARK + 0x201D: [694,-379,500,34,372], // RIGHT DOUBLE QUOTATION MARK + 0x2020: [705,216,444,55,389], // DAGGER + 0x2021: [705,205,444,55,389], // DOUBLE DAGGER + 0x2026: [120,0,1172,78,1093], // HORIZONTAL ELLIPSIS + 0x2032: [560,-43,275,30,262], // PRIME + 0x20D7: [714,-516,0,-471,-29], // COMBINING RIGHT ARROW ABOVE + 0x210F: [695,13,540,42,562], // stix-/hbar - Planck's over 2pi + 0x2111: [705,10,722,55,693], // BLACK-LETTER CAPITAL I + 0x2113: [705,20,417,6,397], // SCRIPT SMALL L + 0x2118: [453,216,636,67,625], // SCRIPT CAPITAL P + 0x211C: [716,22,722,40,715], // BLACK-LETTER CAPITAL R + 0x2135: [694,0,611,55,555], // ALEF SYMBOL + 0x2190: [511,11,1000,55,944], // LEFTWARDS ARROW + 0x2191: [694,193,500,17,483], // UPWARDS ARROW + 0x2192: [511,11,1000,56,944], // RIGHTWARDS ARROW + 0x2193: [694,194,500,17,483], // DOWNWARDS ARROW + 0x2194: [511,11,1000,55,944], // LEFT RIGHT ARROW + 0x2195: [772,272,500,17,483], // UP DOWN ARROW + 0x2196: [720,195,1000,29,944], // NORTH WEST ARROW + 0x2197: [720,195,1000,55,970], // NORTH EAST ARROW + 0x2198: [695,220,1000,55,970], // SOUTH EAST ARROW + 0x2199: [695,220,1000,29,944], // SOUTH WEST ARROW + 0x21A6: [511,11,1000,55,944], // RIGHTWARDS ARROW FROM BAR + 0x21A9: [511,11,1126,55,1070], // LEFTWARDS ARROW WITH HOOK + 0x21AA: [511,11,1126,55,1070], // RIGHTWARDS ARROW WITH HOOK + 0x21BC: [511,-230,1000,55,944], // LEFTWARDS HARPOON WITH BARB UPWARDS + 0x21BD: [270,11,1000,55,944], // LEFTWARDS HARPOON WITH BARB DOWNWARDS + 0x21C0: [511,-230,1000,56,944], // RIGHTWARDS HARPOON WITH BARB UPWARDS + 0x21C1: [270,11,1000,56,944], // RIGHTWARDS HARPOON WITH BARB DOWNWARDS + 0x21CC: [671,11,1000,55,944], // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON + 0x21D0: [525,24,1000,56,944], // LEFTWARDS DOUBLE ARROW + 0x21D1: [694,194,611,31,579], // UPWARDS DOUBLE ARROW + 0x21D2: [525,24,1000,56,944], // RIGHTWARDS DOUBLE ARROW + 0x21D3: [694,194,611,31,579], // DOWNWARDS DOUBLE ARROW + 0x21D4: [526,25,1000,34,966], // LEFT RIGHT DOUBLE ARROW + 0x21D5: [772,272,611,31,579], // UP DOWN DOUBLE ARROW + 0x2200: [694,22,556,0,556], // FOR ALL + 0x2202: [715,22,531,42,566], // PARTIAL DIFFERENTIAL + 0x2203: [694,0,556,56,500], // THERE EXISTS + 0x2205: [772,78,500,39,460], // EMPTY SET + 0x2207: [683,33,833,46,786], // NABLA + 0x2208: [540,40,667,84,583], // ELEMENT OF + 0x2209: [716,215,667,84,583], // stix-negated (vert) set membership, variant + 0x220B: [540,40,667,83,582], // CONTAINS AS MEMBER + 0x2212: [270,-230,778,84,694], // MINUS SIGN + 0x2213: [500,166,778,56,722], // MINUS-OR-PLUS SIGN + 0x2215: [750,250,500,56,445], // DIVISION SLASH + 0x2216: [750,250,500,56,444], // SET MINUS + 0x2217: [465,-35,500,64,435], // ASTERISK OPERATOR + 0x2218: [444,-55,500,55,444], // RING OPERATOR + 0x2219: [444,-55,500,55,444], // BULLET OPERATOR + 0x221A: [800,200,833,72,853], // SQUARE ROOT + 0x221D: [442,11,778,56,722], // PROPORTIONAL TO + 0x221E: [442,11,1000,55,944], // INFINITY + 0x2220: [694,0,722,55,666], // ANGLE + 0x2223: [750,249,278,119,159], // DIVIDES + 0x2225: [750,250,500,132,367], // PARALLEL TO + 0x2227: [598,22,667,55,611], // LOGICAL AND + 0x2228: [598,22,667,55,611], // LOGICAL OR + 0x2229: [598,22,667,55,611], // stix-intersection, serifs + 0x222A: [598,22,667,55,611], // stix-union, serifs + 0x222B: [716,216,417,55,472], // INTEGRAL + 0x223C: [367,-133,778,55,722], // TILDE OPERATOR + 0x2240: [583,83,278,55,222], // WREATH PRODUCT + 0x2243: [464,-36,778,55,722], // ASYMPTOTICALLY EQUAL TO + 0x2245: [589,-22,1000,55,722], // APPROXIMATELY EQUAL TO + 0x2248: [483,-55,778,55,722], // ALMOST EQUAL TO + 0x224D: [484,-16,778,55,722], // EQUIVALENT TO + 0x2250: [670,-133,778,56,722], // APPROACHES THE LIMIT + 0x2260: [716,215,778,56,722], // stix-not (vert) equals + 0x2261: [464,-36,778,56,722], // IDENTICAL TO + 0x2264: [636,138,778,83,694], // LESS-THAN OR EQUAL TO + 0x2265: [636,138,778,83,694], // GREATER-THAN OR EQUAL TO + 0x226A: [568,67,1000,56,944], // MUCH LESS-THAN + 0x226B: [567,67,1000,55,944], // MUCH GREATER-THAN + 0x227A: [539,41,778,84,694], // PRECEDES + 0x227B: [539,41,778,83,694], // SUCCEEDS + 0x2282: [540,40,778,84,694], // SUBSET OF + 0x2283: [540,40,778,83,693], // SUPERSET OF + 0x2286: [636,138,778,84,694], // SUBSET OF OR EQUAL TO + 0x2287: [636,138,778,83,693], // SUPERSET OF OR EQUAL TO + 0x228E: [598,22,667,55,611], // MULTISET UNION + 0x2291: [636,138,778,84,714], // SQUARE IMAGE OF OR EQUAL TO + 0x2292: [636,138,778,64,694], // SQUARE ORIGINAL OF OR EQUAL TO + 0x2293: [598,0,667,61,605], // stix-square intersection, serifs + 0x2294: [598,0,667,61,605], // stix-square union, serifs + 0x2295: [583,83,778,56,722], // stix-circled plus (with rim) + 0x2296: [583,83,778,56,722], // CIRCLED MINUS + 0x2297: [583,83,778,56,722], // stix-circled times (with rim) + 0x2298: [583,83,778,56,722], // CIRCLED DIVISION SLASH + 0x2299: [583,83,778,56,722], // CIRCLED DOT OPERATOR + 0x22A2: [694,0,611,55,555], // RIGHT TACK + 0x22A3: [694,0,611,55,555], // LEFT TACK + 0x22A4: [668,0,778,55,723], // DOWN TACK + 0x22A5: [668,0,778,55,723], // UP TACK + 0x22A8: [750,249,867,119,811], // TRUE + 0x22C4: [488,-12,500,12,488], // DIAMOND OPERATOR + 0x22C5: [310,-190,278,78,199], // DOT OPERATOR + 0x22C6: [486,-16,500,3,497], // STAR OPERATOR + 0x22C8: [505,5,900,26,873], // BOWTIE + 0x22EE: [900,30,278,78,199], // VERTICAL ELLIPSIS + 0x22EF: [310,-190,1172,78,1093], // MIDLINE HORIZONTAL ELLIPSIS + 0x22F1: [820,-100,1282,133,1148], // DOWN RIGHT DIAGONAL ELLIPSIS + 0x2308: [750,250,444,174,422], // LEFT CEILING + 0x2309: [750,250,444,21,269], // RIGHT CEILING + 0x230A: [750,250,444,174,422], // LEFT FLOOR + 0x230B: [750,250,444,21,269], // RIGHT FLOOR + 0x2322: [388,-122,1000,55,944], // stix-small down curve + 0x2323: [378,-134,1000,55,944], // stix-small up curve + 0x23B0: [744,244,412,55,357], // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION + 0x23B1: [744,244,412,56,357], // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION + 0x25B3: [716,0,889,59,828], // WHITE UP-POINTING TRIANGLE + 0x25B9: [505,5,500,26,474], // WHITE RIGHT-POINTING SMALL TRIANGLE + 0x25BD: [500,215,889,59,828], // WHITE DOWN-POINTING TRIANGLE + 0x25C3: [505,5,500,26,473], // WHITE LEFT-POINTING SMALL TRIANGLE + 0x25EF: [715,215,1000,56,944], // LARGE CIRCLE + 0x2660: [727,130,778,55,723], // BLACK SPADE SUIT + 0x2661: [716,33,778,55,723], // WHITE HEART SUIT + 0x2662: [727,162,778,55,723], // WHITE DIAMOND SUIT + 0x2663: [726,130,778,28,750], // BLACK CLUB SUIT + 0x266D: [750,22,389,55,332], // MUSIC FLAT SIGN + 0x266E: [734,223,389,65,324], // MUSIC NATURAL SIGN + 0x266F: [723,223,389,55,333], // MUSIC SHARP SIGN + 0x27E8: [750,250,389,110,333], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [750,250,389,55,278], // MATHEMATICAL RIGHT ANGLE BRACKET + 0x27EE: [744,244,412,173,357], // MATHEMATICAL LEFT FLATTENED PARENTHESIS + 0x27EF: [744,244,412,56,240], // MATHEMATICAL RIGHT FLATTENED PARENTHESIS + 0x27F5: [511,11,1609,55,1525], // LONG LEFTWARDS ARROW + 0x27F6: [511,11,1638,84,1553], // LONG RIGHTWARDS ARROW + 0x27F7: [511,11,1859,55,1803], // LONG LEFT RIGHT ARROW + 0x27F8: [525,24,1609,56,1553], // LONG LEFTWARDS DOUBLE ARROW + 0x27F9: [525,24,1638,56,1582], // LONG RIGHTWARDS DOUBLE ARROW + 0x27FA: [525,24,1858,56,1802], // LONG LEFT RIGHT DOUBLE ARROW + 0x27FC: [511,11,1638,55,1553], // LONG RIGHTWARDS ARROW FROM BAR + 0x2A3F: [683,0,750,28,721], // AMALGAMATION OR COPRODUCT + 0x2AAF: [636,138,778,84,694], // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN + 0x2AB0: [636,138,778,83,694] // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN + }; + + CHTML.FONTDATA.FONTS['MathJax_Math-Italic'] = { + centerline: 250, ascent: 717, descent: 218, + style: 'italic', + skew: { + 0x41: 0.139, + 0x42: 0.0833, + 0x43: 0.0833, + 0x44: 0.0556, + 0x45: 0.0833, + 0x46: 0.0833, + 0x47: 0.0833, + 0x48: 0.0556, + 0x49: 0.111, + 0x4A: 0.167, + 0x4B: 0.0556, + 0x4C: 0.0278, + 0x4D: 0.0833, + 0x4E: 0.0833, + 0x4F: 0.0833, + 0x50: 0.0833, + 0x51: 0.0833, + 0x52: 0.0833, + 0x53: 0.0833, + 0x54: 0.0833, + 0x55: 0.0278, + 0x58: 0.0833, + 0x5A: 0.0833, + 0x63: 0.0556, + 0x64: 0.167, + 0x65: 0.0556, + 0x66: 0.167, + 0x67: 0.0278, + 0x68: -0.0278, + 0x6C: 0.0833, + 0x6F: 0.0556, + 0x70: 0.0833, + 0x71: 0.0833, + 0x72: 0.0556, + 0x73: 0.0556, + 0x74: 0.0833, + 0x75: 0.0278, + 0x76: 0.0278, + 0x77: 0.0833, + 0x78: 0.0278, + 0x79: 0.0556, + 0x7A: 0.0556, + 0x393: 0.0833, + 0x394: 0.167, + 0x398: 0.0833, + 0x39B: 0.167, + 0x39E: 0.0833, + 0x3A0: 0.0556, + 0x3A3: 0.0833, + 0x3A5: 0.0556, + 0x3A6: 0.0833, + 0x3A8: 0.0556, + 0x3A9: 0.0833, + 0x3B1: 0.0278, + 0x3B2: 0.0833, + 0x3B4: 0.0556, + 0x3B5: 0.0833, + 0x3B6: 0.0833, + 0x3B7: 0.0556, + 0x3B8: 0.0833, + 0x3B9: 0.0556, + 0x3BC: 0.0278, + 0x3BD: 0.0278, + 0x3BE: 0.111, + 0x3BF: 0.0556, + 0x3C1: 0.0833, + 0x3C2: 0.0833, + 0x3C4: 0.0278, + 0x3C5: 0.0278, + 0x3C6: 0.0833, + 0x3C7: 0.0556, + 0x3C8: 0.111, + 0x3D1: 0.0833, + 0x3D5: 0.0833, + 0x3F1: 0.0833, + 0x3F5: 0.0556 + }, + 0x20: [0,0,250,0,0], // SPACE + 0x2F: [716,215,778,139,638], // SOLIDUS + 0x41: [716,0,750,35,726], // LATIN CAPITAL LETTER A + 0x42: [683,0,759,35,756], // LATIN CAPITAL LETTER B + 0x43: [705,22,715,50,760], // LATIN CAPITAL LETTER C + 0x44: [683,0,828,33,803], // LATIN CAPITAL LETTER D + 0x45: [680,0,738,31,764], // LATIN CAPITAL LETTER E + 0x46: [680,0,643,31,749], // LATIN CAPITAL LETTER F + 0x47: [705,22,786,50,760], // LATIN CAPITAL LETTER G + 0x48: [683,0,831,31,888], // LATIN CAPITAL LETTER H + 0x49: [683,0,440,26,504], // LATIN CAPITAL LETTER I + 0x4A: [683,22,555,57,633], // LATIN CAPITAL LETTER J + 0x4B: [683,0,849,31,889], // LATIN CAPITAL LETTER K + 0x4C: [683,0,681,32,647], // LATIN CAPITAL LETTER L + 0x4D: [683,0,970,35,1051], // LATIN CAPITAL LETTER M + 0x4E: [683,0,803,31,888], // LATIN CAPITAL LETTER N + 0x4F: [704,22,763,50,740], // LATIN CAPITAL LETTER O + 0x50: [683,0,642,33,751], // LATIN CAPITAL LETTER P + 0x51: [704,194,791,50,740], // LATIN CAPITAL LETTER Q + 0x52: [683,21,759,33,755], // LATIN CAPITAL LETTER R + 0x53: [705,22,613,52,645], // LATIN CAPITAL LETTER S + 0x54: [677,0,584,21,704], // LATIN CAPITAL LETTER T + 0x55: [683,22,683,60,767], // LATIN CAPITAL LETTER U + 0x56: [683,22,583,52,769], // LATIN CAPITAL LETTER V + 0x57: [683,22,944,51,1048], // LATIN CAPITAL LETTER W + 0x58: [683,0,828,26,852], // LATIN CAPITAL LETTER X + 0x59: [683,-1,581,30,763], // LATIN CAPITAL LETTER Y + 0x5A: [683,0,683,58,723], // LATIN CAPITAL LETTER Z + 0x61: [441,10,529,33,506], // LATIN SMALL LETTER A + 0x62: [694,11,429,40,422], // LATIN SMALL LETTER B + 0x63: [442,11,433,34,429], // LATIN SMALL LETTER C + 0x64: [694,10,520,33,523], // LATIN SMALL LETTER D + 0x65: [442,11,466,39,429], // LATIN SMALL LETTER E + 0x66: [705,205,490,55,550], // LATIN SMALL LETTER F + 0x67: [442,205,477,10,480], // LATIN SMALL LETTER G + 0x68: [694,11,576,48,555], // LATIN SMALL LETTER H + 0x69: [661,11,345,21,302], // LATIN SMALL LETTER I + 0x6A: [661,204,412,-12,403], // LATIN SMALL LETTER J + 0x6B: [694,11,521,48,503], // LATIN SMALL LETTER K + 0x6C: [694,11,298,38,266], // LATIN SMALL LETTER L + 0x6D: [442,11,878,21,857], // LATIN SMALL LETTER M + 0x6E: [442,11,600,21,580], // LATIN SMALL LETTER N + 0x6F: [441,11,485,34,476], // LATIN SMALL LETTER O + 0x70: [442,194,503,-39,497], // LATIN SMALL LETTER P + 0x71: [442,194,446,33,460], // LATIN SMALL LETTER Q + 0x72: [442,11,451,21,430], // LATIN SMALL LETTER R + 0x73: [442,10,469,53,419], // LATIN SMALL LETTER S + 0x74: [626,11,361,19,330], // LATIN SMALL LETTER T + 0x75: [442,11,572,21,551], // LATIN SMALL LETTER U + 0x76: [443,11,485,21,467], // LATIN SMALL LETTER V + 0x77: [443,11,716,21,690], // LATIN SMALL LETTER W + 0x78: [442,11,572,35,522], // LATIN SMALL LETTER X + 0x79: [442,205,490,21,496], // LATIN SMALL LETTER Y + 0x7A: [442,11,465,35,468], // LATIN SMALL LETTER Z + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x393: [680,-1,615,31,721], // GREEK CAPITAL LETTER GAMMA + 0x394: [716,0,833,48,788], // GREEK CAPITAL LETTER DELTA + 0x398: [704,22,763,50,740], // GREEK CAPITAL LETTER THETA + 0x39B: [716,0,694,35,670], // GREEK CAPITAL LETTER LAMDA + 0x39E: [677,0,742,53,777], // GREEK CAPITAL LETTER XI + 0x3A0: [680,0,831,31,887], // GREEK CAPITAL LETTER PI + 0x3A3: [683,0,780,58,806], // GREEK CAPITAL LETTER SIGMA + 0x3A5: [705,0,583,28,700], // GREEK CAPITAL LETTER UPSILON + 0x3A6: [683,0,667,24,642], // GREEK CAPITAL LETTER PHI + 0x3A8: [683,0,612,21,692], // GREEK CAPITAL LETTER PSI + 0x3A9: [704,0,772,80,786], // GREEK CAPITAL LETTER OMEGA + 0x3B1: [442,11,640,34,603], // GREEK SMALL LETTER ALPHA + 0x3B2: [705,194,566,23,573], // GREEK SMALL LETTER BETA + 0x3B3: [441,216,518,11,543], // GREEK SMALL LETTER GAMMA + 0x3B4: [717,10,444,36,451], // GREEK SMALL LETTER DELTA + 0x3B5: [452,22,466,27,428], // GREEK SMALL LETTER EPSILON + 0x3B6: [704,204,438,44,471], // GREEK SMALL LETTER ZETA + 0x3B7: [442,216,497,21,503], // GREEK SMALL LETTER ETA + 0x3B8: [705,10,469,35,462], // GREEK SMALL LETTER THETA + 0x3B9: [442,10,354,48,332], // GREEK SMALL LETTER IOTA + 0x3BA: [442,11,576,49,554], // GREEK SMALL LETTER KAPPA + 0x3BB: [694,12,583,47,556], // GREEK SMALL LETTER LAMDA + 0x3BC: [442,216,603,23,580], // GREEK SMALL LETTER MU + 0x3BD: [442,2,494,45,530], // GREEK SMALL LETTER NU + 0x3BE: [704,205,438,21,443], // GREEK SMALL LETTER XI + 0x3BF: [441,11,485,34,476], // GREEK SMALL LETTER OMICRON + 0x3C0: [431,11,570,19,573], // GREEK SMALL LETTER PI + 0x3C1: [442,216,517,23,510], // GREEK SMALL LETTER RHO + 0x3C2: [442,107,363,31,405], // GREEK SMALL LETTER FINAL SIGMA + 0x3C3: [431,11,571,31,572], // GREEK SMALL LETTER SIGMA + 0x3C4: [431,13,437,18,517], // GREEK SMALL LETTER TAU + 0x3C5: [443,10,540,21,523], // GREEK SMALL LETTER UPSILON + 0x3C6: [442,218,654,50,618], // GREEK SMALL LETTER PHI + 0x3C7: [442,204,626,25,600], // GREEK SMALL LETTER CHI + 0x3C8: [694,205,651,21,634], // GREEK SMALL LETTER PSI + 0x3C9: [443,11,622,15,604], // GREEK SMALL LETTER OMEGA + 0x3D1: [705,11,591,21,563], // GREEK THETA SYMBOL + 0x3D5: [694,205,596,43,579], // GREEK PHI SYMBOL + 0x3D6: [431,10,828,19,823], // GREEK PI SYMBOL + 0x3F1: [442,194,517,67,510], // GREEK RHO SYMBOL + 0x3F5: [431,11,406,40,382] // GREEK LUNATE EPSILON SYMBOL + }; + + CHTML.FONTDATA.FONTS['MathJax_Size1'] = { + centerline: 250, ascent: 850, descent: 350, + 0x20: [0,0,250,0,0], // SPACE + 0x28: [850,349,458,152,422], // LEFT PARENTHESIS + 0x29: [850,349,458,35,305], // RIGHT PARENTHESIS + 0x2F: [850,349,578,55,522], // SOLIDUS + 0x5B: [850,349,417,202,394], // LEFT SQUARE BRACKET + 0x5C: [850,349,578,54,522], // REVERSE SOLIDUS + 0x5D: [850,349,417,22,214], // RIGHT SQUARE BRACKET + 0x7B: [850,349,583,105,477], // LEFT CURLY BRACKET + 0x7D: [850,349,583,105,477], // RIGHT CURLY BRACKET + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2C6: [744,-551,556,-8,564], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2DC: [722,-597,556,1,554], // SMALL TILDE + 0x302: [744,-551,0,-564,8], // COMBINING CIRCUMFLEX ACCENT + 0x303: [722,-597,0,-555,-2], // COMBINING TILDE + 0x2016: [602,0,778,257,521], // DOUBLE VERTICAL LINE + 0x2191: [600,0,667,112,555], // UPWARDS ARROW + 0x2193: [600,0,667,112,555], // DOWNWARDS ARROW + 0x21D1: [599,0,778,57,721], // UPWARDS DOUBLE ARROW + 0x21D3: [600,-1,778,57,721], // DOWNWARDS DOUBLE ARROW + 0x220F: [750,250,944,55,888], // N-ARY PRODUCT + 0x2210: [750,250,944,55,888], // N-ARY COPRODUCT + 0x2211: [750,250,1056,56,999], // N-ARY SUMMATION + 0x221A: [850,350,1000,111,1020], // SQUARE ROOT + 0x2223: [627,15,333,145,188], // DIVIDES + 0x2225: [627,15,556,145,410], // PARALLEL TO + 0x222B: [805,306,472,55,610], // INTEGRAL + 0x222C: [805,306,819,55,957], // DOUBLE INTEGRAL + 0x222D: [805,306,1166,55,1304], // TRIPLE INTEGRAL + 0x222E: [805,306,472,55,610], // CONTOUR INTEGRAL + 0x22C0: [750,249,833,55,777], // N-ARY LOGICAL AND + 0x22C1: [750,249,833,55,777], // N-ARY LOGICAL OR + 0x22C2: [750,249,833,55,777], // N-ARY INTERSECTION + 0x22C3: [750,249,833,55,777], // N-ARY UNION + 0x2308: [850,349,472,202,449], // LEFT CEILING + 0x2309: [850,349,472,22,269], // RIGHT CEILING + 0x230A: [850,349,472,202,449], // LEFT FLOOR + 0x230B: [850,349,472,22,269], // RIGHT FLOOR + 0x23D0: [602,0,667,312,355], // VERTICAL LINE EXTENSION (used to extend arrows) + 0x27E8: [850,350,472,97,394], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [850,350,472,77,374], // MATHEMATICAL RIGHT ANGLE BRACKET + 0x2A00: [750,250,1111,56,1054], // N-ARY CIRCLED DOT OPERATOR + 0x2A01: [750,250,1111,56,1054], // N-ARY CIRCLED PLUS OPERATOR + 0x2A02: [750,250,1111,56,1054], // N-ARY CIRCLED TIMES OPERATOR + 0x2A04: [750,249,833,55,777], // N-ARY UNION OPERATOR WITH PLUS + 0x2A06: [750,249,833,55,777] // N-ARY SQUARE UNION OPERATOR + }; + + CHTML.FONTDATA.FONTS['MathJax_Size2'] = { + centerline: 249, ascent: 1360, descent: 862, + 0x20: [0,0,250,0,0], // SPACE + 0x28: [1150,649,597,180,561], // LEFT PARENTHESIS + 0x29: [1150,649,597,35,416], // RIGHT PARENTHESIS + 0x2F: [1150,649,811,56,754], // SOLIDUS + 0x5B: [1150,649,472,224,455], // LEFT SQUARE BRACKET + 0x5C: [1150,649,811,54,754], // REVERSE SOLIDUS + 0x5D: [1150,649,472,16,247], // RIGHT SQUARE BRACKET + 0x7B: [1150,649,667,119,547], // LEFT CURLY BRACKET + 0x7D: [1150,649,667,119,547], // RIGHT CURLY BRACKET + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2C6: [772,-565,1000,-5,1004], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2DC: [750,-611,1000,0,999], // SMALL TILDE + 0x302: [772,-565,0,-1005,4], // COMBINING CIRCUMFLEX ACCENT + 0x303: [750,-611,0,-1000,-1], // COMBINING TILDE + 0x220F: [950,450,1278,56,1221], // N-ARY PRODUCT + 0x2210: [950,450,1278,56,1221], // N-ARY COPRODUCT + 0x2211: [950,450,1444,55,1388], // N-ARY SUMMATION + 0x221A: [1150,650,1000,111,1020], // SQUARE ROOT + 0x222B: [1360,862,556,55,944], // INTEGRAL + 0x222C: [1360,862,1084,55,1472], // DOUBLE INTEGRAL + 0x222D: [1360,862,1592,55,1980], // TRIPLE INTEGRAL + 0x222E: [1360,862,556,55,944], // CONTOUR INTEGRAL + 0x22C0: [950,450,1111,55,1055], // N-ARY LOGICAL AND + 0x22C1: [950,450,1111,55,1055], // N-ARY LOGICAL OR + 0x22C2: [949,450,1111,55,1055], // N-ARY INTERSECTION + 0x22C3: [950,449,1111,55,1055], // N-ARY UNION + 0x2308: [1150,649,528,224,511], // LEFT CEILING + 0x2309: [1150,649,528,16,303], // RIGHT CEILING + 0x230A: [1150,649,528,224,511], // LEFT FLOOR + 0x230B: [1150,649,528,16,303], // RIGHT FLOOR + 0x27E8: [1150,649,611,112,524], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [1150,649,611,85,498], // MATHEMATICAL RIGHT ANGLE BRACKET + 0x2A00: [949,449,1511,56,1454], // N-ARY CIRCLED DOT OPERATOR + 0x2A01: [949,449,1511,56,1454], // N-ARY CIRCLED PLUS OPERATOR + 0x2A02: [949,449,1511,56,1454], // N-ARY CIRCLED TIMES OPERATOR + 0x2A04: [950,449,1111,55,1055], // N-ARY UNION OPERATOR WITH PLUS + 0x2A06: [950,450,1111,55,1055] // N-ARY SQUARE UNION OPERATOR + }; + + CHTML.FONTDATA.FONTS['MathJax_Size3'] = { + centerline: 250, ascent: 1450, descent: 950, + 0x20: [0,0,250,0,0], // SPACE + 0x28: [1450,949,736,209,701], // LEFT PARENTHESIS + 0x29: [1450,949,736,34,526], // RIGHT PARENTHESIS + 0x2F: [1450,949,1044,55,989], // SOLIDUS + 0x5B: [1450,949,528,247,516], // LEFT SQUARE BRACKET + 0x5C: [1450,949,1044,56,988], // REVERSE SOLIDUS + 0x5D: [1450,949,528,11,280], // RIGHT SQUARE BRACKET + 0x7B: [1450,949,750,130,618], // LEFT CURLY BRACKET + 0x7D: [1450,949,750,131,618], // RIGHT CURLY BRACKET + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2C6: [772,-564,1444,-4,1447], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2DC: [749,-610,1444,1,1442], // SMALL TILDE + 0x302: [772,-564,0,-1448,3], // COMBINING CIRCUMFLEX ACCENT + 0x303: [749,-610,0,-1443,-2], // COMBINING TILDE + 0x221A: [1450,950,1000,111,1020], // SQUARE ROOT + 0x2308: [1450,949,583,246,571], // LEFT CEILING + 0x2309: [1450,949,583,11,336], // RIGHT CEILING + 0x230A: [1450,949,583,246,571], // LEFT FLOOR + 0x230B: [1450,949,583,11,336], // RIGHT FLOOR + 0x27E8: [1450,950,750,126,654], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [1450,949,750,94,623] // MATHEMATICAL RIGHT ANGLE BRACKET + }; + + CHTML.FONTDATA.FONTS['MathJax_Size4'] = { + centerline: 250, ascent: 1750, descent: 1250, + 0x20: [0,0,250,0,0], // SPACE + 0x28: [1750,1249,792,237,758], // LEFT PARENTHESIS + 0x29: [1750,1249,792,33,554], // RIGHT PARENTHESIS + 0x2F: [1750,1249,1278,56,1221], // SOLIDUS + 0x5B: [1750,1249,583,269,577], // LEFT SQUARE BRACKET + 0x5C: [1750,1249,1278,56,1221], // REVERSE SOLIDUS + 0x5D: [1750,1249,583,5,313], // RIGHT SQUARE BRACKET + 0x7B: [1750,1249,806,144,661], // LEFT CURLY BRACKET + 0x7D: [1750,1249,806,144,661], // RIGHT CURLY BRACKET + 0xA0: [0,0,250,0,0], // NO-BREAK SPACE + 0x2C6: [845,-561,1889,-14,1902], // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x2DC: [823,-583,1889,1,1885], // SMALL TILDE + 0x302: [845,-561,0,-1903,13], // COMBINING CIRCUMFLEX ACCENT + 0x303: [823,-583,0,-1888,-4], // COMBINING TILDE + 0x221A: [1750,1250,1000,111,1020], // SQUARE ROOT + 0x2308: [1750,1249,639,269,633], // LEFT CEILING + 0x2309: [1750,1249,639,5,369], // RIGHT CEILING + 0x230A: [1750,1249,639,269,633], // LEFT FLOOR + 0x230B: [1750,1249,639,5,369], // RIGHT FLOOR + 0x239B: [1154,655,875,291,843], // LEFT PARENTHESIS UPPER HOOK + 0x239C: [610,10,875,291,417], // LEFT PARENTHESIS EXTENSION + 0x239D: [1165,644,875,291,843], // LEFT PARENTHESIS LOWER HOOK + 0x239E: [1154,655,875,31,583], // RIGHT PARENTHESIS UPPER HOOK + 0x239F: [610,10,875,457,583], // RIGHT PARENTHESIS EXTENSION + 0x23A0: [1165,644,875,31,583], // RIGHT PARENTHESIS LOWER HOOK + 0x23A1: [1154,645,667,319,666], // LEFT SQUARE BRACKET UPPER CORNER + 0x23A2: [602,0,667,319,403], // LEFT SQUARE BRACKET EXTENSION + 0x23A3: [1155,644,667,319,666], // LEFT SQUARE BRACKET LOWER CORNER + 0x23A4: [1154,645,667,0,347], // RIGHT SQUARE BRACKET UPPER CORNER + 0x23A5: [602,0,667,263,347], // RIGHT SQUARE BRACKET EXTENSION + 0x23A6: [1155,644,667,0,347], // RIGHT SQUARE BRACKET LOWER CORNER + 0x23A7: [899,10,889,384,718], // LEFT CURLY BRACKET UPPER HOOK + 0x23A8: [1160,660,889,170,504], // LEFT CURLY BRACKET MIDDLE PIECE + 0x23A9: [10,899,889,384,718], // LEFT CURLY BRACKET LOWER HOOK + 0x23AA: [310,10,889,384,504], // CURLY BRACKET EXTENSION + 0x23AB: [899,10,889,170,504], // RIGHT CURLY BRACKET UPPER HOOK + 0x23AC: [1160,660,889,384,718], // RIGHT CURLY BRACKET MIDDLE PIECE + 0x23AD: [10,899,889,170,504], // RIGHT CURLY BRACKET LOWER HOOK + 0x23B7: [935,885,1056,111,742], // RADICAL SYMBOL BOTTOM + 0x27E8: [1750,1248,806,140,703], // MATHEMATICAL LEFT ANGLE BRACKET + 0x27E9: [1750,1248,806,103,665], // MATHEMATICAL RIGHT ANGLE BRACKET + 0xE000: [625,14,1056,702,742], // stix-radical symbol vertical extender + 0xE001: [605,14,1056,702,1076], // stix-radical symbol top corner piece + 0xE150: [120,213,450,-24,460], // stix-horizontal brace, down left piece + 0xE151: [120,213,450,-10,474], // stix-horizontal brace, down right piece + 0xE152: [333,0,450,-24,460], // stix-horizontal brace, upper left piece + 0xE153: [333,0,450,-10,474], // stix-horizontal brace, upper right piece + 0xE154: [120,0,400,-10,410] // stix-oblique open face capital letter A + }; + + CHTML.FONTDATA.FONTS['MathJax_Vector'] = { + centerline: 257, ascent: 714, descent: 200, + 0x2192: [714,-516,500,29,471] // vector arrow + }; + + CHTML.FONTDATA.FONTS['MathJax_Vector-Bold'] = { + centerline: 256, ascent: 723, descent: 210, + 0x2192: [723,-513,575,33,542] // vector arrow + }; + + CHTML.FONTDATA.FONTS[MAIN][0x2212][0] = CHTML.FONTDATA.FONTS[MAIN][0x002B][0]; // minus is sized as plus + CHTML.FONTDATA.FONTS[MAIN][0x2212][1] = CHTML.FONTDATA.FONTS[MAIN][0x002B][1]; // minus is sized as plus + CHTML.FONTDATA.FONTS[MAIN][0x22EE][0] += 400; // adjust height for \vdots + CHTML.FONTDATA.FONTS[MAIN][0x22F1][0] += 700; // adjust height for \ddots + CHTML.FONTDATA.FONTS[SIZE4][0x23AA][0] -= 20; + CHTML.FONTDATA.FONTS[SIZE4][0x23AA][1] += 5; + CHTML.FONTDATA.FONTS[SIZE4][0xE154][0] += 200; // adjust height for brace extender + CHTML.FONTDATA.FONTS[SIZE4][0xE154][1] += 200; // adjust depth for brace extender + CHTML.FONTDATA.FONTS[MAIN][0x2245][2] -= 222; // fix error in character's right bearing + CHTML.FONTDATA.FONTS[MAIN][0x2245][5] = {rfix:-222}; // fix error in character's right bearing + MathJax.Hub.Register.LoadHook(CHTML.fontDir+"/TeX/Main-Bold.js",function () { + CHTML.FONTDATA.FONTS[BOLD][0x2245][2] -= 106; // fix error in character's right bearing + CHTML.FONTDATA.FONTS[BOLD][0x2245][5] = {rfix:-106}; // fix error in character's right bearing + }); + MathJax.Hub.Register.LoadHook(CHTML.fontDir+"/TeX/Typewriter-Regular.js",function () { + CHTML.FONTDATA.FONTS['MathJax_Typewriter'][0x20][2] += 275; // fix error in character width + CHTML.FONTDATA.FONTS['MathJax_Typewriter'][0x20][5] = {rfix:275}; // fix error in character width + CHTML.FONTDATA.FONTS['MathJax_Typewriter'][0xA0][2] += 275; // fix error in character width + CHTML.FONTDATA.FONTS['MathJax_Typewriter'][0xA0][5] = {rfix:275}; // fix error in character width + }); + + // + // Add some spacing characters + // + MathJax.Hub.Insert(CHTML.FONTDATA.FONTS[MAIN],{ + remapCombining: { + 0x300: 0x2CB, // grave accent + 0x301: 0x2CA, // acute accent + 0x302: 0x2C6, // curcumflex + 0x303: 0x2DC, // tilde accent + 0x304: 0x2C9, // macron + 0x306: 0x2D8, // breve + 0x307: 0x2D9, // dot + 0x308: 0xA8, // diaresis + 0x30A: 0x2DA, // ring above +// 0x30B: ?? // double acute accent + 0x30C: 0x2C7, // caron + 0x338: [0x2F, ITALIC], // \not + 0x20D7: [0x2192, 'MathJax_Vector'] // \vec + }, + 0x2000: [0,0,500,0,0,{space:1}], // en space + 0x2001: [0,0,1000,0,0,{space:1}], // em quad + 0x2002: [0,0,500,0,0,{space:1}], // en quad + 0x2003: [0,0,1000,0,0,{space:1}], // em space + 0x2004: [0,0,333,0,0,{space:1}], // 3-per-em space + 0x2005: [0,0,250,0,0,{space:1}], // 4-per-em space + 0x2006: [0,0,167,0,0,{space:1}], // 6-per-em space + 0x2009: [0,0,167,0,0,{space:1}], // thin space + 0x200A: [0,0,100,0,0,{space:1}], // hair space + 0x200B: [0,0,0,0,0,{space:1}], // zero-width space + 0x200C: [0,0,0,0,0,{space:1}], // zero-width non-joiner space + 0x2061: [0,0,0,0,0,{space:1}], // function application + 0x2062: [0,0,0,0,0,{space:1}], // invisible times + 0x2063: [0,0,0,0,0,{space:1}], // invisible separator + 0x2064: [0,0,0,0,0,{space:1}], // invisible plus + 0xEEE0: [0,0,-575,0,0,{space:1}], + 0xEEE1: [0,0,-300,0,0,{space:1}], + 0xEEE8: [0,0,25,0,0,{space:1}] + }); + MathJax.Hub.Insert(CHTML.FONTDATA.FONTS['MathJax_Main-Italic'],{ + remapCombining: { + 0x300: [0x2CB, MAIN], // grave accent + 0x301: [0x2CA, MAIN], // acute accent + 0x302: [0x2C6, MAIN], // curcumflex + 0x303: [0x2DC, MAIN], // tilde accent + 0x304: [0x2C9, MAIN], // macron + 0x306: [0x2D8, MAIN], // breve + 0x307: [0x2D9, MAIN], // dot + 0x308: [0xA8, MAIN], // diaresis + 0x30A: [0x2DA, MAIN], // ring above +// 0x30B: ?? // double acute accent + 0x30C: [0x2C7, MAIN], // caron + 0x338: [0x2F, 'MathJax_Vector'] // \not + } + }); + MathJax.Hub.Insert(CHTML.FONTDATA.FONTS['MathJax_Main-Bold'],{ + remapCombining: { + 0x300: 0x2CB, // grave accent + 0x301: 0x2CA, // acute accent + 0x302: 0x2C6, // curcumflex + 0x303: 0x2DC, // tilde accent + 0x304: 0x2C9, // macron + 0x306: 0x2D8, // breve + 0x307: 0x2D9, // dot + 0x308: 0xA8, // diaresis + 0x30A: 0x2DA, // ring above +// 0x30B: ?? // double acute accent + 0x30C: 0x2C7, // caron + 0x338: [0x2F, 'MathJax_Math-BoldItalic'], // \not + 0x20D7: [0x2192, 'MathJax_Vector-Bold'] // \vec + } + }); + + // + // Create @font-face stylesheet for the declared fonts + // + CHTML.FONTDATA.familyName = function (font) { + font = font.replace(/^MathJax_/,""); + var names = (font+"-Regular").split(/-/); + var suffix = names[0].toLowerCase().replace(/(?:igraphic|serif|writer|tur|tor)$/,"") + + "-" + names[1].replace(/[^A-Z]/g,""); + return "MJXc-TeX-"+suffix; + }; + (function () { + var STYLES = CHTML.config.styles, FONTS = CHTML.FONTDATA.FONTS; + var OTFDIR = AJAX.fileURL(CHTML.webfontDir+"/TeX/otf"), + EOTDIR = AJAX.fileURL(CHTML.webfontDir+"/TeX/eot"), + WOFFDIR = AJAX.fileURL(CHTML.webfontDir+"/TeX/woff"); + var faces = []; + for (var name in FONTS) {if (FONTS.hasOwnProperty(name)) { + var family = CHTML.FONTDATA.familyName(name), FAMILY = family; + var variant = ((name+"-Regular").split(/-/))[1]; + FONTS[name].className = family; + // + // The local font, if found + // + var font = {"font-family":family}; + name = name.replace(/-.*/,""); + if (variant === "Regular") { + font.src = "local('"+name+"'), local('"+name+"-Regular')"; + } else { + font.src = "local('"+name+" "+variant+"'), local('"+name+"-"+variant+"')"; + } + faces.push(font); + // + // For Chrome, need to have separate font-weight and font-style versions + // + if (variant !== "Regular") { + font = {"font-family":family+"x", src:"local('"+name+"')"}; + if (variant.match(/Bold/)) font["font-weight"] = "bold"; + if (variant.match(/Italic/)) font["font-style"] = "italic"; + FAMILY += ","+family+"x"; + faces.push(font); + } + // + // The web font, if no local font found + // + font = { + "font-family": family+"w", + "src /*1*/": "url('"+EOTDIR+"/"+name+"-"+variant+".eot')", // for IE8 + "src /*2*/": [ + "url('"+WOFFDIR+"/"+name+"-"+variant+".woff') format('woff')", + "url('"+OTFDIR+"/"+name+"-"+variant+".otf') format('opentype')" + ].join(", ") + }; + faces.push(font); + // + // A class that looks for the local and web fonts + // + FAMILY += ","+family+"w"; + STYLES["."+family] = {"font-family":FAMILY}; + }} + if (faces.length) STYLES["@font-face"] = faces; + })(); + + CHTML.fontLoaded("TeX/fontdata"); + +})(MathJax.OutputJax.CommonHTML,MathJax.ElementJax.mml,MathJax.Ajax); + +// @license-end diff --git a/js/mathjax/jax/output/CommonHTML/jax.js b/js/mathjax/jax/output/CommonHTML/jax.js new file mode 100644 index 0000000..6c57957 --- /dev/null +++ b/js/mathjax/jax/output/CommonHTML/jax.js @@ -0,0 +1,2845 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/CommonHTML/jax.js + * + * Implements the CommonHTML OutputJax that displays mathematics + * using HTML and CSS to position the characters from math fonts + * in their proper locations. Unlike the HTML-CSS output jax, + * this HTML is browser and OS independent. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +(function (AJAX,HUB,HTML,CHTML) { + var MML; + var isArray = MathJax.Object.isArray; + + var EVENT, TOUCH, HOVER; // filled in later + + var STRUTHEIGHT = 1, + EFUZZ = .1, // overlap needed for stretchy delimiters + HFUZZ = .025, DFUZZ = .025; // adjustments to bounding box of character boxes + + var STYLES = { + ".mjx-chtml": { + display: "inline-block", + "line-height": 0, + "text-indent": 0, + "text-align": "left", + "text-transform": "none", + "font-style": "normal", + "font-weight": "normal", + "font-size": "100%", + "font-size-adjust":"none", + "letter-spacing": "normal", + "word-wrap": "normal", + "word-spacing": "normal", + "white-space": "nowrap", + "float": "none", + "direction": "ltr", + "max-width": "none", + "max-height": "none", + "min-width": 0, + "min-height": 0, + border: 0, + margin: 0, + padding: "1px 0" + }, + ".MJXc-display": { + display: "block", + "text-align": "center", + "margin": "1em 0", + padding: 0 + }, + ".mjx-chtml[tabindex]:focus, body :focus .mjx-chtml[tabindex]": { + display: "inline-table" // see issues #1282 and #1338 + }, + ".mjx-full-width": { + "text-align": "center", + display: "table-cell!important", + width: "10000em" + }, + + ".mjx-math": { + "display": "inline-block", + "border-collapse": "separate", + "border-spacing": 0 + }, + ".mjx-math *": { + display:"inline-block", + "-webkit-box-sizing": "content-box!important", + "-moz-box-sizing": "content-box!important", + "box-sizing": "content-box!important", // override bootstrap settings + "text-align":"left" + }, + + ".mjx-numerator": {display:"block", "text-align":"center"}, + ".mjx-denominator": {display:"block", "text-align":"center"}, + ".MJXc-stacked": {height:0, position:"relative"}, + ".MJXc-stacked > *": {position: "absolute"}, + ".MJXc-bevelled > *": {display:"inline-block"}, + + ".mjx-stack": {display:"inline-block"}, + ".mjx-op": {display:"block"}, + ".mjx-under": {display:"table-cell"}, + ".mjx-over": {display:"block"}, + ".mjx-over > *": {"padding-left":"0px!important", "padding-right":"0px!important"}, + ".mjx-under > *": {"padding-left":"0px!important", "padding-right":"0px!important"}, + + ".mjx-stack > .mjx-sup": {display:"block"}, + ".mjx-stack > .mjx-sub": {display:"block"}, + ".mjx-prestack > .mjx-presup": {display:"block"}, + ".mjx-prestack > .mjx-presub": {display:"block"}, + + ".mjx-delim-h > .mjx-char": {display:"inline-block"}, + + ".mjx-surd": {"vertical-align":"top"}, + ".mjx-surd + .mjx-box": {display:"inline-flex"}, + + ".mjx-mphantom *": {visibility:"hidden"}, + + ".mjx-merror": { + "background-color":"#FFFF88", + color: "#CC0000", + border: "1px solid #CC0000", + padding: "2px 3px", + "font-style": "normal", + "font-size": "90%" + }, + + ".mjx-annotation-xml": {"line-height":"normal"}, + + ".mjx-menclose > svg": {fill:"none", stroke:"currentColor", overflow:"visible"}, + + ".mjx-mtr": {display:"table-row"}, + ".mjx-mlabeledtr": {display:"table-row"}, + ".mjx-mtd": {display:"table-cell", "text-align":"center"}, + ".mjx-label": {display:"table-row"}, + + ".mjx-box": {display:"inline-block"}, + ".mjx-block": {display:"block"}, + ".mjx-span": {display:"inline"}, + ".mjx-char": {display:"block", "white-space":"pre"}, + ".mjx-itable": {display:"inline-table", width:"auto"}, + ".mjx-row": {display:"table-row"}, + ".mjx-cell": {display:"table-cell"}, + ".mjx-table": {display:"table", width:"100%"}, + ".mjx-line": {display:"block", height:0}, + ".mjx-strut": {width:0, "padding-top":STRUTHEIGHT+"em"}, + ".mjx-vsize": {width:0}, + + ".MJXc-space1": {"margin-left":".167em"}, + ".MJXc-space2": {"margin-left":".222em"}, + ".MJXc-space3": {"margin-left":".278em"}, + + ".mjx-chartest": { + display:"block", + visibility: "hidden", + position:"absolute", top:0, + "line-height":"normal", + "font-size":"500%" + }, + ".mjx-chartest .mjx-char": {display:"inline"}, + ".mjx-chartest .mjx-box": {"padding-top": "1000px"}, + + ".MJXc-processing": { + visibility: "hidden", position:"fixed", + width: 0, height: 0, overflow:"hidden" + }, + ".MJXc-processed": {display:"none"}, + + ".mjx-test": { + "font-style": "normal", + "font-weight": "normal", + "font-size": "100%", + "font-size-adjust":"none", + "text-indent": 0, + "text-transform": "none", + "letter-spacing": "normal", + "word-spacing": "normal", + overflow: "hidden", + height: "1px" + }, + ".mjx-test.mjx-test-display": { + display: "table!important" + }, + ".mjx-test.mjx-test-inline": { + display: "inline!important", + "margin-right": "-1px" + }, + ".mjx-test.mjx-test-default": { + display: "block!important", + clear: "both" + }, + ".mjx-ex-box": { + display: "inline-block!important", + position: "absolute", + overflow: "hidden", + "min-height": 0, "max-height":"none", + padding:0, border: 0, margin: 0, + width:"1px", height:"60ex" + }, + ".mjx-test-inline .mjx-left-box": { + display: "inline-block", + width: 0, + "float":"left" + }, + ".mjx-test-inline .mjx-right-box": { + display: "inline-block", + width: 0, + "float":"right" + }, + ".mjx-test-display .mjx-right-box": { + display: "table-cell!important", + width: "10000em!important", + "min-width":0, "max-width":"none", + padding:0, border:0, margin:0 + }, + + "#MathJax_CHTML_Tooltip": { + "background-color": "InfoBackground", color: "InfoText", + border: "1px solid black", + "box-shadow": "2px 2px 5px #AAAAAA", // Opera 10.5 + "-webkit-box-shadow": "2px 2px 5px #AAAAAA", // Safari 3 and Chrome + "-moz-box-shadow": "2px 2px 5px #AAAAAA", // Firefox 3.5 + "-khtml-box-shadow": "2px 2px 5px #AAAAAA", // Konqueror + padding: "3px 4px", + "z-index": 401, + position: "absolute", left: 0, top: 0, + width: "auto", height: "auto", + display: "none" + } + + }; + + + /************************************************************/ + + var BIGDIMEN = 1000000; + var MAXREMAP = 5; + var LINEBREAKS = {}, CONFIG = MathJax.Hub.config; + + CHTML.Augment({ + settings: HUB.config.menuSettings, + config: {styles: STYLES}, + + /********************************************/ + + Config: function () { + if (!this.require) {this.require = []} + this.SUPER(arguments).Config.call(this); var settings = this.settings; + if (settings.scale) {this.config.scale = settings.scale} + this.require.push(this.fontDir+"/TeX/fontdata.js"); + this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js"); + LINEBREAKS = this.config.linebreaks; + }, + + Startup: function () { + // + // Set up event handling + // + EVENT = MathJax.Extension.MathEvents.Event; + TOUCH = MathJax.Extension.MathEvents.Touch; + HOVER = MathJax.Extension.MathEvents.Hover; + this.ContextMenu = EVENT.ContextMenu; + this.Mousedown = EVENT.AltContextMenu; + this.Mouseover = HOVER.Mouseover; + this.Mouseout = HOVER.Mouseout; + this.Mousemove = HOVER.Mousemove; + + // + // Determine pixels per inch + // + var div = CHTML.addElement(document.body,"mjx-block",{style:{display:"block",width:"5in"}}); + this.pxPerInch = div.offsetWidth/5; div.parentNode.removeChild(div); + + // + // Used in preTranslate to get scaling factors and line width + // + this.TestSpan = CHTML.Element("mjx-test",{style:{left:"1em"}}, + [["mjx-left-box"],["mjx-ex-box"],["mjx-right-box"]]); + + // + // Set up styles and preload web fonts + // + return AJAX.Styles(this.config.styles,["InitializeCHTML",this]); + }, + + InitializeCHTML: function () { + this.getDefaultExEm(); + // + // If the defaultEm size is zero, it might be that a web font hasn't + // arrived yet, so try to wait for it, but don't wait too long. + // + if (this.defaultEm) return; + var ready = MathJax.Callback(); + AJAX.timer.start(AJAX,function (check) { + if (check.time(ready)) {HUB.signal.Post(["CommonHTML Jax - no default em size"]); return} + CHTML.getDefaultExEm(); + if (CHTML.defaultEm) {ready()} else {setTimeout(check,check.delay)} + },this.defaultEmDelay,this.defaultEmTimeout); + return ready; + }, + defaultEmDelay: 100, // initial delay when checking for defaultEm + defaultEmTimeout: 1000, // when to stop looking for defaultEm + getDefaultExEm: function () { + // + // Get the default sizes (need styles in place to do this) + // + var test = document.body.appendChild(this.TestSpan.cloneNode(true)); + test.className += " mjx-test-inline mjx-test-default"; + this.defaultEm = this.getFontSize(test); + this.defaultEx = test.childNodes[1].offsetHeight/60; + this.defaultWidth = Math.max(0,test.lastChild.offsetLeft-test.firstChild.offsetLeft-2); + document.body.removeChild(test); + }, + getFontSize: (window.getComputedStyle ? + function (node) { + var style = window.getComputedStyle(node); + return parseFloat(style.fontSize); + } : + // + // IE 8 doesn't do getComputedStyle, so use + // an alternative approach + // + function (node) { + return node.style.pixelLeft; + } + ), + getMaxWidth: (window.getComputedStyle ? + function (node) { + var style = window.getComputedStyle(node); + if (style.maxWidth !== "none") return parseFloat(style.maxWidth); + return 0; + } : + // + // IE 8 doesn't do getComputedStyle, so use + // currentStyle, and a hack to get the pixels for + // a non-px max-width + // + function (node) { + var max = node.currentStyle.maxWidth; + if (max !== "none") { + if (max.match(/\d*px/)) return parseFloat(max); + var left = node.style.left; + node.style.left = max; max = node.style.pixelLeft; + node.style.left = left; + return max; + } + return 0; + } + ), + + // + // Load data for a font + // + loadFont: function (font) { + HUB.RestartAfter(AJAX.Require(this.fontDir+"/"+font)); + }, + // + // Signal that the font data are loaded + // + fontLoaded: function (font) { + if (!font.match(/-|fontdata/)) font += "-Regular"; + if (!font.match(/\.js$/)) font += ".js" + MathJax.Callback.Queue( + ["Post",HUB.Startup.signal,"CommonHTML - font data loaded for " + font], + ["loadComplete",AJAX,this.fontDir+"/"+font] + ); + }, + + Element: function (type,def,content) { + if (type.substr(0,4) === "mjx-") { + if (!def) def = {}; + if (def.isMathJax == null) def.isMathJax = true; + if (def.className) def.className = type+" "+def.className; else def.className = type; + type = "span"; + } + return this.HTMLElement(type,def,content); + }, + addElement: function (node,type,def,content) { + return node.appendChild(this.Element(type,def,content)); + }, + HTMLElement: HTML.Element, + ucMatch: HTML.ucMatch, + setScript: HTML.setScript, + + // + // Look through the direct children of a node for one with the given + // type (but if the node has intervening containers for its children, + // step into them; note that elements corresponding to MathML nodes + // will have id's so we don't step into them). + // + // This is used by munderover and msubsup to locate their child elements + // when they are part of an embellished operator that is being stretched. + // We don't use querySelector because we want to find only the direct child + // nodes, not nodes that might be nested deeper in the tree (see issue #1447). + // + getNode: function (node,type) { + var name = RegExp("\\b"+type+"\\b"); + var nodes = []; + while (node) { + for (var i = 0, m = node.childNodes.length; i < m; i++) { + var child = node.childNodes[i]; + if (child) { + if (name.test(child.className)) return child; + if (child.id === "") nodes.push(child); + } + } + node = nodes.shift(); + } + return null; + }, + + /********************************************/ + + preTranslate: function (state) { + var scripts = state.jax[this.id], i, m = scripts.length, + script, prev, node, test, jax, ex, em, scale; + // + // Get linebreaking information + // + var maxwidth = 100000, relwidth = false, cwidth = 0, + linebreak = LINEBREAKS.automatic, width = LINEBREAKS.width; + if (linebreak) { + relwidth = !!width.match(/^\s*(\d+(\.\d*)?%\s*)?container\s*$/); + if (relwidth) {width = width.replace(/\s*container\s*/,"")} + else {maxwidth = this.defaultWidth} + if (width === "") {width = "100%"} + } + // + // Loop through the scripts + // + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + // + // Remove any existing output + // + prev = script.previousSibling; + if (prev && prev.className && String(prev.className).substr(0,9) === "mjx-chtml") + prev.parentNode.removeChild(prev); + if (script.MathJax.preview) script.MathJax.preview.style.display = "none"; + // + // Add the node for the math and mark it as being processed + // + jax = script.MathJax.elementJax; if (!jax) continue; + jax.CHTML = { + display: (jax.root.Get("display") === "block"), + preview: (jax.CHTML||{}).preview // in case typeset calls are interleaved + }; + node = CHTML.Element("mjx-chtml",{ + id:jax.inputID+"-Frame", className:"MathJax_CHTML", isMathJax:true, jaxID:this.id, + oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown, + onmouseover:EVENT.Mouseover, onmouseout:EVENT.Mouseout, onmousemove:EVENT.Mousemove, + onclick:EVENT.Click, ondblclick:EVENT.DblClick, + // Added for keyboard accessible menu. + onkeydown: EVENT.Keydown, tabIndex: HUB.getTabOrder(jax) + }); + if (jax.CHTML.display) { + // + // Zoom box requires an outer container to get the positioning right. + // + var NODE = CHTML.Element("mjx-chtml",{className:"MJXc-display",isMathJax:false}); + NODE.appendChild(node); node = NODE; + } + if (HUB.Browser.noContextMenu) { + node.ontouchstart = TOUCH.start; + node.ontouchend = TOUCH.end; + } + // + node.className += " MJXc-processing"; + script.parentNode.insertBefore(node,script); + // + // Add test nodes for determining scales and linebreak widths + // + test = this.TestSpan.cloneNode(true); + test.className += " mjx-test-" + (jax.CHTML.display ? "display" : "inline"); + script.parentNode.insertBefore(test,script); + } + // + // Determine the scaling factors for each script + // (this only requires one reflow rather than a reflow for each equation) + // + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + test = script.previousSibling; + jax = script.MathJax.elementJax; if (!jax) continue; + em = CHTML.getFontSize(test); + ex = test.childNodes[1].offsetHeight/60; + cwidth = Math.max(0, jax.CHTML.display ? test.lastChild.offsetWidth - 1: + test.lastChild.offsetLeft - test.firstChild.offsetLeft - 2); + if (ex === 0 || ex === "NaN") { + ex = this.defaultEx; + cwidth = this.defaultWidth; + } + if (cwidth === 0 && !jax.CHTML.display) cwidth = this.defaultWidth; + if (relwidth) maxwidth = cwidth; + scale = (this.config.matchFontHeight ? ex/this.TEX.x_height/em : 1); + scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale)*this.config.scale); + jax.CHTML.scale = scale/100; jax.CHTML.fontSize = scale+"%"; + jax.CHTML.outerEm = em; jax.CHTML.em = this.em = em * scale/100; + jax.CHTML.ex = ex; jax.CHTML.cwidth = cwidth/this.em; + jax.CHTML.lineWidth = (linebreak ? this.length2em(width,maxwidth/this.em,1) : maxwidth); + } + // + // Remove the test spans used for determining scales and linebreak widths + // + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + jax = script.MathJax.elementJax; if (!jax) continue; + script.parentNode.removeChild(script.previousSibling); + if (script.MathJax.preview) script.MathJax.preview.style.display = ""; + } + state.CHTMLeqn = state.CHTMLlast = 0; state.CHTMLi = -1; + state.CHTMLchunk = this.config.EqnChunk; + state.CHTMLdelay = false; + }, + + /********************************************/ + + Translate: function (script,state) { + if (!script.parentNode) return; + + // + // If we are supposed to do a chunk delay, do it + // + if (state.CHTMLdelay) { + state.CHTMLdelay = false; + HUB.RestartAfter(MathJax.Callback.Delay(this.config.EqnChunkDelay)); + } + + // + // Get the data about the math + // + var jax = script.MathJax.elementJax, math = jax.root, + node = document.getElementById(jax.inputID+"-Frame"); + if (!node) return; + this.getMetrics(jax); + if (this.scale !== 1) node.style.fontSize = jax.CHTML.fontSize; + // + // Typeset the math + // + this.initCHTML(math,node); + this.savePreview(script); + this.CHTMLnode = node; + try { + math.setTeXclass(); + math.toCommonHTML(node); + } catch (err) { + while (node.firstChild) node.removeChild(node.firstChild); + delete this.CHTMLnode; + this.restorePreview(script); + throw err; + } + delete this.CHTMLnode; + this.restorePreview(script); + // + // Put it in place, and remove the processing marker + // + if (jax.CHTML.display) node = node.parentNode; + node.className = node.className.replace(/ [^ ]+$/,""); + // + // Hide the math and don't let its preview be removed + // + node.className += " MJXc-processed"; + if (script.MathJax.preview) { + jax.CHTML.preview = script.MathJax.preview; + delete script.MathJax.preview; + } + // + // Check if we should show this chunk of equations + // + state.CHTMLeqn += (state.i - state.CHTMLi); state.CHTMLi = state.i; + if (state.CHTMLeqn >= state.CHTMLlast + state.CHTMLchunk) { + this.postTranslate(state); + state.CHTMLchunk = Math.floor(state.CHTMLchunk*this.config.EqnChunkFactor); + state.CHTMLdelay = true; // delay if there are more scripts + } + }, + + initCHTML: function (math,node) {}, + + // + // MathML previews can contain the same ID's as the HTML output, + // which confuses CHTMLnodeElement(), so remove the preview temporarily + // and restore it after typesetting the math. + // + savePreview: function (script) { + var preview = script.MathJax.preview; + if (preview && preview.parentNode) { + script.MathJax.tmpPreview = document.createElement("span"); + preview.parentNode.replaceChild(script.MathJax.tmpPreview,preview); + } + }, + restorePreview: function (script) { + var tmpPreview = script.MathJax.tmpPreview; + if (tmpPreview) { + tmpPreview.parentNode.replaceChild(script.MathJax.preview,tmpPreview); + delete script.MathJax.tmpPreview; + } + }, + // + // Get the jax metric information + // + getMetrics: function(jax) { + var data = jax.CHTML; + this.jax = jax; + this.em = data.em; + this.outerEm = data.outerEm; + this.scale = data.scale; + this.cwidth = data.cwidth; + this.linebreakWidth = data.lineWidth; + }, + + /********************************************/ + + postTranslate: function (state) { + var scripts = state.jax[this.id]; + // + // Reveal this chunk of math + // + for (var i = state.CHTMLlast, m = state.CHTMLeqn; i < m; i++) { + var script = scripts[i]; + if (script && script.MathJax.elementJax) { + // + // Remove the processed marker + // + script.previousSibling.className = script.previousSibling.className.replace(/ [^ ]+$/,""); + var data = script.MathJax.elementJax.CHTML; + // + // Remove the preview, if any + // + if (data.preview) { + data.preview.innerHTML = ""; + script.MathJax.preview = data.preview; + delete data.preview; + } + } + } + // + // Save our place so we know what is revealed + // + state.CHTMLlast = state.CHTMLeqn; + }, + + /********************************************/ + + getJaxFromMath: function (math) { + if (math.parentNode.className.match(/MJXc-display/)) math = math.parentNode; + do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); + return HUB.getJaxFor(math); + }, + getHoverSpan: function (jax,math) {return jax.root.CHTMLnodeElement()}, + getHoverBBox: function (jax,span,math) { + var bbox = jax.root.CHTML, em = jax.CHTML.outerEm; + var BBOX = {w:bbox.w*em, h:bbox.h*em, d:bbox.d*em}; + if (bbox.width) {BBOX.width = bbox.width} + return BBOX; + }, + + Zoom: function (jax,span,math,Mw,Mh) { + // + // Re-render at larger size + // + this.getMetrics(jax); + var node = CHTML.addElement(span,"mjx-chtml",{style:{"font-size":Math.floor(CHTML.scale*100)+"%"},isMathJax:false}); + CHTML.CHTMLnode = node; + this.idPostfix = "-zoom"; jax.root.toCommonHTML(node); this.idPostfix = ""; + // + // Adjust margins to prevent overlaps at the edges + // + var style = node.style, bbox = jax.root.CHTML; + if (bbox.t > bbox.h) style.marginTop = CHTML.Em(bbox.t-bbox.h); + if (bbox.b > bbox.d) style.marginBottom = CHTML.Em(bbox.b-bbox.d); + if (bbox.l < 0) style.paddingLeft = CHTML.Em(-bbox.l); + if (bbox.r > bbox.w) style.marginRight = CHTML.Em(bbox.r-bbox.w); + // + // Get height and width of zoomed math and original math + // + style.position = "absolute"; + var zW = node.offsetWidth, zH = node.offsetHeight, + mH = math.firstChild.offsetHeight, mW = math.firstChild.offsetWidth; + node.style.position = ""; + // + return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH}; + }, + + Remove: function (jax) { + var node = document.getElementById(jax.inputID+"-Frame"); + if (node && jax.CHTML.display) node = node.parentNode; + if (node) node.parentNode.removeChild(node); + delete jax.CHTML; + }, + + /********************************************/ + + ID: 0, idPostfix: "", + GetID: function () {this.ID++; return this.ID}, + + /********************************************/ + + MATHSPACE: { + veryverythinmathspace: 1/18, + verythinmathspace: 2/18, + thinmathspace: 3/18, + mediummathspace: 4/18, + thickmathspace: 5/18, + verythickmathspace: 6/18, + veryverythickmathspace: 7/18, + negativeveryverythinmathspace: -1/18, + negativeverythinmathspace: -2/18, + negativethinmathspace: -3/18, + negativemediummathspace: -4/18, + negativethickmathspace: -5/18, + negativeverythickmathspace: -6/18, + negativeveryverythickmathspace: -7/18, + + thin: .04, + medium: .06, + thick: .1, + + infinity: BIGDIMEN + }, + SPACECLASS: { + thinmathspace: "MJXc-space1", + mediummathspace: "MJXc-space2", + thickmathspace: "MJXc-space3" + }, + pxPerInch: 96, + em: 16, + + maxStretchyParts: 1000, // limit the number of parts allowed for + // stretchy operators. See issue 366. + + FONTDEF: {}, + TEXDEF: { + x_height: .442, + quad: 1, + num1: .676508, + num2: .393732, + num3: .44373, + denom1: .685951, + denom2: .344841, + sup1: .412892, + sup2: .362892, + sup3: .288888, + sub1: .15, + sub2: .247217, + sup_drop: .386108, + sub_drop: .05, + delim1: 2.39, + delim2: 1.0, + axis_height: .25, + rule_thickness: .06, + big_op_spacing1: .111111, + big_op_spacing2: .166666, + big_op_spacing3: .2, + big_op_spacing4: .45, //.6, // better spacing for under arrows and braces + big_op_spacing5: .1, + + surd_height: .075, + + scriptspace: .05, + nulldelimiterspace: .12, + delimiterfactor: 901, + delimitershortfall: .3, + + min_rule_thickness: 1.25 // in pixels + }, + + /********************************************************/ + + // + // True if text holds a single (unicode) glyph + // + isChar: function (text) { + if (text.length === 1) return true; + if (text.length !== 2) return false; + var n = text.charCodeAt(0); + return (n >= 0xD800 && n < 0xDBFF); + }, + // + // Get a unicode character by number (even when it takes two character) + // + unicodeChar: function (n) { + if (n < 0xFFFF) return String.fromCharCode(n); + n -= 0x10000; + return String.fromCharCode((n>>10)+0xD800) + String.fromCharCode((n&0x3FF)+0xDC00); + }, + // + // Get the unicode number of a (possibly multi-character) string + // + getUnicode: function (string) { + var n = string.text.charCodeAt(string.i); string.i++; + if (n >= 0xD800 && n < 0xDBFF) { + n = (((n-0xD800)<<10)+(string.text.charCodeAt(string.i)-0xDC00))+0x10000; + string.i++; + } + return n; + }, + // + // Get the list of actions for a given character in a given variant + // (processing remaps, multi-character results, and so on). Results are + // cached so that future lookups for the same variant/n pair will not + // require looking through the data again. + // + getCharList: function (variant,n) { + var id, M, cache = variant.cache, nn = n; + if (cache[n]) return cache[n]; + if (n > 0xFFFF && this.FONTDATA.RemapPlane1) { + var nv = this.FONTDATA.RemapPlane1(n,variant); + n = nv.n; variant = nv.variant; + } + var RANGES = this.FONTDATA.RANGES, VARIANT = this.FONTDATA.VARIANT; + if (n >= RANGES[0].low && n <= RANGES[RANGES.length-1].high) { + for (id = 0, M = RANGES.length; id < M; id++) { + if (RANGES[id].name === "alpha" && variant.noLowerCase) continue; + var N = variant["offset"+RANGES[id].offset]; + if (N && n >= RANGES[id].low && n <= RANGES[id].high) { + if (RANGES[id].remap && RANGES[id].remap[n]) { + n = N + RANGES[id].remap[n]; + } else { + n = n - RANGES[id].low + N; + if (RANGES[id].add) {n += RANGES[id].add} + } + if (variant["variant"+RANGES[id].offset]) + variant = VARIANT[variant["variant"+RANGES[id].offset]]; + break; + } + } + } + cache[nn] = this.remapChar(variant,n,0); + return cache[nn]; + }, + remapChar: function (variant,n,N) { + var list = [], VARIANT = this.FONTDATA.VARIANT; + if (variant.remap && variant.remap[n]) { + n = variant.remap[n]; + if (variant.remap.variant) {variant = VARIANT[variant.remap.variant]} + } else if (this.FONTDATA.REMAP[n] && !variant.noRemap) { + n = this.FONTDATA.REMAP[n]; + } + if (isArray(n)) { + if (n[2]) N = MAXREMAP; // stop remapping + variant = VARIANT[n[1]]; n = n[0]; + } + if (typeof(n) === "string") { + var string = {text:n, i:0, length:n.length}; + while (string.i < string.length) { + n = this.getUnicode(string); + var chars = this.getCharList(variant,n); + if (chars) list.push.apply(list,chars); + } + } else { + if (variant.cache[n]) {list = variant.cache[n]} + else {variant.cache[n] = list = this.lookupChar(variant,n,N)} + } + return list; + }, + // + // After all remapping has been done, look up a character + // in the fonts for a given variant, chaining to other + // variants as needed. Return an undefined character if + // it isn't found in the given variant. + // + lookupChar: function (variant,n,N) { + var VARIANT = variant; + while (variant) { + for (var i = 0, m = variant.fonts.length; i < m; i++) { + var font = this.FONTDATA.FONTS[variant.fonts[i]]; + if (typeof(font) === "string") this.loadFont(font); + var C = font[n]; + if (C) { + this.fixChar(C,n); + if (C[5].space) return [{type:"space", w:C[2], font:font}]; + return [{type:"char", font:font, n:n}]; + } else if (font.Extra) { + this.findBlock(font,n); + } + } + variant = this.FONTDATA.VARIANT[variant.chain]; + if (variant && variant.remap && variant.remap[n] && N++ < MAXREMAP) { + return this.remapChar(variant,n,N); + } + } + return [this.unknownChar(VARIANT,n)]; + }, + fixChar: function (C,n) { + if (C.length === 5) C[5] = {}; + if (C.c == null) { + C[0] /= 1000; C[1] /= 1000; C[2] /= 1000; C[3] /= 1000; C[4] /= 1000; + C.c = this.unicodeChar(n); + } + return C; + }, + findBlock: function (font,n) { + var extra = font.Extra, name = font.file, file; + for (var i = 0, m = extra.length; i < m; i++) { + if (typeof(extra[i]) === "number") { + if (n === extra[i]) {file = name; break} + } else { + if (n < extra[i][0]) return; + if (n <= extra[i][1]) {file = name; break} + } + } + // + // Currently this only loads one extra file, but that + // might need to be expanded in the future. + // + if (file) {delete font.Extra; this.loadFont(name)} + }, + // + // Create a fake font entry for an unknown character. + // + unknownChar: function (variant,n) { + HUB.signal.Post(["CommonHTML Jax - unknown char",n,variant]); + var id = ""; if (variant.bold) id += "B"; if (variant.italic) id += "I"; + var unknown = this.FONTDATA.UNKNOWN[id||"R"]; // cache of previously measured characters + if (!unknown[n]) this.getUnknownChar(unknown,n); + return {type:"unknown", n:n, font:unknown}; + }, + getUnknownChar: function (unknown,n) { + var c = this.unicodeChar(n); + var HDW = this.getHDW(c,unknown.className); + // ### FIXME: provide a means of setting the height and depth for individual characters + unknown[n] = [.8,.2,HDW.w,0,HDW.w,{a:Math.max(0,(HDW.h-HDW.d)/2), h:HDW.h, d:HDW.d}]; + unknown[n].c = c; + }, + styledText: function (variant,text) { + HUB.signal.Post(["CommonHTML Jax - styled text",text,variant]); + var style = variant.style; + var id = "_"+(style["font-family"]||variant.className||""); + if (style["font-weight"]) id += "_"+style["font-weight"]; + if (style["font-style"]) id += "_"+style["font-style"]; + if (!this.STYLEDTEXT) this.STYLEDTEXT = {}; + if (!this.STYLEDTEXT[id]) this.STYLEDTEXT[id] = {className:variant.className||""}; + var unknown = this.STYLEDTEXT[id]; + if (!unknown["_"+text]) { + var HDW = this.getHDW(text,variant.className||"",style); + unknown["_"+text] = [.8,.2,HDW.w,0,HDW.w,{a:Math.max(0,(HDW.h-HDW.d)/2), h:HDW.h, d:HDW.d}]; + unknown["_"+text].c = text; + } + return {type:"unknown", n:"_"+text, font:unknown, style:style, rscale:variant.rscale}; + }, + + // + // Get the height, depth, and width of a character + // (height and depth are of the font, not the character). + // WARNING: causes reflow of the page! + // + getHDW: function (c,name,styles) { + var test1 = CHTML.addElement(CHTML.CHTMLnode,"mjx-chartest",{className:name},[["mjx-char",{style:styles},[c]]]); + var test2 = CHTML.addElement(CHTML.CHTMLnode,"mjx-chartest",{className:name},[["mjx-char",{style:styles},[c,["mjx-box"]]]]); + test1.firstChild.style.fontSize = test2.firstChild.style.fontSize = ""; + var em = 5*CHTML.em; + var H1 = test1.offsetHeight, H2 = test2.offsetHeight, W = test1.offsetWidth; + CHTML.CHTMLnode.removeChild(test1); + CHTML.CHTMLnode.removeChild(test2); + if (H2 === 0) { + em = 5*CHTML.defaultEm; + var test = document.body.appendChild(document.createElement("div")); + test.appendChild(test1); test.appendChild(test2); + H1 = test1.offsetHeight, H2 = test2.offsetHeight, W = test1.offsetWidth; + document.body.removeChild(test); + } + var d = (H2-1000)/em, w = W/em, h = H1/em - d; + return {h:h, d:d, w:w} + }, + + + /********************************************************/ + + // + // Process a character list into a given node and return + // the updated bounding box. + // + addCharList: function (node,list,bbox) { + var state = {text:"", className:null, a:0}; + for (var i = 0, m = list.length; i < m; i++) { + var item = list[i]; + if (this.charList[item.type]) (this.charList[item.type])(item,node,bbox,state,m); + } + if (state.text !== "") { + if (node.childNodes.length) { + this.charList.flushText(node,state); + } else { + HTML.addText(node,state.text); + if (node.className) node.className += " "+state.className; + else node.className = state.className; + } + } + bbox.b = (state.flushed ? 0 : bbox.a); + }, + // + // The various item types are processed by these + // functions. + // + charList: { + // + // Character from the known fonts + // + "char": function (item,node,bbox,state,m) { + var font = item.font, remap = (font.remapCombining||{})[item.n]; + if (font.className === state.className) { + remap = null; + } else if (state.className || (remap && state.text !== "")) { + this.flushText(node,state); + } + if (!state.a) state.a = font.centerline/1000; + if (state.a > (bbox.a||0)) bbox.a = state.a; + state.className = font.className; + var C = font[item.n]; + if (remap) { + var FONT = font; + if (isArray(remap)) { + FONT = CHTML.FONTDATA.FONTS[remap[1]]; + remap = remap[0]; + if (typeof(FONT) === 'string') CHTML.loadFont(FONT); + } + if (FONT[item.n]) CHTML.fixChar(FONT[item.n],item.n); + C = CHTML.fixChar(FONT[remap],remap); + state.className = FONT.className; + } + state.text += C.c; + if (bbox.h < C[0]+HFUZZ) bbox.t = bbox.h = C[0]+HFUZZ; + if (bbox.d < C[1]+DFUZZ) bbox.b = bbox.d = C[1]+DFUZZ; + if (bbox.l > bbox.w+C[3]) bbox.l = bbox.w+C[3]; + if (bbox.r < bbox.w+C[4]) bbox.r = bbox.w+C[4]; + bbox.w += C[2] * (item.rscale||1); + if (m == 1 && font.skew && font.skew[item.n]) bbox.skew = font.skew[item.n]; + if (C[5] && C[5].rfix) this.flushText(node,state).style.marginRight = CHTML.Em(C[5].rfix/1000); + if (remap) { + // + // Remap combining characters to non-combining versions since Safari + // handles them differently from everyone else. (#1709) + // + var chr = this.flushText(node,state); + var r = (FONT[item.n]||font[item.n])[4] - (C[4] - C[2]); + chr.style.marginLeft = CHTML.Em(-C[2]-r); + if (r < 0) chr.style.marginRight = CHTML.Em(-r); + } + }, + // + // Space characters (not actually in the fonts) + // + space: function (item,node,bbox,state) { + if (item.w) { + if (state.text === "") state.className = item.font.className; + this.flushText(node,state).style.marginRight = CHTML.Em(item.w); + bbox.w += item.w; + } + }, + // + // An unknown character (one not in the font data) + // + unknown: function (item,node,bbox,state) { + (this["char"])(item,node,bbox,state,0); + var C = item.font[item.n]; + if (C[5].a) { + state.a = C[5].a; + if (bbox.a == null || state.a > bbox.a) bbox.a = state.a; + } + node = this.flushText(node,state,item.style); + if (C[2] < 3) node.style.width = CHTML.Em(C[2]); // only force width if not too large (#1718) + }, + // + // Put the pending text into a box of the class, and + // reset the data about the text. + // + flushText: function (node,state,style) { + node = CHTML.addElement(node,"mjx-charbox", + {className:state.className,style:style},[state.text]); + if (state.a) node.style.paddingBottom = CHTML.Em(state.a); + state.text = ""; state.className = null; state.a = 0; state.flushed = true; + return node; + } + }, + + // + // Add the given text (in the given variant) into the given node, and + // update the bounding box of the result. Make sure the node's DOM + // bounding box matches the contents. + // + handleText: function (node,text,variant,bbox) { + if (node.childNodes.length === 0) { + CHTML.addElement(node,"mjx-char"); + bbox = CHTML.BBOX.empty(bbox); + } + if (typeof(variant) === "string") variant = this.FONTDATA.VARIANT[variant]; + if (!variant) variant = this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]; + var string = {text:text, i:0, length:text.length}, list = []; + if (variant.style && string.length) { + list.push(this.styledText(variant,text)); + } else { + while (string.i < string.length) { + var n = this.getUnicode(string); + list.push.apply(list,this.getCharList(variant,n)); + } + } + if (list.length) this.addCharList(node.firstChild,list,bbox); + bbox.clean(); + if (bbox.d < 0) {bbox.D = bbox.d; bbox.d = 0} + if (bbox.h - bbox.a) node.firstChild.style[bbox.h - bbox.a < 0 ? "marginTop" : "paddingTop"] = this.EmRounded(bbox.h-bbox.a); + if (bbox.d > -bbox.b) node.firstChild.style.paddingBottom = this.EmRounded(bbox.d+bbox.b); + return bbox; + }, + + /********************************************************/ + + createDelimiter: function (node,code,HW,BBOX,font) { + if (!code) { + var bbox = this.BBOX.zero(); + bbox.w = bbox.r = this.TEX.nulldelimiterspace; + CHTML.addElement(node,"mjx-box",{style:{width:bbox.w}}); + return bbox; + } + if (!(HW instanceof Array)) HW = [HW,HW]; + var hw = HW[1]; HW = HW[0]; + var delim = {alias: code}; + while (delim.alias) { + code = delim.alias; delim = this.FONTDATA.DELIMITERS[code]; + if (!delim) {delim = {HW: [0,this.FONTDATA.VARIANT[MML.VARIANT.NORMAL]]}} + } + if (delim.load) HUB.RestartAfter(AJAX.Require(this.fontDir+"/TeX/fontdata-"+delim.load+".js")); + for (var i = 0, m = delim.HW.length; i < m; i++) { + if (delim.HW[i][0] >= HW-.01 || (i == m-1 && !delim.stretch)) { + if (delim.HW[i][3]) code = delim.HW[i][3]; + bbox = this.createChar(node,[code,delim.HW[i][1]],(delim.HW[i][2]||1),font); + bbox.offset = .6 * bbox.w; + if (BBOX) {bbox.scale = BBOX.scale; BBOX.rscale = BBOX.rscale} + return bbox; + } + } + if (!delim.stretch) return bbox; + return this["extendDelimiter"+delim.dir](node,hw,delim.stretch,BBOX,font); + }, + extendDelimiterV: function (node,H,delim,BBOX,font) { + node = CHTML.addElement(node,"mjx-delim-v"); var tmp = CHTML.Element("span"); + var top, bot, mid, ext, tbox, bbox, mbox, ebox, k = 1, c; + tbox = this.createChar(tmp,(delim.top||delim.ext),1,font); top = tmp.removeChild(tmp.firstChild); + bbox = this.createChar(tmp,(delim.bot||delim.ext),1,font); bot = tmp.removeChild(tmp.firstChild); + mbox = ebox = CHTML.BBOX.zero(); + var h = tbox.h + tbox.d + bbox.h + bbox.d - EFUZZ; + node.appendChild(top); + if (delim.mid) { + mbox = this.createChar(tmp,delim.mid,1,font); mid = tmp.removeChild(tmp.firstChild); + h += mbox.h + mbox.d; k = 2; + } + if (delim.min && H < h*delim.min) H = h*delim.min; + if (H > h) { + ebox = this.createChar(tmp,delim.ext,1,font); ext = tmp.removeChild(tmp.firstChild); + var eH = ebox.h + ebox.d, eh = eH - EFUZZ; + var n = Math.min(Math.ceil((H-h)/(k*eh)),this.maxStretchyParts); + if (delim.fullExtenders) H = n*k*eh + h; else eh = (H-h)/(k*n); + c = ebox.d + ebox.a - eH/2; // for centering of extenders + ext.style.margin = ext.style.padding = ""; + ext.style.lineHeight = CHTML.Em(eh); + ext.style.marginBottom = CHTML.Em(c-EFUZZ/2/k); + ext.style.marginTop = CHTML.Em(-c-EFUZZ/2/k); + var TEXT = ext.textContent, text = "\n"+TEXT; + while (--n > 0) TEXT += text; + ext.textContent = TEXT; + node.appendChild(ext); + if (delim.mid) { + node.appendChild(mid); + node.appendChild(ext.cloneNode(true)); + } + } else { + c = (H-h-EFUZZ) / k; + top.style.marginBottom = CHTML.Em(c+parseFloat(top.style.marginBottom||"0")); + if (delim.mid) node.appendChild(mid); + bot.style.marginTop = CHTML.Em(c+parseFloat(bot.style.marginTop||"0")); + } + node.appendChild(bot); + var vbox = CHTML.BBOX({ + w: Math.max(tbox.w,ebox.w,bbox.w,mbox.w), + l: Math.min(tbox.l,ebox.l,bbox.l,mbox.l), + r: Math.max(tbox.r,ebox.r,bbox.r,mbox.r), + h: H-bbox.d, d: bbox.d, t: H-bbox.d, b: bbox.d + }); + vbox.offset = .5 * vbox.w; + if (BBOX) {vbox.scale = BBOX.scale; vbox.rscale = BBOX.rscale} + return vbox; + }, + extendDelimiterH: function (node,W,delim,BBOX,font) { + node = CHTML.addElement(node,"mjx-delim-h"); var tmp = CHTML.Element("span"); + var left, right, mid, ext, ext2, lbox, rbox, mbox, ebox, k = 1; + lbox = this.createChar(tmp,(delim.left||delim.rep),1,font); left = tmp.removeChild(tmp.firstChild); + rbox = this.createChar(tmp,(delim.right||delim.rep),1,font); right = tmp.removeChild(tmp.firstChild); + ebox = this.createChar(tmp,delim.rep,1,font); ext = tmp.removeChild(tmp.firstChild); + left.style.marginLeft = CHTML.Em(-lbox.l); + right.style.marginRight = CHTML.Em(rbox.r-rbox.w); + node.appendChild(left); + var hbox = CHTML.BBOX.zero(); + hbox.h = Math.max(lbox.h,rbox.h,ebox.h); + hbox.d = Math.max(lbox.D||lbox.d,rbox.D||rbox.d,ebox.D||ebox.d); + var w = (lbox.r - lbox.l) + (rbox.r - rbox.l) - EFUZZ; + if (delim.mid) { + mbox = this.createChar(tmp,delim.mid,1,font); + mid = tmp.removeChild(tmp.firstChild); + mid.style.marginleft = CHTML.Em(-mbox.l); mid.style.marginRight = CHTML.Em(mbox.r-mbox.w); + w += mbox.r - mbox.l + EFUZZ; k = 2; + if (mbox.h > hbox.h) hbox.h = mbox.h; + if (mbox.d > hbox.d) hbox.d = mbox.d; + } + if (delim.min && W < w*delim.min) W = w*delim.min; + hbox.w = hbox.r = W; + if (W > w) { + var eW = ebox.r-ebox.l, ew = eW - EFUZZ; + var n = Math.min(Math.ceil((W-w)/(k*ew)),this.maxStretchyParts); + if (delim.fullExtenders) W = n*k*ew + w; else ew = (W-w)/(k*n); + var c = (eW - ew + EFUZZ/k) / 2; // for centering of extenders + ext.style.marginLeft = CHTML.Em(-ebox.l-c); + ext.style.marginRight = CHTML.Em(ebox.r-ebox.w+c); + ext.style.letterSpacing = CHTML.Em(-(ebox.w-ew)); + left.style.marginRight = CHTML.Em(lbox.r-lbox.w); + right.style.marginleft = CHTML.Em(-rbox.l); + var TEXT = ext.textContent, text = TEXT; + while (--n > 0) TEXT += text; + ext.textContent = TEXT; + node.appendChild(ext); + if (delim.mid) { + node.appendChild(mid); + ext2 = node.appendChild(ext.cloneNode(true)); + } + } else { + c = (W-w-EFUZZ/k) / 2; + left.style.marginRight = CHTML.Em(lbox.r-lbox.w+c); + if (delim.mid) node.appendChild(mid); + right.style.marginLeft = CHTML.Em(-rbox.l+c); + } + node.appendChild(right); + this.adjustHeights([left,ext,mid,ext2,right],[lbox,ebox,mbox,ebox,rbox],hbox); + if (BBOX) {hbox.scale = BBOX.scale; hbox.rscale = BBOX.rscale} + return hbox; + }, + adjustHeights: function (nodes,box,bbox) { + // + // To get alignment right in horizontal delimiters, we force all + // the elements to the same height and depth + // + var T = bbox.h, B = bbox.d; + if (bbox.d < 0) {B = -bbox.d; bbox.D = bbox.d; bbox.d = 0} + for (var i = 0, m = nodes.length; i < m; i++) if (nodes[i]) { + nodes[i].style.paddingTop = CHTML.Em(T-box[i].a); + nodes[i].style.paddingBottom = CHTML.Em(B+box[i].a); + nodes[i].style.marginTop = nodes[i].style.marginBottom = 0; + } + }, + createChar: function (node,data,scale,font) { + // ### FIXME: handle cache better (by data[1] and font) + var text = "", variant = {fonts: [data[1]], noRemap:true, cache:{}}; + if (font && font === MML.VARIANT.BOLD && this.FONTDATA.FONTS[data[1]+"-Bold"]) + variant.fonts = [data[1]+"-Bold",data[1]]; + if (typeof(data[1]) !== "string") variant = data[1]; + if (data[0] instanceof Array) { + for (var i = 0, m = data[0].length; i < m; i++) text += String.fromCharCode(data[0][i]); + } else text = String.fromCharCode(data[0]); + if (data[4]) scale *= data[4]; + var bbox = this.handleText(node,text,variant), style = node.firstChild.style; + if (scale !== 1) style.fontSize = this.Percent(scale); + if (data[2]) { // x offset + style.paddingLeft = this.Em(data[2]); + bbox.w += data[2]; bbox.r += data[2]; + } + if (data[3]) { // y offset + style.verticalAlign = this.Em(data[3]); + bbox.h += data[3]; if (bbox.h < 0) bbox.h = 0; + } + if (data[5]) { // extra height + style.marginTop = this.Em(data[5]); + bbox.h += data[5]; bbox.t += data[5]; + } + if (data[6]) { // extra depth + style.marginBottom = this.Em(data[6]); + bbox.d += data[6]; bbox.b += data[6]; + } + return bbox; + }, + + /********************************************************/ + + // + // ### FIXME: Handle mu's + // + length2em: function (length,size,scale) { + if (typeof(length) !== "string") length = length.toString(); + if (length === "") return ""; + if (length === MML.SIZE.NORMAL) return 1; + if (length === MML.SIZE.BIG) return 2; + if (length === MML.SIZE.SMALL) return .71; + if (this.MATHSPACE[length]) return this.MATHSPACE[length]; + var match = length.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/); + var m = parseFloat(match[1]||"1"), unit = match[2]; + if (size == null) size = 1; if (!scale) scale = 1; + scale = 1 /this.em / scale; + if (unit === "em") return m; + if (unit === "ex") return m * this.TEX.x_height; + if (unit === "%") return m / 100 * size; + if (unit === "px") return m * scale; + if (unit === "pt") return m / 10; // 10 pt to an em + if (unit === "pc") return m * 1.2; // 12 pt to a pc + scale *= this.pxPerInch; + if (unit === "in") return m * scale; + if (unit === "cm") return m * scale / 2.54; // 2.54 cm to an inch + if (unit === "mm") return m * scale / 25.4; // 10 mm to a cm + if (unit === "mu") return m / 18; // 18mu to an em for the scriptlevel + return m*size; // relative to given size (or 1em as default) + }, + thickness2em: function (length,scale) { + var thick = CHTML.TEX.rule_thickness/(scale||1); + if (length === MML.LINETHICKNESS.MEDIUM) return thick; + if (length === MML.LINETHICKNESS.THIN) return .67*thick; + if (length === MML.LINETHICKNESS.THICK) return 1.67*thick; + return this.length2em(length,thick,scale); + }, + + Em: function (m) { + if (Math.abs(m) < .001) return "0"; + return (m.toFixed(3).replace(/\.?0+$/,""))+"em"; + }, + EmRounded: function (m) { + m = (Math.round(m*CHTML.em)+.05)/CHTML.em; + if (Math.abs(m) < .0006) {return "0em"} + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; + }, + unEm: function (m) { + return parseFloat(m); + }, + Px: function (m,M) { + m *= this.em; + if (M && m < M) m = M; + if (Math.abs(m) < .1) return "0"; + return m.toFixed(1).replace(/\.0$/,"")+"px"; + }, + + Percent: function (m) { + return (100*m).toFixed(1).replace(/\.?0+$/,"") + "%"; + }, + + Transform: function (node,trans,origin) { + var style = node.style; + style.transform = style.WebkitTransform = style.MozTransform = style["-ms-transform"] = trans; + if (origin) + style.transformOrigin = style.WebkitTransformOrigin = + style.MozTransformOrigin = style["-ms-transform-origin"] = origin; + }, + + /********************************************************/ + + arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]}, + + // + // Styles to be removed from style="..." attributes + // + removeStyles: ["fontSize","fontFamily","fontWeight","fontStyle","fontVariant","font"] + + }); + + /**********************************************************/ + + CHTML.BBOX = MathJax.Object.Subclass({ + Init: function (def) { + for (var id in def) { + if (def.hasOwnProperty(id)) this[id] = def[id]; + } + }, + clean: function () { + if (this.h === -BIGDIMEN) this.h = 0; + if (this.d === -BIGDIMEN) this.d = 0; + if (this.l === BIGDIMEN) this.l = 0; + if (this.r === -BIGDIMEN) this.r = 0; + if (this.t === -BIGDIMEN) this.t = 0; + if (this.b === -BIGDIMEN) this.b = 0; + if (this.D && this.d > 0) delete this.D; + }, + rescale: function (scale) { + this.w *= scale; this.h *= scale; this.d *= scale; + this.l *= scale; this.r *= scale; this.t *= scale; this.b *= scale; + if (this.L) this.L *= scale; + if (this.R) this.R *= scale; + if (this.D) this.D *= scale; + }, + combine: function (cbox,x,y) { + cbox.X = x; cbox.Y = y; // save for use with line breaking + var scale = cbox.rscale; + if (x + scale*cbox.r > this.r) this.r = x + scale*cbox.r; + if (x + scale*cbox.l < this.l) this.l = x + scale*cbox.l; + if (x + scale*(cbox.w+(cbox.L||0)+(cbox.R||0)) > this.w) + this.w = x + scale*(cbox.w + (cbox.L||0) + (cbox.R||0)); + if (y + scale*cbox.h > this.h) this.h = y + scale*cbox.h; + if (cbox.D && (this.D == null || scale*cbox.D - y > this.D) && scale*cbox.D > this.d) this.D = scale*cbox.D - y; + else if (cbox.D == null && this.D) delete this.D; + if (scale*cbox.d - y > this.d) this.d = scale*cbox.d - y; + if (y + scale*cbox.t > this.t) this.t = y + scale*cbox.t; + if (scale*cbox.b - y > this.b) this.b = scale*cbox.b - y; + }, + append: function (cbox) { + var scale = cbox.rscale; var x = this.w; + if (x + scale*cbox.r > this.r) this.r = x + scale*cbox.r; + if (x + scale*cbox.l < this.l) this.l = x + scale*cbox.l; + this.w += scale*(cbox.w+(cbox.L||0)+(cbox.R||0)) ; + if (scale*cbox.h > this.h) this.h = scale*cbox.h; + if (cbox.D && (this.D == null || scale*cbox.D > this.D) && scale*cbox.D > this.d) this.D = scale*cbox.D; + else if (cbox.D == null && this.D) delete this.D; + if (scale*cbox.d > this.d) this.d = scale*cbox.d; + if (scale*cbox.t > this.t) this.t = scale*cbox.t; + if (scale*cbox.b > this.b) this.b = scale*cbox.b; + }, + updateFrom: function (cbox) { + this.h = cbox.h; this.d = cbox.d; this.w = cbox.w; this.r = cbox.r; this.l = cbox.l; + this.t = cbox.t; this.b = cbox.b; + if (cbox.pwidth) this.pwidth = cbox.pwidth; + if (cbox.D) this.D = cbox.D; else delete this.D; + }, + adjust: function (m,x,X,M) { + this[x] += CHTML.length2em(m,1,this.scale); + if (M == null) { + if (this[x] > this[X]) this[X] = this[x]; + } else { + if (this[X] < M) this[X] = M; + } + } + },{ + zero: function () { + return CHTML.BBOX({h:0, d:0, w:0, l:0, r:0, t:0, b:0, scale:1, rscale:1}); + }, + empty: function (bbox) { + if (!bbox) bbox = CHTML.BBOX.zero(); + bbox.h = bbox.d = bbox.r = bbox.t = bbox.b = -BIGDIMEN; + bbox.w = 0; bbox.l = BIGDIMEN; + delete bbox.pwidth; + return bbox; + }, + // + // CSS styles that affect BBOXes + // + styleAdjust: [ + ["borderTopWidth","h","t"], + ["borderRightWidth","w","r"], + ["borderBottomWidth","d","b"], + ["borderLeftWidth","w","l",0], + ["paddingTop","h","t"], + ["paddingRight","w","r"], + ["paddingBottom","d","b"], + ["paddingLeft","w","l",0], + ] + }); + + /**********************************************************/ + + MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { + MML = MathJax.ElementJax.mml; + + /********************************************************/ + + MML.mbase.Augment({ + toCommonHTML: function (node,options) { + return this.CHTMLdefaultNode(node,options); + }, + CHTMLmultiline: function () {MML.mbase.CHTMLautoloadFile("multiline")}, + + CHTMLdefaultNode: function (node,options) { + if (!options) options = {}; + node = this.CHTMLcreateNode(node); this.CHTML = CHTML.BBOX.empty(); + this.CHTMLhandleStyle(node); + if (this.isToken) this.CHTMLgetVariant(); + this.CHTMLhandleScale(node); + var m = Math.max((options.minChildren||0),this.data.length); + for (var i = 0; i < m; i++) this.CHTMLaddChild(node,i,options); + if (!options.noBBox) this.CHTML.clean(); + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + return node; + }, + CHTMLaddChild: function (node,i,options) { + var child = this.data[i], cnode; + var type = options.childNodes; + if (type instanceof Array) type = type[i]||"span"; + if (child) { + if (type) node = CHTML.addElement(node,type); + cnode = child.toCommonHTML(node,options.childOptions); + if (type && child.CHTML.rscale !== 1) { + // move scale factor to outer container (which seems to be more accurate) + node.style.fontSize = node.firstChild.style.fontSize; + node.firstChild.style.fontSize = ""; + } + if (!options.noBBox) { + var bbox = this.CHTML, cbox = child.CHTML; + bbox.append(cbox); + if (this.data.length === 1) { + if (cbox.ic) bbox.ic = cbox.ic; + if (cbox.skew) bbox.skew = cbox.skew; + } else { + delete bbox.ic; + delete bbox.skew; + } + if (cbox.pwidth) bbox.pwidth = cbox.pwidth; + } + } else if (options.forceChild) { + cnode = CHTML.addElement(node,(type||"mjx-box")); + } + return cnode; + }, + + CHTMLchildNode: function (node,i) { + node = node.childNodes[i]; + if (node.nodeName.toLowerCase() === "a") node = node.firstChild; + return node; + }, + CHTMLcoreNode: function (node) { + if (this.inferRow && this.data[0]) return this.data[0].CHTMLcoreNode(node.firstChild); + return this.CHTMLchildNode(node,this.CoreIndex()); + }, + + CHTMLstretchChildV: function (i,H,D) { + var data = this.data[i]; + if (data) { + var bbox = this.CHTML, dbox = data.CHTML; + if (dbox.stretch || (dbox.stretch == null && data.CHTMLcanStretch("Vertical",H,D))) { + var w = dbox.w; + dbox = data.CHTMLstretchV(H,D); + bbox.w += dbox.w - w; + if (bbox.w > bbox.r) bbox.r = bbox.w; + if (dbox.h > bbox.h) bbox.h = dbox.h; + if (dbox.d > bbox.d) bbox.d = dbox.d; + if (dbox.t > bbox.t) bbox.t = dbox.t; + if (dbox.b > bbox.b) bbox.b = dbox.b; + } + } + }, + CHTMLstretchChildH: function (i,W,node) { + var data = this.data[i]; + if (data) { + var bbox = this.CHTML, dbox = data.CHTML; + if (dbox.stretch || (dbox.stretch == null && data.CHTMLcanStretch("Horizontal",W))) { + var w = dbox.w; + dbox = data.CHTMLstretchH(this.CHTMLchildNode(node,i),W); + bbox.w += dbox.w - w; + if (bbox.w > bbox.r) bbox.r = bbox.w; + if (dbox.h > bbox.h) bbox.h = dbox.h; + if (dbox.d > bbox.d) bbox.d = dbox.d; + if (dbox.t > bbox.t) bbox.t = dbox.t; + if (dbox.b > bbox.b) bbox.b = dbox.b; + } + } + }, + CHTMLupdateFrom: function (bbox) { + this.CHTML.updateFrom(bbox); + if (this.inferRow) this.data[0].CHTML.updateFrom(bbox); + }, + + CHTMLcanStretch: function (direction,H,D) { + var stretch = false; + if (this.isEmbellished()) { + var core = this.Core(); + if (core && core !== this) stretch = core.CHTMLcanStretch(direction,H,D); + } + this.CHTML.stretch = stretch; + return stretch; + }, + CHTMLstretchV: function (h,d) { + this.CHTMLupdateFrom(this.Core().CHTMLstretchV(h,d)); + return this.CHTML; + }, + CHTMLstretchH: function (node,w) { + this.CHTMLupdateFrom(this.CHTMLstretchCoreH(node,w)); + return this.CHTML; + }, + CHTMLstretchCoreH: function (node,w) { + return this.Core().CHTMLstretchH(this.CHTMLcoreNode(node),w); + }, + + CHTMLcreateNode: function (node) { + if (!this.CHTML) this.CHTML = {}; + this.CHTML = CHTML.BBOX.zero(); + if (this.href) node = CHTML.addElement(node,"a",{href:this.href, isMathJax:true}); + if (!this.CHTMLnodeID) this.CHTMLnodeID = CHTML.GetID(); + var id = (this.id || "MJXc-Node-"+this.CHTMLnodeID)+CHTML.idPostfix; + return this.CHTMLhandleAttributes(CHTML.addElement(node,"mjx-"+this.type,{id:id})); + }, + CHTMLnodeElement: function () { + if (!this.CHTMLnodeID) {return null} + return document.getElementById((this.id||"MJXc-Node-"+this.CHTMLnodeID)+CHTML.idPostfix); + }, + + CHTMLlength2em: function (length,size) { + return CHTML.length2em(length,size,this.CHTML.scale); + }, + + CHTMLhandleAttributes: function (node) { + if (this["class"]) { + if (node.className) node.className += " "+this["class"]; + else node.className = this["class"]; + } + // + // Copy RDFa, aria, and other tags from the MathML to the CHTML + // output nodes. Don't copy those in the MML.nocopyAttributes list, + // the ignoreMMLattributes configuration list, or anything that + // already exists as a property of the node (e.g., no "onlick", etc.) + // If a name in the ignoreMMLattributes object is set to false, then + // the attribute WILL be copied. + // + if (this.attrNames) { + var copy = this.attrNames, skip = MML.nocopyAttributes, ignore = HUB.config.ignoreMMLattributes; + var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults); + for (var i = 0, m = copy.length; i < m; i++) { + var id = copy[i]; + if (ignore[id] == false || (!skip[id] && !ignore[id] && + defaults[id] == null && typeof(node[id]) === "undefined")) { + node.setAttribute(id,this.attr[id]) + } + } + } + return node; + }, + + CHTMLhandleScale: function (node) { + var scale = 1, parent = this.parent, pscale = (parent ? parent.CHTML.scale : 1); + var values = this.getValues("scriptlevel","fontsize"); + values.mathsize = this.Get("mathsize",null,!this.isToken); + if (values.scriptlevel !== 0) { + if (values.scriptlevel > 2) values.scriptlevel = 2; + scale = Math.pow(this.Get("scriptsizemultiplier"),values.scriptlevel); + values.scriptminsize = CHTML.length2em(this.Get("scriptminsize"),.8,1); + if (scale < values.scriptminsize) scale = values.scriptminsize; + } + if (this.removedStyles && this.removedStyles.fontSize && !values.fontsize) + values.fontsize = this.removedStyles.fontSize; + if (values.fontsize && !this.mathsize) values.mathsize = values.fontsize; + if (values.mathsize !== 1) scale *= CHTML.length2em(values.mathsize,1,1); + var variant = this.CHTMLvariant; + if (variant && variant.style && variant.style["font-family"]) + scale *= (CHTML.config.scale/100)/CHTML.scale; + this.CHTML.scale = scale; pscale = this.CHTML.rscale = scale/pscale; + if (Math.abs(pscale-1) < .001) pscale = 1; + if (node && pscale !== 1) node.style.fontSize = CHTML.Percent(pscale); + return scale; + }, + + CHTMLhandleStyle: function (node) { + if (!this.style) return; + var style = node.style; + style.cssText = this.style; this.removedStyles = {}; + for (var i = 0, m = CHTML.removeStyles.length; i < m; i++) { + var id = CHTML.removeStyles[i]; + if (style[id]) { + this.removedStyles[id] = style[id]; + style[id] = ""; + } + } + }, + + CHTMLhandleBBox: function (node) { + var BBOX = this.CHTML, style = node.style; + if (this.data.length === 1 && (this.data[0].CHTML||{}).pwidth) { + BBOX.pwidth = this.data[0].CHTML.pwidth; + BBOX.mwidth = this.data[0].CHTML.mwidth; + style.width = "100%"; + } else if (BBOX.pwidth) { + BBOX.mwidth = CHTML.Em(BBOX.w); + style.width = "100%"; + } else if (BBOX.w < 0) { + style.width = "0px"; + style.marginRight = CHTML.Em(BBOX.w); + } + if (!this.style) return; + // ### FIXME: adjust for width, height, vertical-align? + for (var i = 0, m = CHTML.BBOX.styleAdjust.length; i < m; i++) { + var data = CHTML.BBOX.styleAdjust[i]; + if (data && style[data[0]]) BBOX.adjust(style[data[0]],data[1],data[2],data[3]); + } + }, + + CHTMLhandleColor: function (node) { + if (this.mathcolor) {node.style.color = this.mathcolor} + else if (this.color) {node.style.color = this.color} + if (this.mathbackground) {node.style.backgroundColor = this.mathbackground} + else if (this.background) {node.style.backgroundColor = this.background} + }, + + CHTMLhandleSpace: function (node) { + if (!this.useMMLspacing) { + var space = this.texSpacing(); + if (space !== "") { + this.CHTML.L = this.CHTMLlength2em(space); + node.className += " "+CHTML.SPACECLASS[space]; + } + } + }, + + CHTMLhandleText: function (node,text,variant) { + if (node.firstChild && !this.CHTML) this.CHTML = CHTML.BBOX.empty(); + this.CHTML = CHTML.handleText(node,text,variant,this.CHTML); + }, + + CHTMLgetVariant: function () { + var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle"), style; + values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified + if (this.removedStyles) { + style = this.removedStyles; + if (style.fontFamily) values.family = style.fontFamily; + if (style.fontWeight) values.weight = style.fontWeight; + if (style.fontStyle) values.style = style.fontStyle; + } + if (!values.hasVariant) { + if (values.fontfamily) values.family = values.fontfamily; + if (values.fontweight) values.weight = values.fontweight; + if (values.fontstyle) values.style = values.fontstyle; + } + if (values.weight && values.weight.match(/^\d+$/)) + values.weight = (parseInt(values.weight) > 600 ? "bold" : "normal"); + var variant = values.mathvariant; if (this.variantForm) variant = "-TeX-variant"; + if (values.family && !values.hasVariant) { + if (!values.weight && values.mathvariant.match(/bold/)) values.weight = "bold"; + if (!values.style && values.mathvariant.match(/italic/)) values.style = "italic"; + this.CHTMLvariant = {fonts:[], noRemap:true, cache:{}, style: { + "font-family":values.family, "font-weight":values.weight||"normal", "font-style":values.style||"normal" + }}; + return; + } + if (values.weight === "bold") { + variant = { + normal:MML.VARIANT.BOLD, italic:MML.VARIANT.BOLDITALIC, + fraktur:MML.VARIANT.BOLDFRAKTUR, script:MML.VARIANT.BOLDSCRIPT, + "sans-serif":MML.VARIANT.BOLDSANSSERIF, + "sans-serif-italic":MML.VARIANT.SANSSERIFBOLDITALIC + }[variant]||variant; + } else if (values.weight === "normal") { + variant = { + bold:MML.VARIANT.normal, "bold-italic":MML.VARIANT.ITALIC, + "bold-fraktur":MML.VARIANT.FRAKTUR, "bold-script":MML.VARIANT.SCRIPT, + "bold-sans-serif":MML.VARIANT.SANSSERIF, + "sans-serif-bold-italic":MML.VARIANT.SANSSERIFITALIC + }[variant]||variant; + } + if (values.style === "italic") { + variant = { + normal:MML.VARIANT.ITALIC, bold:MML.VARIANT.BOLDITALIC, + "sans-serif":MML.VARIANT.SANSSERIFITALIC, + "bold-sans-serif":MML.VARIANT.SANSSERIFBOLDITALIC + }[variant]||variant; + } else if (values.style === "normal") { + variant = { + italic:MML.VARIANT.NORMAL, "bold-italic":MML.VARIANT.BOLD, + "sans-serif-italic":MML.VARIANT.SANSSERIF, + "sans-serif-bold-italic":MML.VARIANT.BOLDSANSSERIF + }[variant]||variant; + } + this.CHTMLvariant = CHTML.FONTDATA.VARIANT[variant] || + CHTML.FONTDATA.VARIANT[MML.VARIANT.NORMAL]; + }, + + CHTMLbboxFor: function (n) { + if (this.data[n] && this.data[n].CHTML) return this.data[n].CHTML; + return CHTML.BBOX.zero(); + }, + // + // Debugging function to see if internal BBox matches actual bbox + // + CHTMLdrawBBox: function (node,bbox) { + if (!bbox) bbox = this.CHTML; + var box = CHTML.Element("mjx-box", + {style:{opacity:.25,"margin-left":CHTML.Em(-(bbox.w+(bbox.R||0)))}},[ + ["mjx-box",{style:{ + height:CHTML.Em(bbox.h),width:CHTML.Em(bbox.w), + "background-color":"red" + }}], + ["mjx-box",{style:{ + height:CHTML.Em(bbox.d),width:CHTML.Em(bbox.w), + "margin-left":CHTML.Em(-bbox.w),"vertical-align":CHTML.Em(-bbox.d), + "background-color":"green" + }}] + ]); + if (node.nextSibling) {node.parentNode.insertBefore(box,node.nextSibling)} + else {node.parentNode.appendChild(box)} + }, + + CHTMLnotEmpty: function (mml) { + while (mml && mml.data.length < 2 && (mml.type === "mrow" || mml.type === "texatom")) + mml = mml.data[0]; + return !!mml; + } + + },{ + // + // Autoload files based on node type or file name + // + CHTMLautoload: function () { + this.constructor.Augment({toCommonHTML: MML.mbase.CHTMLautoloadFail}); + var file = CHTML.autoloadDir+"/"+this.type+".js"; + HUB.RestartAfter(AJAX.Require(file)); + }, + CHTMLautoloadFail: function () { + throw Error("CommonHTML can't autoload '"+ this.type + "'"); + }, + CHTMLautoloadList: {}, + CHTMLautoloadFile: function (name) { + if (MML.mbase.CHTMLautoloadList.hasOwnProperty(name)) { + throw Error("CommonHTML can't autoload file '"+name+"'"); + } + MML.mbase.CHTMLautoloadList[name] = true; + var file = CHTML.autoloadDir+"/"+name+".js"; + HUB.RestartAfter(AJAX.Require(file)); + }, + // + // For use with embellished operators + // + CHTMLstretchV: function (h,d) { + this.Core().CHTMLstretchV(h,d); + this.toCommonHTML(this.CHTMLnodeElement(),{stretch:true}); + return this.CHTML; + }, + CHTMLstretchH: function (node,w) { + this.CHTMLupdateFrom(this.CHTMLstretchCoreH(node,w)); + this.toCommonHTML(node,{stretch:true}); + return this.CHTML; + } + }); + + /********************************************************/ + + MML.chars.Augment({ + toCommonHTML: function (node,options) { + this.CHTML = null; + if (options == null) options = {}; + var text = this.toString(); + if (options.remap) text = options.remap(text,options.remapchars); + this.CHTMLhandleText(node,text,options.variant||this.parent.CHTMLvariant); + } + }); + MML.entity.Augment({ + toCommonHTML: function (node,options) { + if (options == null) options = {}; + var text = this.toString(); + if (options.remapchars) text = options.remap(text,options.remapchars); + this.CHTMLhandleText(node,text,options.variant||this.parent.CHTMLvariant); + } + }); + + /********************************************************/ + + MML.math.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node); + if (this.CHTML.w < 0) { + node.parentNode.style.width = "0px"; + node.parentNode.style.marginRight = CHTML.Em(this.CHTML.w); + } + var alttext = this.Get("alttext"); + if (alttext && !node.getAttribute("aria-label")) node.setAttribute("aria-label",alttext); + if (this.CHTML.pwidth) { + node.parentNode.style.minWidth = this.CHTML.mwidth||CHTML.Em(this.CHTML.w); + node.parentNode.className = "mjx-full-width "+node.parentNode.className; + node.style.width = this.CHTML.pwidth; + } else if (!this.isMultiline && this.Get("display") === "block") { + var values = this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift"); + if (values.indentalignfirst !== MML.INDENTALIGN.INDENTALIGN) values.indentalign = values.indentalignfirst; + if (values.indentalign === MML.INDENTALIGN.AUTO) values.indentalign = CONFIG.displayAlign; + if (values.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) values.indentshift = values.indentshiftfirst; + if (values.indentshift === "auto") values.indentshift = "0"; + var shift = this.CHTMLlength2em(values.indentshift,CHTML.cwidth); + if (CONFIG.displayIndent !== "0") { + var indent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth); + shift += (values.indentalign === MML.INDENTALIGN.RIGHT ? -indent : indent); + } + var styles = node.parentNode.parentNode.style; + node.parentNode.style.textAlign = styles.textAlign = values.indentalign; + // ### FIXME: make percentage widths respond to changes in container + if (shift) { + if (values.indentalign === 'right') node.style.marginRight = CHTML.Em(-shift); + shift *= CHTML.em/CHTML.outerEm; + HUB.Insert(styles,({ + left: {textIndent: CHTML.Em(shift)}, + right: {display: 'flex', flexDirection: 'row-reverse'}, + center: {textIndent: CHTML.Em(2*shift)} + })[values.indentalign]); + } + } + return node; + } + }); + + /********************************************************/ + + MML.mi.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node); + var bbox = this.CHTML, text = this.data.join(""); + if (bbox.skew != null && !CHTML.isChar(text)) delete bbox.skew; + if (bbox.r > bbox.w && CHTML.isChar(text) && !this.CHTMLvariant.noIC) { + bbox.ic = bbox.r - bbox.w; bbox.w = bbox.r; + node.lastChild.style.paddingRight = CHTML.Em(bbox.ic); + } + return node; + } + }); + + /********************************************************/ + + MML.mn.Augment({ + CHTMLremapMinus: function (text) {return text.replace(/^-/,"\u2212")}, + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node,{childOptions:{remap:this.CHTMLremapMinus}}); + var bbox = this.CHTML, text = this.data.join(""); + if (bbox.skew != null && !CHTML.isChar(text)) delete bbox.skew; + if (bbox.r > bbox.w && CHTML.isChar(text) && !this.CHTMLvariant.noIC) { + bbox.ic = bbox.r - bbox.w; bbox.w = bbox.r; + node.lastChild.style.paddingRight = CHTML.Em(bbox.ic); + } + return node; + } + }); + + /********************************************************/ + + MML.mo.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLgetVariant(); + this.CHTMLhandleScale(node); + CHTML.BBOX.empty(this.CHTML); + + var values = this.getValues("displaystyle","largeop"); + values.variant = this.CHTMLvariant; + values.text = this.data.join(""); + if (values.text == "") { + if (this.fence) node.style.width = CHTML.Em(CHTML.TEX.nulldelimiterspace); + } else { + this.CHTMLadjustAccent(values); + this.CHTMLadjustVariant(values); + + for (var i = 0, m = this.data.length; i < m; i++) { + this.CHTMLaddChild(node,i,{childOptions:{ + variant: values.mathvariant, + remap: this.remap, + remapchars: values.remapchars + }}); + } + if (!CHTML.isChar(values.text)) delete this.CHTML.skew; + else if (this.CHTML.w === 0 && this.CHTML.l < 0) this.CHTMLfixCombiningChar(node); + if (values.largeop) this.CHTMLcenterOp(node); + } + + this.CHTML.clean(); + this.CHTMLhandleBBox(node); + this.CHTMLhandleSpace(node); + this.CHTMLhandleColor(node); + + return node; + }, + CHTMLhandleSpace: function (node) { + if (this.hasMMLspacing()) { + var values = this.getValues("scriptlevel","lspace","rspace"); + values.lspace = Math.max(0,this.CHTMLlength2em(values.lspace)); + values.rspace = Math.max(0,this.CHTMLlength2em(values.rspace)); + if (values.scriptlevel > 0) { + if (!this.hasValue("lspace")) values.lspace = .15; + if (!this.hasValue("rspace")) values.rspace = .15; + } + var core = this, parent = this.Parent(); + while (parent && parent.isEmbellished() && parent.Core() === core) + {core = parent; parent = parent.Parent(); node = core.CHTMLnodeElement()} + if (values.lspace) node.style.paddingLeft = CHTML.Em(values.lspace); + if (values.rspace) node.style.paddingRight = CHTML.Em(values.rspace); + this.CHTML.L = values.lspace; this.CHTML.R = values.rspace; + } else { + this.SUPER(arguments).CHTMLhandleSpace.apply(this,arguments); + } + }, + CHTMLadjustAccent: function (data) { + var parent = this.CoreParent(); data.parent = parent; + if (CHTML.isChar(data.text) && parent && parent.isa(MML.munderover)) { + var over = parent.data[parent.over], under = parent.data[parent.under]; + if (over && this === over.CoreMO() && parent.Get("accent")) { + data.remapchars = CHTML.FONTDATA.REMAPACCENT; + } else if (under && this === under.CoreMO() && parent.Get("accentunder")) { + data.remapchars = CHTML.FONTDATA.REMAPACCENTUNDER; + } + } + }, + CHTMLadjustVariant: function (data) { + var parent = data.parent, + isScript = (parent && parent.isa(MML.msubsup) && this !== parent.data[parent.base]); + if (data.largeop) data.mathvariant = (data.displaystyle ? "-largeOp" : "-smallOp"); + if (isScript) { + data.remapchars = this.remapChars; + if (data.text.match(/['`"\u00B4\u2032-\u2037\u2057]/)) + data.mathvariant = "-TeX-variant"; // ### FIXME: handle other fonts + } + }, + CHTMLfixCombiningChar: function (node) { + // + // IE doesn't display combining chararacters unless they combine with + // something, so put them over a space and remove the space's width + // + node = node.firstChild; + var space = CHTML.Element("mjx-box",{style:{width:".25em","margin-left":"-.25em"}}); + node.insertBefore(space,node.firstChild); + }, + CHTMLcenterOp: function (node) { + var bbox = this.CHTML; + var p = (bbox.h - bbox.d)/2 - CHTML.TEX.axis_height; + if (Math.abs(p) > .001) node.style.verticalAlign = CHTML.Em(-p); + bbox.h -= p; bbox.d += p; + if (bbox.r > bbox.w) { + bbox.ic = bbox.r - bbox.w; bbox.w = bbox.r; + node.style.paddingRight = CHTML.Em(bbox.ic); + } + }, + CHTMLcanStretch: function (direction,H,D) { + if (!this.Get("stretchy")) return false; + var c = this.data.join(""); if (!CHTML.isChar(c)) return false; + var values = {text: c}; + this.CHTMLadjustAccent(values); + if (values.remapchars) c = values.remapchars[c]||c; + c = CHTML.FONTDATA.DELIMITERS[c.charCodeAt(0)]; + var stretch = (c && c.dir === direction.substr(0,1)); + if (stretch) { + stretch = (this.CHTML.h !== H || this.CHTML.d !== D || + !!this.Get("minsize",true) || !!this.Get("maxsize",true)); + if (stretch) this.CHTML.stretch = true; + } + return stretch; + }, + CHTMLstretchV: function (h,d) { + var node = this.CHTMLnodeElement(), bbox = this.CHTML; + var values = this.getValues("symmetric","maxsize","minsize"); + // + // Determine the height needed + // + var H, a = CHTML.TEX.axis_height; + if (values.symmetric) {H = 2*Math.max(h-a,d+a)} else {H = h + d} + values.maxsize = this.CHTMLlength2em(values.maxsize,bbox.h+bbox.d); + values.minsize = this.CHTMLlength2em(values.minsize,bbox.h+bbox.d); + H = Math.max(values.minsize,Math.min(values.maxsize,H)); + // + // If we are not already stretched to this height + // + if (H !== bbox.sH) { + // + // Get a delimiter of the proper height and save the height + // + if (H != values.minsize) + {H = [Math.max(H*CHTML.TEX.delimiterfactor/1000,H-CHTML.TEX.delimitershortfall),H]} + while (node.firstChild) node.removeChild(node.firstChild); + this.CHTML = bbox = CHTML.createDelimiter(node,this.data.join("").charCodeAt(0),H,bbox); + bbox.sH = (H instanceof Array ? H[1] : H); + // + // Reposition as needed + // + if (values.symmetric) {H = (bbox.h + bbox.d)/2 + a} + else {H = (bbox.h + bbox.d) * h/(h + d)} + H -= bbox.h; + if (Math.abs(H) > .05) { + node.style.verticalAlign = CHTML.Em(H); + bbox.h += H; bbox.d -= H; bbox.t += H; bbox.b -= H; + } + } + return this.CHTML; + }, + CHTMLstretchH: function (node,W) { + var bbox = this.CHTML; + var values = this.getValues("maxsize","minsize","mathvariant","fontweight"); + if ((values.fontweight === "bold" || (this.removedStyles||{}).fontWeight === "bold" || + parseInt(values.fontweight) >= 600) && !this.Get("mathvariant",true)) + values.mathvariant = MML.VARIANT.BOLD; + values.maxsize = this.CHTMLlength2em(values.maxsize,bbox.w); + values.minsize = this.CHTMLlength2em(values.minsize,bbox.w); + W = Math.max(values.minsize,Math.min(values.maxsize,W)); + if (W !== bbox.sW) { + while (node.firstChild) node.removeChild(node.firstChild); + this.CHTML = bbox = CHTML.createDelimiter(node,this.data.join("").charCodeAt(0),W,bbox,values.mathvariant); + bbox.sW = W; + } + return this.CHTML; + } + + }); + + /********************************************************/ + + MML.mtext.Augment({ + CHTMLgetVariant: function () { + if (CHTML.config.mtextFontInherit || this.Parent().type === "merror") { + var scale = (CHTML.config.scale/100)/CHTML.scale; + var variant = {cache:{}, fonts:[], className:"MJXc-font-inherit", rscale:scale, + style:{"font-size":CHTML.Percent(scale)}}; + var name = this.Get("mathvariant"); + if (name.match(/bold/)) variant.style["font-weight"] = "bold"; + if (name.match(/italic|-tex-mathit/)) variant.style["font-style"] = "italic"; + if (name === "monospace") variant.className += " MJXc-monospace-font"; + if (name === "double-struck") variant.className += " MJXc-double-struck-font"; + if (name.match(/fraktur/)) variant.className += " MJXc-fraktur-font"; + if (name.match(/sans-serif/)) variant.className += " MJXc-sans-serif-font"; + if (name.match(/script/)) variant.className += " MJXc-script-font"; + this.CHTMLvariant = variant; + } else { + this.SUPER(arguments).CHTMLgetVariant.call(this); + } + } + }); + + /********************************************************/ + + MML.merror.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node); + var bbox = this.CHTML; + // + // Adjust for font-size: 90% + // + bbox.rescale(.9); + // + // Adjust for padding and border + // + bbox.h += 3/CHTML.em; if (bbox.h > bbox.t) bbox.t = bbox.h; + bbox.d += 3/CHTML.em; if (bbox.d > bbox.b) bbox.b = bbox.d; + bbox.w += 8/CHTML.em; bbox.r = bbox.w; bbox.l = 0; + return node; + } + }); + + /********************************************************/ + + MML.mspace.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + var values = this.getValues("height","depth","width"); + var w = this.CHTMLlength2em(values.width), + h = this.CHTMLlength2em(values.height), + d = this.CHTMLlength2em(values.depth); + var bbox = this.CHTML; + bbox.w = bbox.r = w; bbox.h = bbox.t = h; bbox.d = bbox.b = d; bbox.l = 0; + if (w < 0) {node.style.marginRight = CHTML.Em(w); w = 0} + node.style.width = CHTML.Em(w); + node.style.height = CHTML.Em(Math.max(0,h+d)); + if (d) node.style.verticalAlign = CHTML.Em(-d); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + return node; + } + }); + + /********************************************************/ + + MML.mpadded.Augment({ + toCommonHTML: function (node,options) { + var child; + if (options && options.stretch) { + node = node.firstChild; child = node.firstChild; + } else { + node = this.CHTMLdefaultNode(node,{childNodes:"mjx-box", forceChild:true}); + child = node.firstChild; node = CHTML.addElement(node,"mjx-block"); + node.appendChild(child); CHTML.addElement(node,"mjx-strut"); // force proper alignment of short heights + } + var cbox = this.CHTMLbboxFor(0); + var values = this.getValues("width","height","depth","lspace","voffset"); + var x = 0, y = 0, w = cbox.w, h = cbox.h, d = cbox.d; + child.style.width = 0; child.style.margin = CHTML.Em(-h)+" 0 "+CHTML.Em(-d); + if (values.width !== "") w = this.CHTMLdimen(values.width,"w",w,0); + if (values.height !== "") h = this.CHTMLdimen(values.height,"h",h,0); + if (values.depth !== "") d = this.CHTMLdimen(values.depth,"d",d,0); + if (values.voffset !== "") { + y = this.CHTMLdimen(values.voffset); + if (y) { + child.style.position = "relative"; + child.style.top = CHTML.Em(-y); + } + } + if (values.lspace !== "") { + x = this.CHTMLdimen(values.lspace); + if (x) { + child.style.position = "relative"; + child.style.left = CHTML.Em(x); + } + } + node.style.width = 0; + node.style.marginTop = CHTML.Em(h-STRUTHEIGHT); + node.style.padding = "0 "+CHTML.Em(w)+" "+CHTML.Em(d)+" 0"; + var bbox = CHTML.BBOX({w:w, h:h, d:d, l:0, r:w, t:h, b:d, + scale:this.CHTML.scale, rscale:this.CHTML.rscale}); + bbox.combine(cbox,x,y); + bbox.w = w; bbox.h = h; bbox.d = d; + this.CHTML = bbox; + return node.parentNode; + }, + CHTMLstretchV: MML.mbase.CHTMLstretchV, + CHTMLstretchH: MML.mbase.CHTMLstretchH, + CHTMLdimen: function (length,d,D,m) { + if (m == null) {m = -BIGDIMEN} + length = String(length); + var match = length.match(/width|height|depth/); + var size = (match ? this.CHTML[match[0].charAt(0)] : (d ? this.CHTML[d] : 0)); + var dimen = (this.CHTMLlength2em(length,size)||0); + if (length.match(/^[-+]/) && D != null) dimen += D; + if (m != null) dimen = Math.max(m,dimen); + return dimen; + } + }); + + /********************************************************/ + + MML.munderover.Augment({ + toCommonHTML: function (node,options) { + var values = this.getValues("displaystyle","accent","accentunder","align"); + var base = this.data[this.base]; + if (!values.displaystyle && base != null && + (base.movablelimits || base.CoreMO().Get("movablelimits"))) + return MML.msubsup.prototype.toCommonHTML.call(this,node,stretch); + // + // Get the nodes for base and limits + // + var under, over, nodes = [], stretch = false; + if (options && options.stretch) { + if (this.data[this.base]) base = CHTML.getNode(node,"mjx-op"); + if (this.data[this.under]) under = CHTML.getNode(node,"mjx-under"); + if (this.data[this.over]) over = CHTML.getNode(node,"mjx-over"); + nodes[0] = base; nodes[1] = under||over; nodes[2] = over; + stretch = true; + } else { + var types = ["mjx-op","mjx-under","mjx-over"]; + if (this.over === 1) types[1] = types[2]; + node = this.CHTMLdefaultNode(node,{ + childNodes:types, noBBox:true, forceChild:true, minChildren: 2 + }); + nodes[0] = base = node.removeChild(node.firstChild); + nodes[1] = under = over = node.removeChild(node.firstChild); + if (node.firstChild) nodes[2] = over = node.removeChild(node.firstChild); + } + // + // Get the bounding boxes and the maximum width + // + var boxes = [], W = this.CHTMLgetBBoxes(boxes,nodes,values); + var bbox = boxes[this.base], BBOX = this.CHTML; + BBOX.w = W; BBOX.h = bbox.h; BBOX.d = bbox.d; // modified below + // + // Adjust for bases shorter than the center line (#1657) + // (the center line really depends on the surrounding font, so + // it should be measured along with ems and exs, but currently isn't. + // so this value is an approximation that is reasonable for most fonts.) + // + if (bbox.h < .35) base.style.marginTop = CHTML.Em(bbox.h - .35); + // + // Use a minimum height for accents (#1706) + // (same issues with the center line as above) + // + if (values.accent && bbox.h < CHTML.TEX.x_height) { + BBOX.h += CHTML.TEX.x_height - bbox.h; + base.style.marginTop = CHTML.Em(CHTML.TEX.x_height - Math.max(bbox.h,.35)); + bbox.h = CHTML.TEX.x_height; + } + // + // Add over- and under-scripts + // + var stack = base, delta = 0; + if (bbox.ic) {delta = 1.3*bbox.ic + .05} // make faked IC be closer to expeted results + if (this.data[this.over]) stack = this.CHTMLaddOverscript(over,boxes,values,delta,base,stretch); + if (this.data[this.under]) this.CHTMLaddUnderscript(under,boxes,values,delta,node,stack,stretch); + else if (!stretch) node.appendChild(stack); + // + // Handle horizontal positions + // + this.CHTMLplaceBoxes(base,under,over,values,boxes); + return node; + }, + // + // Get the bounding boxes for the children, stretch + // any stretchable elements, and compute the maximum width + // + CHTMLgetBBoxes: function (bbox,nodes,values) { + var i, m = this.data.length, scale, + w = -BIGDIMEN, // maximum width of non-stretchy items + W = w; // maximum width of all items + // + // Get the maximum width + // + for (i = 0; i < m; i++) { + bbox[i] = this.CHTMLbboxFor(i); bbox[i].x = bbox[i].y = 0; + if (this.data[i]) bbox[i].stretch = this.data[i].CHTMLcanStretch("Horizontal"); + scale = (i === this.base ? 1 : bbox[i].rscale); + if (i !== this.base) {delete bbox[i].L; delete bbox[i].R} // these are overridden by CSS + W = Math.max(W,scale*(bbox[i].w + (bbox[i].L||0) + (bbox[i].R||0))); + if (!bbox[i].stretch && W > w) w = W; + } + if (w === -BIGDIMEN) w = W; + // + // Stretch those parts that need it + // + for (i = 0; i < m; i++) { + if (bbox[i].stretch) { + scale = (i === this.base ? 1 : bbox[i].rscale); + bbox[i] = this.data[i].CHTMLstretchH(nodes[i].firstChild,w/scale); + bbox[i].x = bbox[i].y = 0; + W = Math.max(W,scale*(bbox[i].w + (bbox[i].L||0) + (bbox[i].R||0))); + } + } + if (!bbox[this.base]) bbox[this.base] = CHTML.BBOX.empty(); + return W; + }, + // + // Add an overscript + // + CHTMLaddOverscript: function (over,boxes,values,delta,base,stretch) { + var BBOX = this.CHTML; + var z1, z2, z3 = CHTML.TEX.big_op_spacing5, k; + var obox = boxes[this.over], bbox = boxes[this.base], scale = obox.rscale; + // + // Put the base and script into a stack + // + if (!stretch) { + var stack = CHTML.Element("mjx-stack"); + stack.appendChild(over); stack.appendChild(base); + } + if (obox.D) obox.d = obox.D; + if (obox.d < 0) { + // + // For negative depths, set the height and align to top + // in order to avoid extra baseline space + // + over.firstChild.style.verticalAlign = "top"; + over.style.height = CHTML.Em(obox.h+obox.d); + } + // + // Determine the spacing + // + obox.x = 0; + if (values.accent) { + if (obox.w < .001) obox.x += (obox.r - obox.l)/2; // center combining accents + k = CHTML.TEX.rule_thickness; z3 = 0; + if (bbox.skew) { + obox.x += scale*bbox.skew; BBOX.skew = scale*bbox.skew; + if (obox.x+scale*obox.w > BBOX.w) BBOX.skew += (BBOX.w - (obox.x+scale*obox.w))/2; + } + } else { + z1 = CHTML.TEX.big_op_spacing1; + z2 = CHTML.TEX.big_op_spacing3; + k = Math.max(z1,z2-Math.max(0,scale*obox.d)); + } + obox.x += delta/2; obox.y = BBOX.h + k + z3 + scale*obox.d; + // + // Position the overscript + // + if (k) over.style.paddingBottom = CHTML.Em(k/scale); + if (z3) over.style.paddingTop = CHTML.Em(z3/scale); + return stack; + }, + // + // Add an underscript + // + CHTMLaddUnderscript: function (under,boxes,values,delta,node,stack,stretch) { + var BBOX = this.CHTML; + var z1, z2, z3 = CHTML.TEX.big_op_spacing5, k; + var ubox = boxes[this.under], scale = ubox.rscale; + // + // Create a table for the underscript + // + if (!stretch) { + CHTML.addElement(node,"mjx-itable",{},[ + ["mjx-row",{},[["mjx-cell"]]], + ["mjx-row"] + ]); + node.firstChild.firstChild.firstChild.appendChild(stack); + node.firstChild.lastChild.appendChild(under); + } + if (ubox.D) ubox.d = ubox.D; + if (ubox.d < 0) { + // + // For negative depths, set the height and align to top + // in order to avoid extra baseline space + // + under.firstChild.style.verticalAlign = "top"; + node.firstChild.style.marginBottom = CHTML.Em(ubox.d); + } + // + // determine the spacing + // + if (values.accentunder) { + k = 2*CHTML.TEX.rule_thickness; z3 = 0; + } else { + z1 = CHTML.TEX.big_op_spacing2; + z2 = CHTML.TEX.big_op_spacing4; + k = Math.max(z1,z2-scale*ubox.h); + } + ubox.x = -delta/2; ubox.y = -(BBOX.d + k + z3 + scale*ubox.h); + // + // Position the underscript + // + if (k) under.style.paddingTop = CHTML.Em(k/scale); + if (z3) under.style.paddingBottom = CHTML.Em(z3/scale); + }, + // + // Center boxes horizontally, taking offsets into account + // + CHTMLplaceBoxes: function (base,under,over,values,boxes) { + var W = this.CHTML.w, i, m = boxes.length, scale; + var BBOX = CHTML.BBOX.zero(); + BBOX.scale = this.CHTML.scale; BBOX.rscale = this.CHTML.rscale; + boxes[this.base].x = boxes[this.base].y = 0; var dx = BIGDIMEN; + for (i = 0; i < m; i++) { + scale = (i === this.base ? 1 : boxes[i].rscale); + var w = scale*(boxes[i].w + (boxes[i].L||0) + (boxes[i].R||0)); + boxes[i].x += {left:0, center:(W-w)/2, right:W-w}[values.align]; + if (boxes[i].x < dx) dx = boxes[i].x; + } + for (i = 0; i < m; i++) { + if (this.data[i]) { + scale = (i === this.base ? 1 : boxes[i].rscale); + if (boxes[i].x - dx) { + var node = (i === this.base ? base : i === this.over ? over : under); + node.style.paddingLeft = CHTML.Em((boxes[i].x-dx)/scale); + } + BBOX.combine(boxes[i],boxes[i].x-dx,boxes[i].y); + } + } + this.CHTML = BBOX; + }, + CHTMLstretchV: MML.mbase.CHTMLstretchV, + CHTMLstretchH: MML.mbase.CHTMLstretchH, + CHTMLchildNode: function (node,i) { + var types = ["mjx-op","mjx-under","mjx-over"]; + if (this.over === 1) types[1] = types[2]; + return CHTML.getNode(node,types[i]); + } + }); + + /********************************************************/ + + MML.msubsup.Augment({ + toCommonHTML: function (node,options) { + var values = this.getValues( + "displaystyle","subscriptshift","superscriptshift","texprimestyle" + ); + // + // Get the nodes for base and limits + // + var base, sub, sup; + if (options && options.stretch) { + if (this.data[this.base]) base = CHTML.getNode(node,"mjx-base"); + if (this.data[this.sub]) sub = CHTML.getNode(node,"mjx-sub"); + if (this.data[this.sup]) sup = CHTML.getNode(node,"mjx-sup"); + stack = CHTML.getNode(node,"mjx-stack"); + } else { + var types = ["mjx-base","mjx-sub","mjx-sup"]; + if (this.sup === 1) types[1] = types[2]; + node = this.CHTMLdefaultNode(node,{ + childNodes:types, noBBox:true, forceChild:true, minChildren: 3 + }); + base = node.childNodes[this.base]; + sub = node.childNodes[this.sub]; sup = node.childNodes[this.sup]; + if (!this.CHTMLnotEmpty(this.data[this.sub])) {node.removeChild(sub); sub = null} + if (!this.CHTMLnotEmpty(this.data[this.sup])) {node.removeChild(sup); sup = null} + if (node.childNodes.length === 3) { + var stack = CHTML.addElement(node,"mjx-stack"); + stack.appendChild(sup); stack.appendChild(sub); + } + } + // + // Get the bounding boxes and maximum width of scripts + // + var boxes = [], BBOX = CHTML.BBOX.empty(this.CHTML); + for (var i = 0, m = this.data.length; i < m; i++) boxes[i] = this.CHTMLbboxFor(i); + var bbox = boxes[this.base] || CHTML.BBOX.empty(), + sbox = boxes[this.sub], Sbox = boxes[this.sup]; + var sscale = (sub ? sbox.rscale : 1), Sscale = (sup ? Sbox.rscale : 1); + BBOX.combine(bbox,0,0); + // + // Get initial values for parameters + // + var ex = CHTML.TEX.x_height, s = CHTML.TEX.scriptspace; + var q = CHTML.TEX.sup_drop * Sscale, r = CHTML.TEX.sub_drop * sscale; + var u = bbox.h - q, v = bbox.d + r, delta = 0, p; + if (bbox.ic) { + BBOX.w -= bbox.ic; // remove IC (added by mo and mi) + base.style.marginRight = CHTML.Em(-bbox.ic); + delta = 1.3*bbox.ic + .05; // make faked IC be closer to expeted results + } + var bmml = this.data[this.base]; + if (bmml) { + if ((bmml.type === "mrow" || bmml.type === "mstyle") && bmml.data.length === 1) bmml = bmml.data[0]; + if (bmml.type === "mi" || bmml.type === "mo") { + if (CHTML.isChar(bmml.data.join("")) && bbox.rscale === 1 && !bbox.sH && + !bmml.Get("largeop")) {u = v = 0} + } + } + values.subscriptshift = (values.subscriptshift === "" ? 0 : this.CHTMLlength2em(values.subscriptshift)); + values.superscriptshift = (values.superscriptshift === "" ? 0 : this.CHTMLlength2em(values.superscriptshift)); + // + // Add the super- and subscripts + // + var x = BBOX.w; if (sub) sbox.w += s; if (sup) Sbox.w += s; + if (!sup) { + if (sub) { + v = Math.max(v,CHTML.TEX.sub1,sscale*sbox.h-(4/5)*ex,values.subscriptshift); + sub.style.verticalAlign = CHTML.Em(-v/sscale); + sub.style.paddingRight = CHTML.Em(s/sscale); + BBOX.combine(sbox,x,-v); + } + } else { + if (!sub) { + p = CHTML.TEX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))]; + u = Math.max(u,p,Sscale*Sbox.d+(1/4)*ex,values.superscriptshift); + sup.style.verticalAlign = CHTML.Em(u/Sscale); + sup.style.paddingLeft = CHTML.Em(delta/Sscale); + sup.style.paddingRight = CHTML.Em(s/Sscale); + BBOX.combine(Sbox,x+delta,u); + } else { + v = Math.max(v,CHTML.TEX.sub2); + var t = CHTML.TEX.rule_thickness; + if ((u - Sscale*Sbox.d) - (sscale*sbox.h - v) < 3*t) { + v = 3*t - u + Sscale*Sbox.d + sscale*sbox.h; + q = (4/5)*ex - (u - Sscale*Sbox.d); + if (q > 0) {u += q; v -= q} + } + u = Math.max(u,values.superscriptshift); + v = Math.max(v,values.subscriptshift); + sub.style.paddingRight = CHTML.Em(s/sscale); + sup.style.paddingBottom = CHTML.Em(u/Sscale+v/sscale-Sbox.d-sbox.h/sscale*Sscale); + sup.style.paddingLeft = CHTML.Em(delta/Sscale); + sup.style.paddingRight = CHTML.Em(s/Sscale); + stack.style.verticalAlign = CHTML.Em(-v); + BBOX.combine(Sbox,x+delta,u); + BBOX.combine(sbox,x,-v); + } + } + BBOX.clean(); + return node; + }, + CHTMLstretchV: MML.mbase.CHTMLstretchV, + CHTMLstretchH: MML.mbase.CHTMLstretchH, + CHTMLchildNode: function (node,i) { + var types = ["mjx-base","mjx-sub","mjx-sup"]; + if (this.over === 1) types[1] = types[2]; + return CHTML.getNode(node,types[i]); + } + }); + + /********************************************************/ + + MML.mfrac.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node,{ + childNodes:["mjx-numerator","mjx-denominator"], + childOptions: {autowidth: true}, + forceChild:true, noBBox:true, minChildren:2 + }); + var values = this.getValues("linethickness","displaystyle", + "numalign","denomalign","bevelled"); + var isDisplay = values.displaystyle; + // + // Create the table for the fraction and set the alignment + // + var num = node.firstChild, denom = node.lastChild; + var frac = CHTML.addElement(node,"mjx-box"); + frac.appendChild(num); frac.appendChild(denom); node.appendChild(frac); + if (values.numalign !== "center") num.style.textAlign = values.numalign; + if (values.denomalign !== "center") denom.style.textAlign = values.denomalign; + // + // Get the bounding boxes for the parts, and determine the placement + // of the numerator and denominator + // + var nbox = this.CHTMLbboxFor(0), dbox = this.CHTMLbboxFor(1), + BBOX = CHTML.BBOX.empty(this.CHTML), nscale = nbox.rscale, dscale = dbox.rscale; + values.linethickness = Math.max(0,CHTML.thickness2em(values.linethickness||"0",BBOX.scale)); + var mt = CHTML.TEX.min_rule_thickness/CHTML.em, a = CHTML.TEX.axis_height; + var t = values.linethickness, p,q, u,v; + if (values.bevelled) { + frac.className += " MJXc-bevelled"; + var delta = (isDisplay ? .4 : .15); + var H = Math.max(nscale*(nbox.h+nbox.d),dscale*(dbox.h+dbox.d)) + 2*delta; + var bevel = CHTML.Element("mjx-bevel"); frac.insertBefore(bevel,denom); + var bbox = CHTML.createDelimiter(bevel,0x2F,H); + u = nscale*(nbox.d-nbox.h)/2+a+delta; + v = dscale*(dbox.d-dbox.h)/2+a-delta; + if (u) num.style.verticalAlign = CHTML.Em(u/nscale); + if (v) denom.style.verticalAlign = CHTML.Em(v/dscale); + bevel.style.marginLeft = bevel.style.marginRight = CHTML.Em(-delta/2); + BBOX.combine(nbox,0,u); + BBOX.combine(bbox,nscale*nbox.w-delta/2,0); + BBOX.combine(dbox,nscale*nbox.w+bbox.w-delta,v); + BBOX.clean(); + } else { + frac.className += " MJXc-stacked"; + if (isDisplay) {u = CHTML.TEX.num1; v = CHTML.TEX.denom1} + else {u = (t === 0 ? CHTML.TEX.num3 : CHTML.TEX.num2); v = CHTML.TEX.denom2} + if (t === 0) { // \atop + p = Math.max((isDisplay ? 7 : 3) * CHTML.TEX.rule_thickness, 2*mt); // force to at least 2 px + q = (u - nbox.d*nscale) - (dbox.h*dscale - v); + if (q < p) {u += (p - q)/2; v += (p - q)/2} + } else { // \over + p = Math.max((isDisplay ? 2 : 0) * mt + t, t/2 + 1.5*mt); + t = Math.max(t,mt); + q = (u - nbox.d*nscale) - (a + t/2); if (q < p) u += (p - q); + q = (a - t/2) - (dbox.h*dscale - v); if (q < p) v += (p - q); + nbox.L = nbox.R = dbox.L = dbox.R = .1; // account for padding in BBOX width + var rule = CHTML.addElement(frac,"mjx-line",{style: { + "border-bottom":CHTML.Px(t*BBOX.scale,1)+" solid", top: CHTML.Em(-t/2-a) + }}); + } + // + // Determine the new bounding box and place the parts + // + BBOX.combine(nbox,0,u); + BBOX.combine(dbox,0,-v); + BBOX.clean(); + // + // Force elements to the correct width + // + frac.style.width = CHTML.Em(BBOX.w); + num.style.width = CHTML.Em(BBOX.w/nscale); + denom.style.width = CHTML.Em(BBOX.w/dscale); + if (rule) rule.style.width = frac.style.width; + // + // Place the numerator and denominator in relation to the baseline + // + num.style.top = CHTML.Em(-BBOX.h/nscale); + denom.style.bottom = CHTML.Em(-BBOX.d/dscale); + // + // Force the size of the surrounding box, since everything is absolutely positioned + // + CHTML.addElement(node,"mjx-vsize",{style: { + height: CHTML.Em(BBOX.h+BBOX.d), verticalAlign: CHTML.Em(-BBOX.d) + }}); + } + // + // Add nulldelimiterspace around the fraction + // (TeXBook pg 150 and Appendix G rule 15e) + // + if (!this.texWithDelims) { + var space = CHTML.TEX.nulldelimiterspace; + frac.style.padding = "0 "+CHTML.Em(space); + BBOX.l += space; BBOX.r += space; BBOX.w += 2*space; + } + // + // Return the completed fraction + // + return node; + }, + CHTMLcanStretch: function (direction) {return false} + }); + + /********************************************************/ + + MML.msqrt.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLdefaultNode(node,{ + childNodes:["mjx-box","mjx-root"], forceChild:true, noBBox:true + }); + var base = node.firstChild || CHTML.Element("mjx-box"); + var sqrt = CHTML.addElement(node,"mjx-box"); sqrt.appendChild(base); + var bbox = this.CHTMLbboxFor(0), BBOX = CHTML.BBOX.empty(this.CHTML); + var t = CHTML.TEX.rule_thickness, T = CHTML.TEX.surd_height, p = t, q, H; + if (this.Get("displaystyle")) p = CHTML.TEX.x_height; + q = t + p/4; + H = bbox.h + bbox.d + q + t; + var surd = CHTML.Element("mjx-surd"); sqrt.insertBefore(surd,base); + var sbox = CHTML.createDelimiter(surd,0x221A,[H-.04,H]); + if (sbox.h + sbox.d > H) q = ((sbox.h+sbox.d) - (H-t))/2; + H = bbox.h + q + t; + var x = this.CHTMLaddRoot(node,sbox,sbox.h+sbox.d-H); + base.style.paddingTop = CHTML.Em(q); + base.style.borderTop = CHTML.Px(T*bbox.scale,1)+" solid"; + sqrt.style.paddingTop = CHTML.Em(2*t-T); // use wider line, but don't affect height + bbox.h += q + 2*t; + BBOX.combine(sbox,x,H-sbox.h); + BBOX.combine(bbox,x+sbox.w,0); + BBOX.clean(); + return node; + }, + CHTMLaddRoot: function () {return 0}, + CHTMLhandleBBox: function (node) { + var bbox = this.CHTMLbboxFor(0); + delete bbox.pwidth; + this.SUPER(arguments).CHTMLhandleBBox.apply(this,arguments); + } + }); + + /********************************************************/ + + MML.mroot.Augment({ + toCommonHTML: MML.msqrt.prototype.toCommonHTML, + CHTMLhandleBBox: MML.msqrt.prototype.CHTMLhandleBBox, + CHTMLaddRoot: function (sqrt,sbox,d) { + if (!this.data[1]) return; + var BBOX = this.CHTML, bbox = this.data[1].CHTML, root = sqrt.firstChild; + var scale = bbox.rscale; + var h = this.CHTMLrootHeight(bbox,sbox,BBOX.scale)-d; + var w = Math.min(bbox.w,bbox.r); // remove extra right-hand padding, if any + var dx = Math.max(w,sbox.offset/scale); + if (h) root.style.verticalAlign = CHTML.Em(h/scale); + if (dx > w) root.firstChild.style.paddingLeft = CHTML.Em(dx-w); + dx -= sbox.offset/scale; + root.style.width = CHTML.Em(dx); + BBOX.combine(bbox,0,h); + return dx*scale; + }, + CHTMLrootHeight: function (bbox,sbox,scale) { + return .45*(sbox.h+sbox.d-.9*scale) + .6*scale + Math.max(0,bbox.d*bbox.scale-.075); + } + }); + + /********************************************************/ + + MML.mfenced.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLcreateNode(node); + this.CHTMLhandleStyle(node); + this.CHTMLhandleScale(node); + // + // Make row of open, data, sep, ... data, close + // + this.CHTMLaddChild(node,"open",{}); + for (var i = 0, m = this.data.length; i < m; i++) { + this.CHTMLaddChild(node,"sep"+i,{}); + this.CHTMLaddChild(node,i,{}); + } + this.CHTMLaddChild(node,"close",{}); + // + // Check for stretching the elements + // + var H = this.CHTML.h, D = this.CHTML.d; + this.CHTMLstretchChildV("open",H,D); + for (i = 0, m = this.data.length; i < m; i++) { + this.CHTMLstretchChildV("sep"+i,H,D); + this.CHTMLstretchChildV(i,H,D); + } + this.CHTMLstretchChildV("close",H,D); + this.CHTMLhandleSpace(node); + this.CHTMLhandleBBox(node); + this.CHTMLhandleColor(node); + return node; + } + }); + + /********************************************************/ + + MML.mrow.Augment({ + toCommonHTML: function (node,options) { + options = options || {}; + node = this.CHTMLdefaultNode(node); + var bbox = this.CHTML, H = bbox.h, D = bbox.d, hasNegative; + for (var i = 0, m = this.data.length; i < m; i++) { + this.CHTMLstretchChildV(i,H,D); + if (this.data[i] && this.data[i].CHTML && this.data[i].CHTML.w < 0) hasNegative = true; + } + if (this.CHTMLlineBreaks()) { + this.CHTMLmultiline(node); + if (options.autowidth) node.style.width = ""; + } else { + if (hasNegative && bbox.w) node.style.width = CHTML.Em(Math.max(0,bbox.w)); + if (bbox.w < 0) node.style.marginRight = CHTML.Em(bbox.w); + } + return node; + }, + CHTMLlineBreaks: function () { + if (!this.parent.linebreakContainer) return false; + return (LINEBREAKS.automatic && this.CHTML.w > CHTML.linebreakWidth) || this.hasNewline(); + }, + CHTMLstretchV: function (h,d) { + this.CHTMLstretchChildV(this.CoreIndex(),h,d); + return this.CHTML; + }, + CHTMLstretchH: function (node,w) { + this.CHTMLstretchChildH(this.CoreIndex(),w,node); + return this.CHTML; + } + }); + + /********************************************************/ + + MML.TeXAtom.Augment({ + toCommonHTML: function (node,options) { + if (!options || !options.stretch) node = this.CHTMLdefaultNode(node); + if (this.texClass === MML.TEXCLASS.VCENTER) { + var a = CHTML.TEX.axis_height, BBOX = this.CHTML; + var v = a-(BBOX.h+BBOX.d)/2+BBOX.d; + if (Math.abs(v) > .001) { + node.style.verticalAlign = CHTML.Em(v); + BBOX.h += v; BBOX.t += v; BBOX.d -= v; BBOX.b -= v; + } + } + return node; + }, + CHTMLstretchV: function (h,d) { + this.CHTMLupdateFrom(this.Core().CHTMLstretchV(h,d)); + this.toCommonHTML(this.CHTMLnodeElement(),{stretch:true}); + return this.CHTML; + }, + CHTMLstretchH: function (node,w) { + this.CHTMLupdateFrom(this.CHTMLstretchCoreH(node,w)); + this.toCommonHTML(node,{stretch:true}); + return this.CHTML; + } + }); + + /********************************************************/ + + MML.semantics.Augment({ + toCommonHTML: function (node) { + node = this.CHTMLcreateNode(node); + if (this.data[0]) { + this.data[0].toCommonHTML(node); + this.CHTMLupdateFrom(this.data[0].CHTML); + this.CHTMLhandleBBox(node); + } + return node; + } + }); + MML.annotation.Augment({toCommonHTML: function(node) {return this.CHTMLcreateNode(node)}}); + MML["annotation-xml"].Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + + /********************************************************/ + + MML.ms.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + MML.mglyph.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + MML.menclose.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + MML.maction.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + MML.mmultiscripts.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + MML.mtable.Augment({toCommonHTML: MML.mbase.CHTMLautoload}); + + /********************************************************/ + + // + // Loading isn't complete until the element jax is modified, + // but can't call loadComplete within the callback for "mml Jax Ready" + // (it would call CommonHTML's Require routine, asking for the mml jax again) + // so wait until after the mml jax has finished processing. + // + // We also need to wait for the onload handler to run, since the loadComplete + // will call Config and Startup, which need to modify the body. + // + MathJax.Hub.Register.StartupHook("onLoad",function () { + setTimeout(MathJax.Callback(["loadComplete",CHTML,"jax.js"]),0); + }); + }); + + MathJax.Hub.Register.StartupHook("End Cookie", function () { + if (HUB.config.menuSettings.zoom !== "None") + {AJAX.Require("[MathJax]/extensions/MathZoom.js")} + }); + +})(MathJax.Ajax,MathJax.Hub,MathJax.HTML,MathJax.OutputJax.CommonHTML); +// @license-end diff --git a/js/mathjax/jax/output/NativeMML/config.js b/js/mathjax/jax/output/NativeMML/config.js new file mode 100644 index 0000000..a0f7480 --- /dev/null +++ b/js/mathjax/jax/output/NativeMML/config.js @@ -0,0 +1,54 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/NativeMML/config.js + * + * Initializes the NativeMML OutputJax (the main definition is in + * MathJax/jax/input/NativeMML/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.OutputJax.NativeMML = MathJax.OutputJax({ + id: "NativeMML", + version: "2.7.9", + directory: MathJax.OutputJax.directory + "/NativeMML", + extensionDir: MathJax.OutputJax.extensionDir + "/NativeMML", + + config: { + matchFontHeight: true, // try to match math font height to surrounding font? + scale: 100, // scaling factor for all math + minScaleAdjust: 50, // minimum scaling to adjust to surrounding text + // (since the code for that is a bit delicate) + + styles: { + "div.MathJax_MathML": { + "text-align": "center", + margin: ".75em 0px" + } + } + } +}); + +if (!MathJax.Hub.config.delayJaxRegistration) + MathJax.OutputJax.NativeMML.Register("jax/mml"); + +MathJax.OutputJax.NativeMML.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/output/NativeMML/jax.js b/js/mathjax/jax/output/NativeMML/jax.js new file mode 100644 index 0000000..75da9f5 --- /dev/null +++ b/js/mathjax/jax/output/NativeMML/jax.js @@ -0,0 +1,1433 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/NativeMML/jax.js + * + * Implements the NativeMML OutputJax that displays mathematics + * using a browser's native MathML capabilities (if any). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2010-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function (nMML,HUB,AJAX,HTML) { + var MML, isMSIE = HUB.Browser.isMSIE; + + var EVENT, TOUCH, HOVER, ZOOM; // filled in later + + HUB.Register.StartupHook("MathZoom Ready",function () {ZOOM = MathJax.Extension.MathZoom}); + + var NOPADDING = function (side,obj) { + var span = HTML.Element("span"); side = "padding"+side; + if (obj) { + span.style.cssText = (obj.getAttribute("style")||""); + if (span.style.padding === "" && (span.style[side]||"") === "") { + span.style[side] = "0px"; obj.setAttribute("style",span.style.cssText) + } + } + }; + + var CELLSPACING = function (obj,rowSpacing,columnSpacing) { + // + // Webkit default padding on mtd cells is simply + // + // mtd {padding: 0.5ex;} + // + // Gecko default padding on mtd cells is + // + // mtd {padding-right: 0.4em; + // padding-left: 0.4em; + // padding-bottom: 0.5ex; + // padding-top: 0.5ex;} + // mtr:first-child > mtd {padding-top: 0ex;} + // mtr:last-child > mtd {padding-bottom: 0ex;} + // mtd:first-child {padding-left: 0em;} + // mtd:last-child {padding-right: 0em;} + // + // that is the columnspacing/rowspacing is split into two adjacent cells, + // and the periphery of boundary cells is set to zero. + // + // Here, we will set the left/top padding of each cell to + // rowSpacing/columnSpacing (or 0px for the leftmost/topmost cells) and + // reset the right/bottom padding to zero. + // + if (obj) { + var span = HTML.Element("span"); + span.style.cssText = (obj.getAttribute("style")||""); + if (span.style.padding === "") { + var padding = { paddingLeft: columnSpacing, paddingTop: rowSpacing, + paddingRight: "0px", paddingBottom: "0px" }; + for (var side in padding) {if (padding.hasOwnProperty(side)) { + if ((span.style[side]||"") === "") {span.style[side] = padding[side];} + }} + } + obj.setAttribute("style",span.style.cssText); + } + }; + + nMML.Augment({ + // + // User can configure styles + // + config: { + styles: { + ".MathJax_MathML": { + "font-style": "normal", + "font-weight": "normal", + "line-height": "normal", + "font-size": "100%", + "font-size-adjust":"none", + "text-indent": 0, + "text-align": "left", + "text-transform": "none", + "letter-spacing": "normal", + "word-spacing": "normal", + "word-wrap": "normal", + "white-space": "nowrap", + "float": "none", + "direction": "ltr", + "max-width": "none", "max-height": "none", + "min-width": 0, "min-height": 0, + border: 0, padding: 0, margin: 0 + }, + + "span.MathJax_MathML": { + display: "inline!important" + }, + + "div.MathJax_MathML": { + display: "block!important" + }, + + ".MathJax_mmlExBox": { + display:"block!important", overflow:"hidden", + height:"1px", width:"60ex", + "min-height": 0, "max-height":"none", + padding:0, border: 0, margin: 0 + } + } + }, + handlesVariants: false, // true if native support for mathvariants + settings: HUB.config.menuSettings, + ex: 1, scale: 1, // filled in later + adjustWidths: [], // array of elements to have their widths adjusted + + Config: function () { + this.SUPER(arguments).Config.call(this); + if (this.settings.scale) {this.config.scale = this.settings.scale} + // + // Insert styling to take account of displayAlign and displayIndent + // + if (HUB.config.displayAlign !== "center") { + var align = HUB.config.displayAlign, indent = HUB.config.displayIndent; + var def = {"text-align": align+"!important"}; def["margin-"+align] = indent+"!important"; + HUB.Insert(this.config.styles,{ + "div.MathJax_MathML": def, + "div.MathJax_MathML math": {"text-align": align}, + "div.MathJax_MathContainer > span": {"text-align": align+"!important"} + }); + } + if (!this.require) {this.require = []} + this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js"); + }, + Startup: function () { + // Set up event handling + EVENT = MathJax.Extension.MathEvents.Event; + TOUCH = MathJax.Extension.MathEvents.Touch; + HOVER = MathJax.Extension.MathEvents.Hover; + this.ContextMenu = EVENT.ContextMenu; + this.Mousedown = EVENT.AltContextMenu; + this.Mouseover = HOVER.Mouseover; + this.Mouseout = HOVER.Mouseout; + this.Mousemove = HOVER.Mousemove; + + if (!HUB.Browser.hasMathPlayer) { + // Used in preTranslate to get scaling factors + this.EmExSpan = HTML.Element("span", + {style:{position:"absolute","font-size-adjust":"none"}}, + [ + ["div",{className:"MathJax_mmlExBox"}], + ["span",{className:"MathJax_MathML"}] + ] + ); + MML.math(MML.mspace().With({width:"60ex"})).toNativeMML(this.EmExSpan.lastChild); + } + + // Set up styles + return AJAX.Styles(this.config.styles); + }, + // + // Set up MathPlayer for IE on the first time through. + // Get the ex and em sizes. + // + InitializeMML: function () { + this.initialized = true; + if (HUB.Browser.hasMathPlayer) { + try { + // + // Insert data needed to use MathPlayer for MathML output + // + if (!HUB.Browser.mpNamespace) { + var mathplayer = document.createElement("object"); + mathplayer.id = "mathplayer"; mathplayer.classid = "clsid:32F66A20-7614-11D4-BD11-00104BD3F987"; + document.getElementsByTagName("head")[0].appendChild(mathplayer); + document.namespaces.add("m","http://www.w3.org/1998/Math/MathML"); + HUB.Browser.mpNamespace = true; + } + if (!HUB.Browser.mpImported) { + document.namespaces.m.doImport("#mathplayer"); + HUB.Browser.mpImported = true; + } + } catch (err) { + // + // If that fails, give an alert about security settings + // + if (!this.config.noMathPlayerWarning) { + alert(MathJax.Localization._(["MathML", "MathPlayer"], + "MathJax was not able to set up MathPlayer.\n\n"+ + "If MathPlayer is not installed, you need to install it first.\n"+ + "Otherwise, your security settings may be preventing ActiveX \n"+ + "controls from running. Use the Internet Options item under\n"+ + "the Tools menu and select the Security tab, then press the\n"+ + "Custom Level button. Check that the settings for\n"+ + "'Run ActiveX Controls', and 'Binary and script behaviors'\n"+ + "are enabled.\n\n"+ + "Currently you will see error messages rather than\n"+ + "typeset mathematics.")); + } + } + } else { + // + // Get the default sizes (need styles in place to do this) + // + document.body.appendChild(this.EmExSpan); + this.defaultEx = this.EmExSpan.firstChild.offsetWidth/60; + this.defaultMEx = this.EmExSpan.lastChild.offsetWidth/60; + document.body.removeChild(this.EmExSpan); + } + }, + + preTranslate: function (state) { + var scripts = state.jax[this.id], i, m = scripts.length, + script, prev, span, test, math, jax, ex, mex, scale; + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + if (!this.initialized) {this.InitializeMML()} + // + // Remove any existing output + // + prev = script.previousSibling; + if (prev && prev.className === "MathJax_MathML") {prev.parentNode.removeChild(prev)} + // + // Add the MathJax span + // + jax = script.MathJax.elementJax; if (!jax) continue; + math = jax.root; jax.NativeMML = {}; + var type = (math.Get("display") === "block" ? "div" : "span"); + span = HTML.Element(type,{ + className: "MathJax_MathML", id:jax.inputID+"-Frame" + },[["span",{ + className:"MathJax_MathContainer", isMathJax: true, jaxID:this.id, + style:{position:"relative", display:"inline-block", "white-space":"nowrap"} + }, [["span",{isMathJax:true, style:{display:"inline-block"}}]] // for Firefox hover and zoom + ]]); + script.parentNode.insertBefore(span,script); + // + // Add the test span for determining scales + // + if (!isMSIE) {script.parentNode.insertBefore(this.EmExSpan.cloneNode(true),script)} + } + // + // Determine the scaling factors for each script + // (this only requires one reflow rather than a reflow for each equation) + // + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + jax = script.MathJax.elementJax; if (!jax) continue; + if (!isMSIE) { + test = script.previousSibling; + ex = test.firstChild.offsetWidth/60; + mex = test.lastChild.offsetWidth/60; + if (ex === 0 || ex === "NaN") {ex = this.defaultEx; mex = this.defaultMEx} + scale = (this.config.matchFontHeight && mex > 1 ? ex/mex : 1); + scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale) * this.config.scale); + jax.NativeMML.ex = ex; jax.NativeMML.mex = mex; + } else {scale = 100} + jax.NativeMML.fontSize = scale+"%"; + jax.NativeMML.scale = scale/100; + } + // + // Remove the test spans used for determining scales + // + if (!isMSIE) { + for (i = 0; i < m; i++) { + script = scripts[i]; + if (script.parentNode && script.MathJax.elementJax) { + script.parentNode.removeChild(script.previousSibling); + } + } + } + }, + + // + // Add a SPAN to use as a container, and render the math into it + // + Translate: function (script) { + if (!script.parentNode) return; + // + // Get the jax and the container and set the size + // + var jax = script.MathJax.elementJax, math = jax.root; + var span = document.getElementById(jax.inputID+"-Frame"); if (!span) return; + var container = span.firstChild, mspan = container.firstChild; + this.ex = jax.NativeMML.ex || this.defaultEx; + this.scale = jax.NativeMML.scale || 1; + if (this.scale !== 1) {span.style.fontSize = jax.NativeMML.fontSize} + // + // Convert to MathML (if restarted, remove any partial math) + // + try {math.toNativeMML(mspan,jax)} catch (err) { + if (err.restart) {while (mspan.firstChild) {mspan.removeChild(mspan.firstChild)}} + throw err; + } + // + // Add event handlers + // + if (isMSIE) { + if (container.addEventListener) { + for (var id in this.MSIE9events) {if (this.MSIE9events.hasOwnProperty(id)) { + container.addEventListener(id,this.MSIE9event,true); + }} + } else { + var config = (this.config.showMathMenuMSIE != null ? this : HUB).config; + if (config.showMathMenuMSIE && !this.settings.mpContext && !this.settings.mpMouse) + {this.MSIEoverlay(container)} else + {container.style.position = ""; mspan.firstChild.onmousedown = this.MSIEaltMenu} + } + } else { + container.oncontextmenu = EVENT.Menu; + container.onmouseover = EVENT.Mouseover; + container.onmouseout = EVENT.Mouseout; + container.onmousedown = EVENT.Mousedown; + container.onclick = EVENT.Click; + container.ondblclick = EVENT.DblClick; + // Added for keyboard accessible menu. + container.onkeydown = EVENT.Keydown; + container.tabIndex = HUB.getTabOrder(jax); + if (HUB.Browser.noContextMenu) { + container.ontouchstart = TOUCH.start; + container.ontouchend = TOUCH.end; + } + } + }, + + postTranslate: function (state) { + if (this.forceReflow) { + // + // Firefox messes up some mtable's when they are dynamically created + // but gets them right on a reflow, so force reflow by toggling a stylesheet + // + var sheet = (document.styleSheets||[])[0]||{}; + sheet.disabled = true; sheet.disabled = false; + } + }, + + // + // Remove MathML preceding the script + // + Remove: function (jax) { + var span = jax.SourceElement(); if (!span) return; + span = span.previousSibling; if (!span) return; + if (span.className.match(/MathJax_MathML/)) {span.parentNode.removeChild(span)} + }, + // + // The namespace to use for MML + // + MMLnamespace: "http://www.w3.org/1998/Math/MathML", + + isFullWidth: function (node) { + if (!node) return; + var width = node.getAttribute("width") || + (String(node.getAttribute("style")).match(/(?:^| )width: *([^; ]*)/)||[])[1]; + if (width) return !!width.match(/%/); + if (node.nodeName.match(/^(semantics|math|mstyle)$/)) { + width = this.isFullWidth(node.firstChild); + } else if (node.nodeName.toLowerCase() === "mrow") { + for (var i = 0, m = node.childNodes.length; i < m && !width; i++) + width = this.isFullWidth(node.childNodes[i]); + } + if (width) { + var style = "width:100%; "+(node.getAttribute("style")||""); + node.setAttribute("style",style.replace(/ +$/,"")); + } + return width; + }, + + // + // For MSIE, we must overlay the MathPlayer object to trap the events + // (since they can't be cancelled when the events are on the tag + // itself). The events we DON'T want are transferred to the math element, + // and the others are handled directly. + // + MSIEoverlay: function (span) { + var math = span.firstChild; + if (math.nodeName.toLowerCase() === "span") {math = math.firstChild} + var bbox = this.getHoverBBox(null,math,{}); + HTML.addElement(span,"span",{ + style:{display:"inline-block", width:0, height:0, position:"relative"} + },[["span",{isMathJax: true, className: "MathJax_MathPlayer_Overlay", + style:{ + display:"inline-block", position:"absolute", + left:HOVER.Px(-bbox.w), top:HOVER.Px(-bbox.h-(bbox.y||0)-1), + width:HOVER.Px(bbox.w), height:HOVER.Px(bbox.h+bbox.d), cursor:"pointer", + "background-color":"white", filter:"alpha(opacity=0)" + } + }]]); + HUB.Insert(span,{ + msieMath: math, + onmousedown: this.MSIEevent, oncontextmenu: this.MSIEevent, onclick: this.MSIEevent, + onmouseup: this.MSIEevent, onmousemove: this.MSIEevent, ondblclick: this.MSIEevent, + onmouseover: this.MSIEevent, onmouseout: this.MSIEevent + }); + }, + MSIEevents: { + mousedown:"Mousedown", contextmenu:"ContextMenu", click:"Click", + mouseup:"Mouseup", mousemove:"Mousemove", dblclick: "DblClick", + mouseover:"Mouseover", mouseout:"Mouseout" + }, + MSIEevent: function () { + var event = window.event; + var type = nMML.MSIEevents[event.type]; + if (nMML[type] && nMML[type](event,this) === false) {return false} + if (ZOOM && ZOOM.HandleEvent(event,type,this) === false) {return false} + if (event.srcElement.className === "MathJax_MathPlayer_Overlay" && this.msieMath.fireEvent) { + // + // For now, ignore all other events. This will disable MathPlayer's zoom + // feature, but also its support. + // + if (type === "ContextMenu" || type === "Mouseover" || type === "Mouseout") + {this.msieMath.fireEvent("on"+event.type,event)} + } + return EVENT.False(event); + }, + MSIEaltMenu: function () { + var container = this.parentNode.parentNode; + while (!container.jaxID) {container = container.parentNode} + EVENT.AltContextMenu(window.event,container); + }, + + MSIE9events: { + contextmenu:"Menu", click:"Click", dblclick: "DblClick", + mouseup:"False", mouseover:"Mouseover", mouseout:"Mouseout" + }, + MSIE9event: function (event) { + if (event.type === "contextmenu" && nMML.settings.mpContext) {return true} + if (event.type === "mouseup" && nMML.settings.mpMouse) {return true} + if (event.type === "click" && nMML.settings.mpContext) + {return EVENT.AltContextMenu(event,this)} + var type = nMML.MSIE9events[event.type]; + return EVENT[type].call(this,event); + }, + + getJaxFromMath: function (math) { + math = math.parentNode; + do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); + return HUB.getJaxFor(math); + }, + getHoverSpan: function (jax,math) {return math.firstChild}, + getHoverBBox: function (jax,span,math) {return EVENT.getBBox(span.parentNode)}, + + Zoom: function (jax,span,math,Mw,Mh) { + jax.root.toNativeMML(span); + if (this.msieIE8HeightBug) {span.style.position = "absolute"} + if (nMML.widthBug) {span.style.width = span.parentNode.style.width = ""} + if (span.parentNode.style.width.match(/%$/)) + {span.parentNode.style.minWidth = Math.ceil(3*Mh/4)+"px"} // for full-width tables + var mW = math.offsetWidth || math.scrollWidth, + mH = math.offsetHeight || math.scrollHeight; + var zW = span.offsetWidth, zH = span.offsetHeight; + if (nMML.widthBug || span.style.width.match(/%/)) { + // + // FF doesn't get width of right, so get it from + // + var W = span.firstChild.firstChild.scrollWidth; + if (W > zW) {zW = W; span.parentNode.style.width = span.style.minWidth = zW + "px";} + } + if (this.msieIE8HeightBug) {span.style.position = ""} + return {Y:-EVENT.getBBox(span.parentNode).h, mW:mW, mH:mH, zW:zW, zH:zH} + }, + + NAMEDSPACE: { + negativeveryverythinmathspace: "-.0556em", + negativeverythinmathspace: "-.1111em", + negativethinmathspace: "-.1667em", + negativemediummathspace: "-.2222em", + negativethickmathspace: "-.2778em", + negativeverythickmathspace: "-.3333em", + negativeveryverythickmathspace: "-.3889em", + veryverythinmathspace: ".0556em", + verythinmathspace: ".1111em", + thinmathspace: ".1667em", + mediummathspace: ".2222em", + thickmathspace: ".2778em", + verythickmathspace: ".3333em", + veryverythickmathspace: ".3889em" + } + }); + + HUB.Register.StartupHook("mml Jax Ready",function () { + + MML = MathJax.ElementJax.mml; + + MML.mbase.Augment({ + // + // Add a MathML tag of the correct type, and set its attributes + // then populate it with its children and append it to the parent + // + toNativeMML: function (parent) { + var tag = this.NativeMMLelement(this.type); + this.NativeMMLattributes(tag); + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + } + parent.appendChild(tag); + }, + // + // Look for attributes that are different from the defaults + // and set those in the tag's attribute list + // + NativeMMLattributes: function (tag) { + var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults); + var names = (this.attrNames||MML.copyAttributeNames), + skip = MML.skipAttributes, copy = MML.copyAttributes; + if (!this.attrNames) { + for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) { + if (this[id] != null && this[id] !== defaults[id]) { + if (this.Get(id,null,1) !== this[id]) + tag.setAttribute(id,this.NativeMMLattribute(this[id])); + } + }} + } + for (var i = 0, m = names.length; i < m; i++) { + if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue; + var value = (this.attr||{})[names[i]]; if (value == null) {value = this[names[i]]} + if (value != null) {tag.setAttribute(names[i],this.NativeMMLattribute(value))} + } + this.NativeMMLclass(tag); + }, + NativeMMLclass: function (tag) { + var CLASS = []; if (this["class"]) {CLASS.push(this["class"])} + if (this.isa(MML.TeXAtom)) { + var TEXCLASS = ["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"][this.texClass]; + if (TEXCLASS) { + CLASS.push("MJX-TeXAtom-"+TEXCLASS) + if (TEXCLASS === "OP" && !this.movablelimits) CLASS.push("MJX-fixedlimits"); + } + } + if (this.mathvariant && this.NativeMMLvariants[this.mathvariant]) + {CLASS.push("MJX"+this.mathvariant)} + if (this.variantForm) {CLASS.push("MJX-variant")} + if (CLASS.length) {tag.setAttribute("class",CLASS.join(" "))} + }, + NativeMMLattribute: function (value) { + value = String(value); + if (nMML.NAMEDSPACE[value]) {value = nMML.NAMEDSPACE[value]} // MP doesn't do negative spaces + else if (value.match(/^\s*(([-+])?(\d+(\.\d*)?|\.\d+))\s*mu\s*$/)) + {value = (RegExp.$2||"")+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"} // FIXME: should take scriptlevel into account + else if (this.NativeMMLvariants[value]) {value = this.NativeMMLvariants[value]} + return value; + }, + NativeMMLvariants: { + "-tex-caligraphic": MML.VARIANT.SCRIPT, + "-tex-caligraphic-bold": MML.VARIANT.BOLDSCRIPT, + "-tex-oldstyle": MML.VARIANT.NORMAL, + "-tex-oldstyle-bold": MML.VARIANT.BOLD, + "-tex-mathit": MML.VARIANT.ITALIC + }, + // + // Create a MathML element + // + NativeMMLelement: function (type) { + var math = ( HUB.Browser.mpNamespace ? document.createElement("m:"+type) : + (document.createElementNS ? document.createElementNS(nMML.MMLnamespace,type) : + document.createElement(type))); + math.isMathJax = true; + return math; + } + }); + + MML.mrow.Augment({ + // + // Make inferred rows not include an mrow tag + // + toNativeMML: function (parent) { + var i, m; + if (this.inferred && this.parent.inferRow) { + for (i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(parent)} + else {parent.appendChild(this.NativeMMLelement("mrow"))} + } + } else if (nMML.stretchyMoBug && (this.open || this.close)) { + // + // This element contains opening and/or closing fences. Opera is not + // able to stretch operators, so let's use an element + // instead. + // + var mfenced = this.NativeMMLelement("mfenced"); + this.NativeMMLattributes(mfenced); + i = 0, m = this.data.length; + if (this.open) { mfenced.setAttribute("open", this.open); i++; } + if (this.close) { mfenced.setAttribute("close", this.close); m--; } + var tag = mfenced; + if (m - i + 1 > 1) { + // + // If there are several children, put them in an + // + tag = this.NativeMMLelement("mrow"); + parent.appendChild(mfenced); + parent = mfenced; + } + for (; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + } + parent.appendChild(tag); + } else { + this.SUPER(arguments).toNativeMML.call(this,parent); + } + } + }); + + MML.msubsup.Augment({ + // + // Use proper version of msub, msup, or msubsup, depending on + // which items are present + // + toNativeMML: function (parent) { + var type = this.type; + if (this.data[this.sup] == null) {type = "msub"} + if (this.data[this.sub] == null) {type = "msup"} + var tag = this.NativeMMLelement(type); + this.NativeMMLattributes(tag); + if (this.data[0]) {delete this.data[0].inferred} + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i]) {this.data[i].toNativeMML(tag)}} + parent.appendChild(tag); + } + }); + + MML.munderover.Augment({ + // + // Use proper version of munder, mover, or munderover, depending on + // which items are present. Handle movablelimits on TeXAtom base. + // + toNativeMML: function (parent) { + var type = this.type; + var base = this.data[this.base]; + if (base && base.isa(MML.TeXAtom) && base.movablelimits && !base.Get("displaystyle")) { + type = "msubsup"; + if (this.data[this.under] == null) {type = "msup"} + if (this.data[this.over] == null) {type = "msub"} + } else { + if (this.data[this.under] == null) {type = "mover"} + if (this.data[this.over] == null) {type = "munder"} + } + var tag = this.NativeMMLelement(type); + this.NativeMMLattributes(tag); + if (this.data[0]) {delete this.data[0].inferred} + for (var i = 0, m = this.data.length; i < m; i++) + {if (this.data[i]) {this.data[i].toNativeMML(tag)}} + parent.appendChild(tag); + } + }); + + if (!isMSIE) { + var SPLIT = HUB.SplitList; + MML.mtable.Augment({ + toNativeMML: function (parent) { + var i, m; + if (nMML.tableSpacingBug) { + // + // Parse the rowspacing/columnspacing. For convenience, we convert + // them to a left/top padding value that will be applied to each + // cell. The leftmost/topmost cells will use "0px". + // + var values = this.getValues("rowspacing", "columnspacing"); + this.nMMLtopPadding = SPLIT("0px "+values.rowspacing); + this.nMMLleftPadding = SPLIT("0px "+values.columnspacing); + // + // Transmit the top padding to each row. + // If this.parent.nMML.topPadding does not contain enough value, + // repeat the last one. + // + var tp = this.nMMLtopPadding, M = tp.length; + for (i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) + {this.data[i].nMMLtopPadding = tp[i < M ? i : M-1]} + } + } + if (nMML.tableLabelBug) { + // + // Look for labeled rows so we know how to handle them + // + for (i = 0, m = this.data.length; i < m; i++) { + if (this.data[i] && this.data[i].isa(MML.mlabeledtr)) { + var align = HUB.config.displayAlign.charAt(0), + side = this.Get("side").charAt(0); + this.nMMLhasLabels = true; + this.nMMLlaMatch = (align === side); + this.nMMLforceWidth = + (align === "c" || !!((this.width||"").match("%"))); + break; + } + } + } + // + // Firefox < 13 doesn't handle width, so put it in styles instead + // + if (this.width && this.ffTableWidthBug) { + var styles = (this.style||"").replace(/;\s*$/,"").split(";"); + if (styles[0] === "") {styles.shift()} + styles.push("width:"+this.width); + this.style = styles.join(";"); + } + this.SUPER(arguments).toNativeMML.call(this,parent); + // + if (this.nMMLhasLabels) { + var mtable = parent.firstChild; + // + // Add column attributes on the left when extra columns where inserted + // + if (this.nMMLforceWidth || side !== "r") { + var n = (align !== "l" ? 1 : 0) + (side === "l" ? 1 : 0); + if (n) { + var attr = {columnalign:"left", columnwidth:"auto", + columnspacing:"0px", columnlines:"none"}; + for (var id in attr) {if (attr.hasOwnProperty(id) && this[id]) { + var cols = [attr[id],attr[id]].slice(2-n).join(" ")+" "; + mtable.setAttribute(id,cols+mtable.getAttribute(id)); + }} + } + } + // + // Force the table width to 100% when needed + // + if (this.nMMLforceWidth || !this.nMMLlaMatch) + {mtable.setAttribute("width","100%")} + } + } + }); + MML.mtr.Augment({ + toNativeMML: function (parent) { + this.SUPER(arguments).toNativeMML.call(this,parent); + var mtr = parent.lastChild; + if (nMML.tableSpacingBug) { + // + // Set the row/column spacing. If this.parent.nMMLleftPadding does + // not contain enough value, repeat the last one. + // + var lp = this.parent.nMMLleftPadding, M = lp.length; + for (var mtd = mtr.firstChild, i = 0; mtd; mtd = mtd.nextSibling, i++) { + CELLSPACING(mtd,this.nMMLtopPadding,lp[i < M ? i : M-1]); + } + } + + if (nMML.tableLabelBug) { + var forceWidth = this.parent.nMMLforceWidth, + side = this.parent.Get("side").charAt(0), + align = HUB.config.displayAlign.charAt(0); + + if (this.parent.nMMLhasLabels && mtr.firstChild) { + // + // If we add a label or padding column on the left of mlabeledtr, + // mirror that here and remove padding from first table mtd + // so the spacing is consistent with unlabeled equations + // + if (forceWidth || side !== "r") { + NOPADDING("Left",mtr.firstChild); + if (align !== "l") { + mtr.insertBefore(this.NativeMMLelement("mtd"),mtr.firstChild) + .setAttribute("style","padding:0"); + } + if (side === "l") { + mtr.insertBefore(this.NativeMMLelement("mtd"),mtr.firstChild) + .setAttribute("style","padding:0"); + } + } + // + // If columns were added on the right, remove mtd padding + // so that spacing is consistent with unlabled equations + // + if (forceWidth || side !== "l") {NOPADDING("Right",mtr.lastChild)} + } + } + } + }); + MML.mlabeledtr.Augment({ + toNativeMML: function (parent) { + var mtr = this.NativeMMLelement("mtr"); + this.NativeMMLattributes(mtr); + // + // Add row data + // + for (var i = 1, m = this.data.length; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(mtr)} + else {mtr.appendChild(this.NativeMMLelement("mtd"))} + } + + if (nMML.tableSpacingBug) { + // + // Set the row/column spacing. If this.parent.nMMLleftPadding does + // not contain enough value, repeat the last one. + // + var lp = this.parent.nMMLleftPadding, M = lp.length; i = 0; + for (var mtd = mtr.firstChild; mtd; mtd = mtd.nextSibling, i++) { + CELLSPACING(mtd,this.nMMLtopPadding,lp[i < M ? i : M-1]); + } + } + + if (nMML.tableLabelBug && this.data[0]) { + var side = this.parent.Get("side").charAt(0), + align = HUB.config.displayAlign.charAt(0), + indent = HUB.config.displayIndent; + // + // Create label and either set the column width (if label is on the + // same side as the alignment), or use mpadded to hide the label + // width + // + this.data[0].toNativeMML(mtr); + var label = mtr.lastChild, pad = label; + if (side === align) { + label.setAttribute("style","width:"+indent); + label.setAttribute("columnalign",HUB.config.displayAlign); + } else { + pad = this.NativeMMLelement("mpadded"); + pad.setAttribute("style","width:0"); + pad.setAttribute("width","0px"); + pad.appendChild(label.firstChild); + label.appendChild(pad); + } + NOPADDING("",label); mtr.removeChild(label); + // + // Get spacing to use for separation of label from main table + // + var width = 100, forceWidth = this.parent.nMMLforceWidth; + if ((this.parent.width||"").match(/%/)) { + width -= parseFloat(this.parent.width) + }; + var w = width; + // + // Add spacing (and possibly label) at the left if needed + // + if (forceWidth || side !== "r") { + NOPADDING("Left",mtr.firstChild); + if (align !== "l") { + if (align === "c") {w /= 2}; width -= w; + mtr.insertBefore(this.NativeMMLelement("mtd"),mtr.firstChild) + .setAttribute("style","padding:0;width:"+w+"%"); + } + if (side === "l") {mtr.insertBefore(label,mtr.firstChild)} + } + // + // Add spacing (and possibly label) at the right if needed + // + if (forceWidth || side !== "l") { + NOPADDING("Right",mtr.lastChild); + if (align !== "r") { + mtr.appendChild(this.NativeMMLelement("mtd")) + .setAttribute("style","padding:0;width:"+width+"%"); + } + if (side === "r") { + if (side !== align) {pad.setAttribute("lspace","-1width")} + mtr.appendChild(label); + } + } + } + // + // Add row to table + // + parent.appendChild(mtr); + } + }); + + MML.mtd.Augment({ + toNativeMML: function (parent) { + var tag = parent.appendChild(this.NativeMMLelement(this.type)); + this.NativeMMLattributes(tag); + if (nMML.mtdWidthBug) { + nMML.adjustWidths.push(tag); + tag = tag.appendChild(this.NativeMMLelement("mrow")); + } + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + } + } + }); + + MML.mspace.Augment({ + toNativeMML: function (parent) { + this.SUPER(arguments).toNativeMML.call(this,parent); + if (nMML.spaceWidthBug && this.width) { + var mspace = parent.lastChild; + var width = mspace.getAttribute("width"); + var style = (mspace.getAttribute("style") || "").replace(/;?\s*/,"; "); + mspace.setAttribute("style",style+"width:"+width); + } + } + }); + + MML.mn.Augment({ + NativeMMLremapMinus: function (text) {return text.replace(/^-/,"\u2212")}, + toNativeMML: function (parent) { + var tag = this.NativeMMLelement(this.type); + this.NativeMMLattributes(tag); + var remap = this.NativeMMLremapMinus; + for (var i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) { + this.data[i].toNativeMML(tag,remap); + remap = null; + } + } + parent.appendChild(tag); + } + }); + + var fontDir = AJAX.fileURL(MathJax.OutputJax.fontDir+"/HTML-CSS/TeX/otf"); + + /* + * Add fix for mathvariant issues + */ + nMML.Augment({ + config: { + styles: { + '[class="MJX-tex-oldstyle"]': {"font-family":"MathJax_Caligraphic, MathJax_Caligraphic-WEB"}, + '[class="MJX-tex-oldstyle-bold"]': {"font-family":"MathJax_Caligraphic, MathJax_Caligraphic-WEB", "font-weight":"bold"}, + '[class="MJX-tex-caligraphic"]': {"font-family":"MathJax_Caligraphic, MathJax_Caligraphic-WEB"}, + '[class="MJX-tex-caligraphic-bold"]': {"font-family":"MathJax_Caligraphic, MathJax_Caligraphic-WEB", "font-weight":"bold"}, + + '@font-face /*1*/': { + "font-family": "MathJax_Caligraphic-WEB", + "src": "url('"+fontDir+"/MathJax_Caligraphic-Regular.otf')" + }, + '@font-face /*2*/': { + "font-family": "MathJax_Caligraphic-WEB", "font-weight":"bold", + "src": "url('"+fontDir+"/MathJax_Caligraphic-Bold.otf')" + } + } + } + }); + if (!this.handlesVariants) { + nMML.Augment({ + config: { + styles: { + '[mathvariant="double-struck"]': {"font-family":"MathJax_AMS, MathJax_AMS-WEB"}, + '[mathvariant="script"]': {"font-family":"MathJax_Script, MathJax_Script-WEB"}, + '[mathvariant="fraktur"]': {"font-family":"MathJax_Fraktur, MathJax_Fraktur-WEB"}, + '[mathvariant="bold-script"]': {"font-family":"MathJax_Script, MathJax_Caligraphic-WEB", "font-weight":"bold"}, + '[mathvariant="bold-fraktur"]': {"font-family":"MathJax_Fraktur, MathJax_Fraktur-WEB", "font-weight":"bold"}, + '[mathvariant="monospace"]': {"font-family":"monospace"}, + '[mathvariant="sans-serif"]': {"font-family":"sans-serif"}, + '[mathvariant="bold-sans-serif"]': {"font-family":"sans-serif", "font-weight":"bold"}, + '[mathvariant="sans-serif-italic"]': {"font-family":"sans-serif", "font-style":"italic"}, + '[mathvariant="sans-serif-bold-italic"]': {"font-family":"sans-serif", "font-style":"italic", "font-weight":"bold"}, + + '@font-face /*3*/': { + "font-family": "MathJax_AMS-WEB", + "src": "url('"+fontDir+"/MathJax_AMS-Regular.otf')" + }, + '@font-face /*4*/': { + "font-family": "MathJax_Script-WEB", + "src": "url('"+fontDir+"/MathJax_Script-Regular.otf')" + }, + '@font-face /*5*/': { + "font-family": "MathJax_Fraktur-WEB", + "src": "url('"+fontDir+"/MathJax_Fraktur-Regular.otf')" + }, + '@font-face /*6*/': { + "font-family": "MathJax_Fraktur-WEB", "font-weight":"bold", + "src": "url('"+fontDir+"/MathJax_Fraktur-Bold.otf')" + } + } + } + }); + } + } + + MML.math.Augment({ + toNativeMML: function (parent,jax) { + var tag = this.NativeMMLelement(this.type), math = tag; + var annotate = (jax ? MathJax.InputJax[jax.inputJax].annotationEncoding : null); + var i, m; + nMML.adjustWidths = []; + // + // Some browsers don't seem to add the xmlns attribute, so do it by hand. + // + tag.setAttribute("xmlns",nMML.MMLnamespace); + this.NativeMMLattributes(tag); + // + // Use an extra in FF so that we can get the correct width + // (the math element doesn't always have an accurate one, see below) + // + if (nMML.widthBug) {tag = tag.appendChild(this.NativeMMLelement("mrow"))} + // + // Addannotation if the input jax provides an annotation encoding + // + if (annotate) { + tag = tag.appendChild(this.NativeMMLelement("semantics")) + tag.appendChild(this.NativeMMLelement("mrow")); + var annotation = tag.appendChild(this.NativeMMLelement("annotation")); + annotation.appendChild(document.createTextNode(jax.originalText)); + annotation.setAttribute("encoding",annotate); + tag = tag.firstChild; // mrow + } + // + // Add the children + // + for (i = 0, m = this.data.length; i < m; i++) { + if (this.data[i]) {this.data[i].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + } + // + // Look for a top-level mtable and if it has labels + // Make sure the containers have 100% width, when needed. + // If the label is on the same side as alignment, + // override the margin set by the stylesheet. + // + var mtable = ((this.data[0]||{data:[]}).data[0]||{}); + if (mtable.nMMLhasLabels) { + if (mtable.nMMLforceWidth || !mtable.nMMLlaMatch) { + tag.setAttribute("style","width:100%") // mrow node + if (annotate) tag.parentNode.setAttribute("style","width:100%"); // semantics node + }; + if (mtable.nMMLlaMatch) { + if (parent.parentNode.parentNode.nodeName.toLowerCase() === "div") { + parent.parentNode.parentNode.style + .setProperty("margin-"+HUB.config.displayAlign,"0px","important"); + } + } + } + // + // Check if container must have width set to 100% + // + var fullWidth = nMML.isFullWidth(math); + if (fullWidth) {parent.style.width = parent.parentNode.style.width = "100%"} + // + // Add the math to the page + // + parent.appendChild(math); + // + // Firefox can't seem to get the width of elements right, so + // use an to get the actual width and set the style on the + // parent element to match. Even if we set the width properly, + // it doesn't seem to propagate up to the correctly. + // + if (nMML.widthBug &&!fullWidth) { + // + // Convert size to ex's so that it scales properly if the print media + // has a different font size. + // + parent.style.width = (math.firstChild.scrollWidth/nMML.ex/nMML.scale).toFixed(3) + "ex"; + // + // Save size for later when we check if Web fonts have arrived + // + if (jax) {jax.NativeMML.scrollWidth = math.firstChild.scrollWidth} + } + if (nMML.adjustWidths.length) { + // + // Firefox gets the widths of elements wrong, so run + // through them (now that the math is part of the page) and + // fix them up. Use ex's so that they print properly (see above). + // + var mtd = []; + for (i = 0, m = nMML.adjustWidths.length; i < m; i++) { + tag = nMML.adjustWidths[i]; + var style = tag.getAttribute("style") || ""; + if (!style.match(/(^|;)\s*min-width:/)) { + var width = tag.firstChild.scrollWidth; + mtd.push(width); + width = (width/nMML.ex).toFixed(3)+"ex"; + style = style.replace(/;?\s*$/,"; "); + tag.setAttribute("style",style+"min-width:"+width); + } + } + // + // Save the lists so that we can check them later for web font downloads + // + if (!jax) {jax = HUB.getJaxFor(parent)} + if (jax) {jax.NativeMML.mtds = mtd} + math.MathJaxMtds = nMML.adjustWidths; + nMML.adjustWidths = []; // clear it so we don't hold onto the DOM elements + } + } + }); + + MML.mfenced.Augment({ + toNativeMML: function (parent) { + if (!nMML.mfencedBug) { + this.SUPER(arguments).toNativeMML.call(this,parent); + return; + } + + // + // Some browsers do not handle very well. The MathML spec + // suggests this equivalent construction instead, so let's use it: + // open, child1, sep1, child2, ... sep(N-1), childN, close + // Opera is a bit special: it does not support stretchy , does not + // parse mfenced@open/mfenced@close very well, does not support + // mfenced@separators and only displays the first child of the + // element... For this browser, we will use this construction: + // + // child1, sep1, child2, sep2, ..., sep(N-1), childN + // + // + var isOpera = HUB.Browser.isOpera; + var i, m, operator; + + // + // parse the open, close and separators attributes. + // + var values = this.getValues("open","close","separators"); + values.open = values.open.replace(/^\s+/,"").replace(/\s+$/,""); + values.close = values.close.replace(/^\s+/,"").replace(/\s+$/,""); + values.separators = values.separators.replace(/\s+/g,"").split(""); + if (values.separators.length == 0) { + // + // No separators specified, do not use separators at all. + // + values.separators = null; + } else if (values.separators.length < this.data.length-1) { + // + // There are not enough separators, repeat the last one. + // + var s = values.separators[values.separators.length-1]; + for (i = this.data.length-1-values.separators.length; i > 0; i--) + {values.separators.push(s)} + } + + // + // Create an container and attach the attributes of the + // element to it. Note: removeAttribute does not raise any + // exception when the attributes is absent. + // + var tag = this.NativeMMLelement(isOpera ? this.type : "mrow"); + this.NativeMMLattributes(tag); + tag.removeAttribute("separators"); + if (isOpera) { + tag.setAttribute("open", values.open); + tag.setAttribute("close", values.close); + if (this.data.length > 1) { + parent.appendChild(tag); parent = tag; + tag = this.NativeMMLelement("mrow"); + } + } else { + tag.removeAttribute("open"); + tag.removeAttribute("close"); + } + + if (!isOpera) { + // + // Append the opening fence + // + operator = this.NativeMMLelement("mo"); + operator.setAttribute("fence", "true"); + operator.textContent = values.open; + tag.appendChild(operator); + } + + // + // Append the content of the + // + for (i = 0, m = this.data.length; i < m; i++) { + if (values.separators && i > 0) { + operator = this.NativeMMLelement("mo"); + operator.setAttribute("separator", "true"); + operator.textContent = values.separators[i-1]; + tag.appendChild(operator); + } + if (this.data[i]) {this.data[i].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + } + + if (!isOpera) { + // + // Append the closing fence + // + operator = this.NativeMMLelement("mo"); + operator.setAttribute("fence", "true"); + operator.textContent = values.close; + tag.appendChild(operator); + } + + // finally, append the new element to the parent. + parent.appendChild(tag); + } + }); + + MML.TeXAtom.Augment({ + // + // Convert TeXatom to an mrow + // + toNativeMML: function (parent) { + // FIXME: Handle spacing using mpadded? + var tag = this.NativeMMLelement("mrow"); + this.NativeMMLattributes(tag); + this.data[0].toNativeMML(tag); + parent.appendChild(tag); + } + }); + + MML.chars.Augment({ + // + // Add a text node + // + toNativeMML: function (parent,remap) { + var text = this.toString(); + if (remap) text = remap(text); + parent.appendChild(document.createTextNode(text)); + } + }); + + MML.entity.Augment({ + // + // Add a text node + // + toNativeMML: function (parent) { + parent.appendChild(document.createTextNode(this.toString())); + } + }); + + MML.xml.Augment({ + // + // Insert the XML verbatim + // + toNativeMML: function (parent) { + for (var i = 0, m = this.data.length; i < m; i++) + {parent.appendChild(this.data[i].cloneNode(true))} + } + }); + + MML.mi.Augment({ + toNativeMML: function (parent) { + this.SUPER(arguments).toNativeMML.call(this,parent); + if (nMML.miItalicBug) { + if (this.Get("mathvariant") === MML.VARIANT.NORMAL) { + // + // When not explicitly specified, mathvariant is set to "italic" + // with single char mi and to "normal" with multiple char mi. + // Some browsers always set the default to "italic", so let's + // attach an explicit mathvariant="normal" attribute. + // + var mi = parent.lastChild; + mi.setAttribute("mathvariant",MML.VARIANT.NORMAL); + } + } + } + }); + + MML.mo.Augment({ + toNativeMML: function (parent) { + this.SUPER(arguments).toNativeMML.call(this,parent); + if (nMML.webkitMoSpacingBug) { + // + // WebKit does not support lspace/rspace values around operators + // (neither explicit nor given by the operator dictionary) and uses + // constant values instead. So let's modify the CSS properties here. + // + + var lspace = 0, rspace = 0, p = this.parent; + if (p && p.type === "mrow" && (p.inferred || !p.isEmbellished())) { + // + // Retrieve the values of lspace/rspace and convert named spaces. + // Other values (except unitless) will be parsed by the CSS engine. + // + var values = this.getValues("lspace", "rspace"); + lspace = values.lspace, rspace = values.rspace; + if (nMML.NAMEDSPACE[lspace]) {lspace = nMML.NAMEDSPACE[lspace]} + if (nMML.NAMEDSPACE[rspace]) {rspace = nMML.NAMEDSPACE[rspace]} + } + + // + // Now update -webkit-margin-start and -webkit-margin-end. + // + var mo = parent.lastChild; + var span = HTML.Element("span"); + span.style.cssText = (mo.getAttribute("style")||""); + span.style.setProperty("-webkit-margin-start", lspace); + span.style.setProperty("-webkit-margin-end", rspace); + mo.setAttribute("style",span.style.cssText); + } + } + }); + + MML.mmultiscripts.Augment({ + toNativeMML: function (parent) { + // + // Some browsers do not implement the mmultiscripts element. + // Try to emulate the support using basic script elements. + // + if (!nMML.mmultiscriptsBug || this.data.length === 0) { + this.SUPER(arguments).toNativeMML.call(this,parent); + return; + } + + // + // The children of the mmultiscripts will be wrapped in an mrow so that + // attributes and properties set on the original mmultiscripts will + // be reflected on this mrow element. + // + var tag = this.NativeMMLelement("mrow"); + this.NativeMMLattributes(tag); + + // + // Create the base + // + if (this.data[0]) {this.data[0].toNativeMML(tag)} + else {tag.appendChild(this.NativeMMLelement("mrow"))} + var base = tag.removeChild(tag.lastChild); + + // + // Process the postscript pairs + // + var m = this.data.length, i, msubsup; + for (i = 1; i < m; i+=2) { + if (this.data[i].type === "mprescripts") break; + + msubsup = this.NativeMMLelement("msubsup"); + msubsup.appendChild(base); + + // + // append the subscript + // + if (this.data[i]) {this.data[i].toNativeMML(msubsup)} + else {msubsup.appendChild(this.NativeMMLelement("mrow"))} + + // + // append the supscript + // + if (i+1 < m && this.data[i+1]) {this.data[i+1].toNativeMML(msubsup)} + else {msubsup.appendChild(this.NativeMMLelement("mrow"))} + + base = msubsup; + } + + tag.appendChild(base); + + // + // Process the prescript pairs + // + for (i++; i < m; i+=2) { + msubsup = this.NativeMMLelement("msubsup"); + msubsup.appendChild(this.NativeMMLelement("mrow")); + + // + // append the presubscript + // + if (this.data[i]) {this.data[i].toNativeMML(msubsup)} + else {msubsup.appendChild(this.NativeMMLelement("mrow"))} + + // + // append the presupscript + // + if (i+1 < m && this.data[i+1]) {this.data[i+1].toNativeMML(msubsup)} + else {msubsup.appendChild(this.NativeMMLelement("mrow"))} + + tag.insertBefore(msubsup, base); + } + + parent.appendChild(tag); + } + }); + + HUB.Register.StartupHook("TeX mathchoice Ready",function () { + MML.TeXmathchoice.Augment({ + // + // Get the MathML for the selected choice + // + toNativeMML: function (parent) {this.Core().toNativeMML(parent)} + }); + }); + + // + // Loading isn't complete until the element jax is modified, + // but can't call loadComplete within the callback for "mml Jax Ready" + // (it would call NativeMML's Require routine, asking for the mml jax again) + // so wait until after the mml jax has finished processing. + // + setTimeout(MathJax.Callback(["loadComplete",nMML,"jax.js"]),0); + }); + + + // + // Determine browser characteristics + // + HUB.Browser.Select({ + MSIE: function (browser) { + var mode = (document.documentMode || 0); + nMML.msieIE8HeightBug = (mode === 8); + }, + Opera: function (browser) { + nMML.stretchyMoBug = true; + nMML.tableLabelBug = true; + nMML.mfencedBug = true; + nMML.miBug = true; + nMML.mmultiscriptsBug = true; + }, + Firefox: function (browser) { + var is29 = browser.versionAtLeast("29.0"); + nMML.ffTableWidthBug = !browser.versionAtLeast("13.0"); // not implemented + nMML.forceReflow = !is29; // with alignments set don't display properly without a reflow + nMML.widthBug = !is29; // elements don't always get the correct width + nMML.mtdWidthBug = true; // widths not properly determined + nMML.handlesVariants = is29; // FF >=29 handles all math variants + + // In Firefox < 20, the intrinsic width of is not computed + // correctly and thus the element is displayed incorrectly in . + nMML.spaceWidthBug = !browser.versionAtLeast("20.0"); + + // mtable@rowspacing/mtable@columnspacing not supported. + nMML.tableSpacingBug = !browser.versionAtLeast("33.0"); + nMML.tableLabelBug = true; // mlabeledtr is not implemented. + nMML.mfencedBug = true; // mfenced not displayed correctly + }, + Chrome: function (browser) { + nMML.tableSpacingBug = true; + nMML.tableLabelBug = true; + nMML.mfencedBug = true; + }, + Safari: function (browser) { + nMML.tableSpacingBug = true; + nMML.tableLabelBug = true; + nMML.mfencedBug = true; + nMML.miItalicBug = true; + nMML.webkitMoSpacingBug = true; + nMML.spaceWidthBug = true; + nMML.mmultiscriptsBug = true; + } + }); + + + HUB.Register.StartupHook("End Cookie",function () { + if (HUB.config.menuSettings.zoom !== "None") + {AJAX.Require("[MathJax]/extensions/MathZoom.js")} + }); + +})(MathJax.OutputJax.NativeMML, MathJax.Hub, MathJax.Ajax, MathJax.HTML); +// @license-end diff --git a/js/mathjax/jax/output/PlainSource/config.js b/js/mathjax/jax/output/PlainSource/config.js new file mode 100644 index 0000000..3d6d6be --- /dev/null +++ b/js/mathjax/jax/output/PlainSource/config.js @@ -0,0 +1,51 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/PlainSource/config.js + * + * Initializes the PlainSource OutputJax (the main definition is in + * MathJax/jax/input/PlainSource/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.OutputJax.PlainSource = MathJax.OutputJax({ + id: "PlainSource", + version: "2.7.9", + directory: MathJax.OutputJax.directory + "/PlainSource", + extensionDir: MathJax.OutputJax.extensionDir + "/PlainSource", + + config: { + styles: { + ".MathJax_PlainSource_Display": { + "text-align": "center", + margin: ".75em 0px", + "white-space":"pre" + }, + ".MathJax_PlainSource_Display > span": { + display: "inline-block", + "text-align": "left" + } + } + } +}); + +if (!MathJax.Hub.config.delayJaxRegistration) + MathJax.OutputJax.PlainSource.Register("jax/mml"); + +MathJax.OutputJax.PlainSource.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/output/PlainSource/jax.js b/js/mathjax/jax/output/PlainSource/jax.js new file mode 100644 index 0000000..fb62d44 --- /dev/null +++ b/js/mathjax/jax/output/PlainSource/jax.js @@ -0,0 +1,186 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/************************************************************* + * + * MathJax/jax/output/PlainSource/jax.js + * + * Implements the PlainSource OutputJax that displays whatever + * source there was, for assistive technology users who prefer this. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2015-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +(function(AJAX, HUB, HTML, PlainSource) { + + var EVENT, TOUCH, HOVER; // filled in later + + PlainSource.Augment({ + settings: HUB.config.menuSettings, + + Config: function() { + if (!this.require) this.require = []; + this.SUPER(arguments).Config.call(this); + this.require.push(MathJax.OutputJax.extensionDir + "/MathEvents.js"); + }, + + Startup: function() { + // + // Set up event handling + // + EVENT = MathJax.Extension.MathEvents.Event; + TOUCH = MathJax.Extension.MathEvents.Touch; + HOVER = MathJax.Extension.MathEvents.Hover; + this.ContextMenu = EVENT.ContextMenu; + this.Mousedown = EVENT.AltContextMenu; + this.Mouseover = HOVER.Mouseover; + this.Mouseout = HOVER.Mouseout; + this.Mousemove = HOVER.Mousemove; + return AJAX.Styles(this.config.styles); + }, + + preTranslate: function(state) { + var scripts = state.jax[this.id], + i, m = scripts.length, + script, prev, span, div, jax; + // + // Loop through the scripts + // + for (i = 0; i < m; i++) { + script = scripts[i]; + if (!script.parentNode) continue; + // + // Remove any existing output + // + prev = script.previousSibling; + if (prev && String(prev.className).match(/^MathJax(_PlainSource)?(_Display)?( MathJax_Process(ing|ed))?$/)) { + prev.parentNode.removeChild(prev); + } + // + // Add the span, and a div if in display mode + // + jax = script.MathJax.elementJax; + if (!jax) continue; + jax.PlainSource = { + display: (jax.root.Get("display") === "block") + } + span = div = HTML.Element("span", { + className: "MathJax_PlainSource", + id: jax.inputID + "-Frame", + isMathJax: true, + jaxID: this.id, + oncontextmenu: EVENT.Menu, + onmousedown: EVENT.Mousedown, + onmouseover: EVENT.Mouseover, + onmouseout: EVENT.Mouseout, + onmousemove: EVENT.Mousemove, + onclick: EVENT.Click, + ondblclick: EVENT.DblClick, + // Added for keyboard accessible menu. + onkeydown: EVENT.Keydown, + tabIndex: HUB.getTabOrder(jax) + },[["span"]]); + if (HUB.Browser.noContextMenu) { + span.ontouchstart = TOUCH.start; + span.ontouchend = TOUCH.end; + } + if (jax.PlainSource.display) { + div = HTML.Element("div", { + className: "MathJax_PlainSource_Display" + }); + div.appendChild(span); + } + script.parentNode.insertBefore(div, script); + } + }, + + Translate: function(script, state) { + if (!script.parentNode) return; + + // + // Get the data about the math + // + var jax = script.MathJax.elementJax, + math = jax.root, + span = document.getElementById(jax.inputID + "-Frame"); + // + // Typeset the math + // + this.initPlainSource(math, span); + var source = jax.originalText; + if (jax.inputJax === "MathML") { + if ((jax.root.data[0].data.length > 0) && (jax.root.data[0].data[0].type === "semantics")) { + var annotations = jax.root.data[0].data[0].data; + for (var a = 0; a < annotations.length; a++){ + if (annotations[a].attr.encoding === "application/x-tex"){ + source = jax.root.data[0].data[0].data[a].data[0].data[0]; + break; + } + if (annotations[a].attr.encoding === "text/x-asciimath") { + source = jax.root.data[0].data[0].data[a].data[0].data[0]; + } + } + } + } + jax.PlainSource.source = source; + HTML.addText(span.firstChild,source); + }, + + postTranslate: function(state) {}, + + getJaxFromMath: function(math) { + if (math.parentNode.className.match(/MathJax_PlainSource_Display/)) math = math.parentNode; + do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); + return HUB.getJaxFor(math); + }, + + Zoom: function (jax,span,math,Mw,Mh) { + var pad = Math.round(span.parentNode.offsetWidth / 2); + span.style.whiteSpace = "pre"; + HTML.addText(span,jax.PlainSource.source); + var mW = math.offsetWidth, mH = math.offsetHeight, + zW = span.offsetWidth, zH = span.offsetHeight; + var Y = -Math.round((zH+mH)/2) - (jax.PlainSource.display ? 0 : pad); + return {mW:mW, mH:mH, zW:zW, zH:zH, Y:Y}; + }, + + initPlainSource: function(math, span) {}, + + Remove: function(jax) { + var span = document.getElementById(jax.inputID + "-Frame"); + if (span) { + if (jax.PlainSource.display) span = span.parentNode; + span.parentNode.removeChild(span); + } + delete jax.PlainSource; + } + + }); + + MathJax.Hub.Register.StartupHook("mml Jax Ready", function() { + MathJax.Hub.Register.StartupHook("onLoad", function() { + setTimeout(MathJax.Callback(["loadComplete", PlainSource, "jax.js"]), 0); + }); + }); + + MathJax.Hub.Register.StartupHook("End Cookie", function() { + if (HUB.config.menuSettings.zoom !== "None") { + AJAX.Require("[MathJax]/extensions/MathZoom.js") + } + }); + +})(MathJax.Ajax, MathJax.Hub, MathJax.HTML, MathJax.OutputJax.PlainSource); +// @license-end diff --git a/js/mathjax/jax/output/PreviewHTML/config.js b/js/mathjax/jax/output/PreviewHTML/config.js new file mode 100644 index 0000000..866f2f0 --- /dev/null +++ b/js/mathjax/jax/output/PreviewHTML/config.js @@ -0,0 +1,56 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/PreviewHTML/config.js + * + * Initializes the PreviewHTML OutputJax (the main definition is in + * MathJax/jax/input/PreviewHTML/jax.js, which is loaded when needed). + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +MathJax.OutputJax.PreviewHTML = MathJax.OutputJax({ + id: "PreviewHTML", + version: "2.7.9", + directory: MathJax.OutputJax.directory + "/PreviewHTML", + extensionDir: MathJax.OutputJax.extensionDir + "/PreviewHTML", + noFastPreview: true, // don't do fast preview for this output jax + + config: { + scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor + mtextFontInherit: false, // to make be in page font rather than MathJax font + + linebreaks: { + automatic: false, // when false, only process linebreak="newline", + // when true, insert line breaks automatically in long expressions. + + width: "container" // maximum width of a line for automatic line breaks (e.g. "30em"). + // use "container" to compute size from containing element, + // use "nn% container" for a portion of the container, + // use "nn%" for a portion of the window size + } + + } +}); + +if (!MathJax.Hub.config.delayJaxRegistration) {MathJax.OutputJax.PreviewHTML.Register("jax/mml")} + +MathJax.OutputJax.PreviewHTML.loadComplete("config.js"); +// @license-end diff --git a/js/mathjax/jax/output/PreviewHTML/jax.js b/js/mathjax/jax/output/PreviewHTML/jax.js new file mode 100644 index 0000000..9fc3b4c --- /dev/null +++ b/js/mathjax/jax/output/PreviewHTML/jax.js @@ -0,0 +1,1098 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/jax/output/PreviewHTML/jax.js + * + * Implements the PreviewHTML OutputJax that displays mathematics + * using HTML to position the characters from math fonts + * in their proper locations. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2013-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +(function (AJAX,HUB,HTML,PHTML) { + var MML; + + var EVENT, TOUCH, HOVER; // filled in later + + var FONTS = "'Times New Roman',Times,STIXGeneral,serif"; + var STYLES = { + ".MJXp-script": {"font-size":".8em"}, + + ".MJXp-right": { + "-webkit-transform-origin":"right", + "-moz-transform-origin":"right", + "-ms-transform-origin":"right", + "-o-transform-origin":"right", + "transform-origin":"right" + }, + + ".MJXp-bold": {"font-weight":"bold"}, + ".MJXp-italic": {"font-style":"italic"}, + ".MJXp-scr": {"font-family":"MathJax_Script,"+FONTS}, + ".MJXp-frak": {"font-family":"MathJax_Fraktur,"+FONTS}, + ".MJXp-sf": {"font-family":"MathJax_SansSerif,"+FONTS}, + ".MJXp-cal": {"font-family":"MathJax_Caligraphic,"+FONTS}, + ".MJXp-mono": {"font-family":"MathJax_Typewriter,"+FONTS}, + ".MJXp-largeop": {"font-size":"150%"}, + ".MJXp-largeop.MJXp-int": {"vertical-align":"-.2em"}, + + ".MJXp-math": { + "display": "inline-block", + "line-height": "1.2", + "text-indent": "0", + "font-family": FONTS, + "white-space":"nowrap", + "border-collapse":"collapse" + }, + ".MJXp-display": { + "display": "block", + "text-align": "center", + "margin": "1em 0" + }, + ".MJXp-math span": {"display": "inline-block"}, + ".MJXp-box": {"display":"block!important", "text-align": "center"}, + ".MJXp-box:after": {"content": '" "'}, // needed for when there is no DOCTYPE + ".MJXp-rule": {"display":"block!important", "margin-top":".1em"}, + ".MJXp-char": {"display":"block!important"}, + + ".MJXp-mo": {"margin": "0 .15em"}, + + ".MJXp-mfrac": {"margin": "0 .125em", "vertical-align":".25em"}, + ".MJXp-denom": {"display": "inline-table!important", "width":"100%"}, + ".MJXp-denom > *": {"display": "table-row!important"}, + + ".MJXp-surd": {"vertical-align":"top"}, + ".MJXp-surd > *": {"display":"block!important"}, + + ".MJXp-script-box > * ": {"display":"table!important", "height":"50%"}, + ".MJXp-script-box > * > *": {"display":"table-cell!important","vertical-align":"top"}, + ".MJXp-script-box > *:last-child > *": {"vertical-align":"bottom"}, + ".MJXp-script-box > * > * > *": {"display":"block!important"}, + + ".MJXp-mphantom": {"visibility": "hidden"}, + + ".MJXp-munderover, .MJXp-munder": {"display":"inline-table!important"}, + ".MJXp-over": {"display":"inline-block!important","text-align":"center"}, + ".MJXp-over > *": {"display":"block!important"}, + ".MJXp-munderover > *, .MJXp-munder > *": {"display":"table-row!important"}, + + ".MJXp-mtable": {"vertical-align":".25em", "margin":"0 .125em"}, + ".MJXp-mtable > *": {"display":"inline-table!important", "vertical-align":"middle"}, + ".MJXp-mtr": {"display":"table-row!important"}, + ".MJXp-mtd": {"display":"table-cell!important","text-align":"center","padding":".5em 0 0 .5em"}, + ".MJXp-mtr > .MJXp-mtd:first-child": {"padding-left":0}, + ".MJXp-mtr:first-child > .MJXp-mtd": {"padding-top":0}, + ".MJXp-mlabeledtr": {"display":"table-row!important"}, + ".MJXp-mlabeledtr > .MJXp-mtd:first-child": {"padding-left":0}, + ".MJXp-mlabeledtr:first-child > .MJXp-mtd": {"padding-top":0}, + + ".MJXp-merror": { + "background-color": "#FFFF88", + color: "#CC0000", + border: "1px solid #CC0000", + padding: "1px 3px", + "font-style": "normal", + "font-size": "90%" + } + }; + + (function () { + for (var i = 0; i < 10; i++) { + var scale = "scaleX(."+i+")"; + STYLES[".MJXp-scale"+i] = { + "-webkit-transform":scale, + "-moz-transform":scale, + "-ms-transform":scale, + "-o-transform":scale, + "transform":scale + } + } + })(); + + var BIGDIMEN = 1000000; + var V = "V", H = "H"; + + PHTML.Augment({ + settings: HUB.config.menuSettings, + config: {styles: STYLES}, + + hideProcessedMath: false, // use display:none until all math is processed + + maxStretchyParts: 1000, // limit the number of parts allowed for + // stretchy operators. See issue 366. + + Config: function () { + if (!this.require) {this.require = []} + this.SUPER(arguments).Config.call(this); var settings = this.settings; + if (settings.scale) {this.config.scale = settings.scale} + this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js"); + }, + + Startup: function () { + // + // Set up event handling + // + EVENT = MathJax.Extension.MathEvents.Event; + TOUCH = MathJax.Extension.MathEvents.Touch; + HOVER = MathJax.Extension.MathEvents.Hover; + this.ContextMenu = EVENT.ContextMenu; + this.Mousedown = EVENT.AltContextMenu; + this.Mouseover = HOVER.Mouseover; + this.Mouseout = HOVER.Mouseout; + this.Mousemove = HOVER.Mousemove; + + // + // Determine pixels per inch + // + var div = HTML.addElement(document.body,"div",{style:{width:"5in"}}); + this.pxPerInch = div.offsetWidth/5; div.parentNode.removeChild(div); + + // + // Set up styles and preload web fonts + // + return AJAX.Styles(this.config.styles,["InitializePHTML",this]); + }, + InitializePHTML: function () { + }, + + preTranslate: function (state) { + var scripts = state.jax[this.id], i, m = scripts.length, + script, prev, span, div, jax; + // + // Loop through the scripts + // + for (i = 0; i < m; i++) { + script = scripts[i]; if (!script.parentNode) continue; + // + // Remove any existing output + // + prev = script.previousSibling; + if (prev && String(prev.className).match(/^MathJax(_PHTML)?(_Display)?( MathJax_Process(ing|ed))?$/)) + {prev.parentNode.removeChild(prev)} + // + // Add the span, and a div if in display mode, + // then mark it as being processed + // + jax = script.MathJax.elementJax; if (!jax) continue; + jax.PHTML = {display: (jax.root.Get("display") === "block")} + span = div = HTML.Element("span",{ + className:"MathJax_PHTML", id:jax.inputID+"-Frame", isMathJax:true, jaxID:this.id, + oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown, + onmouseover:EVENT.Mouseover, onmouseout:EVENT.Mouseout, onmousemove:EVENT.Mousemove, + onclick:EVENT.Click, ondblclick:EVENT.DblClick, + // Added for keyboard accessible menu. + onkeydown: EVENT.Keydown, tabIndex: HUB.getTabOrder(jax) + }); + if (HUB.Browser.noContextMenu) { + span.ontouchstart = TOUCH.start; + span.ontouchend = TOUCH.end; + } + if (jax.PHTML.display) { + div = HTML.Element("div",{className:"MathJax_PHTML_Display"}); + div.appendChild(span); + } + // + div.className += " MathJax_Processing"; + script.parentNode.insertBefore(div,script); + } + }, + + Translate: function (script,state) { + if (!script.parentNode) return; + + // + // Get the data about the math + // + var jax = script.MathJax.elementJax, math = jax.root, + span = document.getElementById(jax.inputID+"-Frame"), + div = (jax.PHTML.display ? span.parentNode : span); + // + // Typeset the math + // + this.initPHTML(math,span); +// math.setTeXclass(); + try {math.toPreviewHTML(span)} catch (err) { + if (err.restart) {while (span.firstChild) {span.removeChild(span.firstChild)}} + throw err; + } + // + // Put it in place, and remove the processing marker + // + div.className = div.className.split(/ /)[0]; + // + // Check if we are hiding the math until more is processed + // + if (this.hideProcessedMath) { + // + // Hide the math and don't let its preview be removed + // + div.className += " MathJax_Processed"; + if (script.MathJax.preview) { + jax.PHTML.preview = script.MathJax.preview; + delete script.MathJax.preview; + } + } + }, + + postTranslate: function (state) { + var scripts = state.jax[this.id]; + if (!this.hideProcessedMath) return; + for (var i = 0, m = scripts.length; i < m; i++) { + var script = scripts[i]; + if (script && script.MathJax.elementJax) { + // + // Remove the processed marker + // + script.previousSibling.className = script.previousSibling.className.split(/ /)[0]; + var data = script.MathJax.elementJax.PHTML; + // + // Remove the preview, if any + // + if (data.preview) { + data.preview.innerHTML = ""; + script.MathJax.preview = data.preview; + delete data.preview; + } + } + } + }, + + getJaxFromMath: function (math) { + if (math.parentNode.className.match(/MathJax_PHTML_Display/)) {math = math.parentNode} + do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); + return HUB.getJaxFor(math); + }, + getHoverSpan: function (jax,math) {return jax.root.PHTMLspanElement()}, + getHoverBBox: function (jax,span,math) { + var bbox = jax.root.PHTML, em = jax.PHTML.outerEm; + var BBOX = {w:bbox.w*em, h:bbox.h*em, d:bbox.d*em}; + if (bbox.width) {BBOX.width = bbox.width} + return BBOX; + }, + + Zoom: function (jax,span,math,Mw,Mh) { + // + // Re-render at larger size + // + span.className = "MathJax"; + this.idPostfix = "-zoom"; jax.root.toPHTML(span,span); this.idPostfix = ""; + // + // Get height and width of zoomed math and original math + // + span.style.position = "absolute"; + if (!width) {math.style.position = "absolute"} + var zW = span.offsetWidth, zH = span.offsetHeight, + mH = math.offsetHeight, mW = math.offsetWidth; + if (mW === 0) {mW = math.parentNode.offsetWidth}; // IE7 gets mW == 0? + span.style.position = math.style.position = ""; + // + return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH}; + }, + + initPHTML: function (math,span) {}, + + Remove: function (jax) { + var span = document.getElementById(jax.inputID+"-Frame"); + if (span) { + if (jax.PHTML.display) {span = span.parentNode} + span.parentNode.removeChild(span); + } + delete jax.PHTML; + }, + + ID: 0, idPostfix: "", + GetID: function () {this.ID++; return this.ID}, + + VARIANT: { + "bold": "MJXp-bold", + "italic": "MJXp-italic", + "bold-italic": "MJXp-bold MJXp-italic", + "script": "MJXp-scr", + "bold-script": "MJXp-scr MJXp-bold", + "fraktur": "MJXp-frak", + "bold-fraktur": "MJXp-frak MJXp-bold", + "monospace": "MJXp-mono", + "sans-serif": "MJXp-sf", + "-tex-caligraphic": "MJXp-cal" + }, + MATHSPACE: { + veryverythinmathspace: 1/18, + verythinmathspace: 2/18, + thinmathspace: 3/18, + mediummathspace: 4/18, + thickmathspace: 5/18, + verythickmathspace: 6/18, + veryverythickmathspace: 7/18, + negativeveryverythinmathspace: -1/18, + negativeverythinmathspace: -2/18, + negativethinmathspace: -3/18, + negativemediummathspace: -4/18, + negativethickmathspace: -5/18, + negativeverythickmathspace: -6/18, + negativeveryverythickmathspace: -7/18, + + thin: .08, + medium: .1, + thick: .15, + + infinity: BIGDIMEN + }, + TeX: { + x_height: .430554 + }, + pxPerInch: 72, + em: 16, + + // ### FIXME: add more here + + DELIMITERS: { + "(": {dir:V}, + "{": {dir:V, w:.58}, + "[": {dir:V}, + "|": {dir:V, w:.275}, + ")": {dir:V}, + "}": {dir:V, w:.58}, + "]": {dir:V}, + "/": {dir:V}, + "\\": {dir:V}, + "\u2223": {dir:V, w:.275}, + "\u2225": {dir:V, w:.55}, + "\u230A": {dir:V, w:.5}, + "\u230B": {dir:V, w:.5}, + "\u2308": {dir:V, w:.5}, + "\u2309": {dir:V, w:.5}, + "\u27E8": {dir:V, w:.5}, + "\u27E9": {dir:V, w:.5}, + "\u2191": {dir:V, w:.65}, + "\u2193": {dir:V, w:.65}, + "\u21D1": {dir:V, w:.75}, + "\u21D3": {dir:V, w:.75}, + "\u2195": {dir:V, w:.65}, + "\u21D5": {dir:V, w:.75}, + "\u27EE": {dir:V, w:.275}, + "\u27EF": {dir:V, w:.275}, + "\u23B0": {dir:V, w:.6}, + "\u23B1": {dir:V, w:.6} + }, + + REMAPACCENT: { + "\u20D7":"\u2192", // vector arrow + "'": "\u02CB", + "`": "\u02CA", + ".": "\u02D9", + "^": "\u02C6", + "-": "\u02C9", + "~": "\u02DC", + "\u00AF": "\u02C9", // macron + "\u00B0": "\u02DA", // degree sign + "\u00B4": "\u02CA", // acute accent + "\u0300": "\u02CB", // combining grave + "\u0301": "\u02CA", // combining acute + "\u0302": "\u02C6", // combining circumflex + "\u0303": "\u02DC", // combinig tilde + "\u0304": "\u02C9", // combining macron + "\u0305": "\u02C9", // combining overline + "\u0306": "\u02D8", // combining breve + "\u0307": "\u02D9", // combining dot + "\u0308": "\u00A8", // combining double dot + "\u030C": "\u02C7" // combining caron + }, + REMAPACCENTUNDER: { + }, + + length2em: function (length,size) { + if (typeof(length) !== "string") {length = length.toString()} + if (length === "") {return ""} + if (length === MML.SIZE.NORMAL) {return 1} + if (length === MML.SIZE.BIG) {return 2} + if (length === MML.SIZE.SMALL) {return .71} + if (this.MATHSPACE[length]) {return this.MATHSPACE[length]} + var match = length.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/); + var m = parseFloat(match[1]||"1"), unit = match[2]; + if (size == null) {size = 1} + if (unit === "em") {return m} + if (unit === "ex") {return m * this.TeX.x_height} + if (unit === "%") {return m / 100 * size} + if (unit === "px") {return m / this.em} + if (unit === "pt") {return m / 10} // 10 pt to an em + if (unit === "pc") {return m * 1.2} // 12 pt to a pc + if (unit === "in") {return m * this.pxPerInch / this.em} + if (unit === "cm") {return m * this.pxPerInch / this.em / 2.54} // 2.54 cm to an inch + if (unit === "mm") {return m * this.pxPerInch / this.em / 25.4} // 10 mm to a cm + if (unit === "mu") {return m / 18} // 18mu to an em for the scriptlevel + return m*size; // relative to given size (or 1em as default) + }, + + Em: function (m) { + if (Math.abs(m) < .001) return "0em"; + return (m.toFixed(3).replace(/\.?0+$/,""))+"em"; + }, + + arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]} + + }); + + MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { + MML = MathJax.ElementJax.mml; + + MML.mbase.Augment({ + toPreviewHTML: function (span,options) { + return this.PHTMLdefaultSpan(span,options); + }, + + PHTMLdefaultSpan: function (span,options) { + if (!options) options = {}; + span = this.PHTMLcreateSpan(span); + this.PHTMLhandleStyle(span); + this.PHTMLhandleColor(span); + if (this.isToken) this.PHTMLhandleToken(span); + for (var i = 0, m = this.data.length; i < m; i++) this.PHTMLaddChild(span,i,options); + return span; + }, + PHTMLaddChild: function (span,i,options) { + var child = this.data[i]; + if (child) { + if (options.childSpans) + span = HTML.addElement(span,"span",{className:options.className}); + child.toPreviewHTML(span); + if (!options.noBBox) { + this.PHTML.w += child.PHTML.w + child.PHTML.l + child.PHTML.r; + if (child.PHTML.h > this.PHTML.h) this.PHTML.h = child.PHTML.h; + if (child.PHTML.d > this.PHTML.d) this.PHTML.d = child.PHTML.d; + if (child.PHTML.t > this.PHTML.t) this.PHTML.t = child.PHTML.t; + if (child.PHTML.b > this.PHTML.b) this.PHTML.b = child.PHTML.b; + } + } else if (options.forceChild) {HTML.addElement(span,"span")} + }, + PHTMLstretchChild: function (i,H,D) { + var data = this.data[i]; + if (data && data.PHTMLcanStretch("Vertical",H,D)) { + var bbox = this.PHTML, dbox = data.PHTML, w = dbox.w; + data.PHTMLstretchV(H,D); + bbox.w += dbox.w - w; + if (dbox.h > bbox.h) bbox.h = dbox.h; + if (dbox.d > bbox.d) bbox.d = dbox.d; + } + }, + + PHTMLcreateSpan: function (span) { + if (!this.PHTML) this.PHTML = {}; + this.PHTML = {w:0, h:0, d:0, l:0, r:0, t:0, b:0}; + if (this.inferred) return span; + // ### FIXME: This is a hack to handle the different spacing of the + // ### integral sign in Times compared to CM fonts + if (this.type === "mo" && this.data.join("") === "\u222B") {PHTML.lastIsInt = true} + else if (this.type !== "mspace" || this.width !== "negativethinmathspace") {PHTML.lastIsInt = false} + // ### + if (!this.PHTMLspanID) {this.PHTMLspanID = PHTML.GetID()}; + var id = (this.id || "MJXp-Span-"+this.PHTMLspanID); + return HTML.addElement(span,"span",{className:"MJXp-"+this.type, id:id}); + }, + PHTMLspanElement: function () { + if (!this.PHTMLspanID) {return null} + return document.getElementById(this.id||"MJXp-Span-"+this.PHTMLspanID); + }, + + PHTMLhandleToken: function (span) { + var values = this.getValues("mathvariant"); + if (values.mathvariant !== MML.VARIANT.NORMAL) { + span.className += " "+PHTML.VARIANT[values.mathvariant]; + } + }, + + PHTMLhandleStyle: function (span) { + if (this.style) span.style.cssText = this.style; + }, + + PHTMLhandleColor: function (span) { + if (this.mathcolor) {span.style.color = this.mathcolor} + if (this.mathbackground) {span.style.backgroundColor = this.mathbackground} + }, + + PHTMLhandleScriptlevel: function (span) { + // ### FIXME: Need to prevent getting too small + // ### and should keep track of scaling so it can be compensated for + var level = this.Get("scriptlevel"); + if (level) span.className += " MJXp-script"; + }, + + PHTMLhandleText: function (span,text) { + var c, n; + var H = 0, D = 0, W = 0; + for (var i = 0, m = text.length; i < m; i++) { + n = text.charCodeAt(i); c = text.charAt(i); + if (n >= 0xD800 && n < 0xDBFF) { + i++; n = (((n-0xD800)<<10)+(text.charCodeAt(i)-0xDC00))+0x10000; + } + var h = .7, d = .22, w = .5; + if (n < 127) { + if (c.match(/[A-Za-ehik-or-xz0-9]/)) d = 0; + if (c.match(/[A-HK-Z]/)) {w = .67} else if (c.match(/[IJ]/)) {w = .36} + if (c.match(/[acegm-su-z]/)) {h = .45} else if (c.match(/[ij]/)) {h = .75} + if (c.match(/[ijlt]/)) w = .28; + } + if (PHTML.DELIMITERS[c]) {w = PHTML.DELIMITERS[c].w || .4} + // ### FIXME: handle Greek + // ### Combining diacriticals (all sets), spacing modifiers + // ### arrows (all sets), widths of braces + if (h > H) H = h; if (d > D) D = d; W += w; + } + if (!this.CHML) this.PHTML = {}; + this.PHTML = {h:.9, d:.3, w:W, l:0, r:0, t:H, b:D}; + HTML.addText(span,text); + }, + + PHTMLbboxFor: function (n) { + if (this.data[n] && this.data[n].PHTML) return this.data[n].PHTML; + return {w:0, h:0, d:0, l:0, r:0, t:0, b:0}; + }, + + PHTMLcanStretch: function (direction,H,D) { + if (this.isEmbellished()) { + var core = this.Core(); + if (core && core !== this) {return core.PHTMLcanStretch(direction,H,D)} + } + return false; + }, + PHTMLstretchV: function (h,d) {}, + PHTMLstretchH: function (w) {}, + + CoreParent: function () { + var parent = this; + while (parent && parent.isEmbellished() && + parent.CoreMO() === this && !parent.isa(MML.math)) {parent = parent.Parent()} + return parent; + }, + CoreText: function (parent) { + if (!parent) {return ""} + if (parent.isEmbellished()) {return parent.CoreMO().data.join("")} + while ((parent.isa(MML.mrow) || parent.isa(MML.TeXAtom) || + parent.isa(MML.mstyle) || parent.isa(MML.mphantom)) && + parent.data.length === 1 && parent.data[0]) {parent = parent.data[0]} + if (!parent.isToken) {return ""} else {return parent.data.join("")} + } + + }); + + MML.chars.Augment({ + toPreviewHTML: function (span) { + var text = this.toString().replace(/[\u2061-\u2064]/g,""); + this.PHTMLhandleText(span,text); + } + }); + MML.entity.Augment({ + toPreviewHTML: function (span) { + var text = this.toString().replace(/[\u2061-\u2064]/g,""); + this.PHTMLhandleText(span,text); + } + }); + + MML.math.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + if (this.Get("display") === "block") {span.className += " MJXp-display"} + return span; + } + }); + + MML.mo.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + this.PHTMLadjustAccent(span); + var values = this.getValues("lspace","rspace","scriptlevel","displaystyle","largeop"); + if (values.scriptlevel === 0) { + this.PHTML.l = PHTML.length2em(values.lspace); + this.PHTML.r = PHTML.length2em(values.rspace); + span.style.marginLeft = PHTML.Em(this.PHTML.l); + span.style.marginRight = PHTML.Em(this.PHTML.r); + } else { + this.PHTML.l = .15; + this.PHTML.r = .1; + } + if (values.displaystyle && values.largeop) { + var box = HTML.Element("span",{className:"MJXp-largeop"}); + box.appendChild(span.firstChild); span.appendChild(box); + this.PHTML.h *= 1.2; this.PHTML.d *= 1.2; + if (this.data.join("") === "\u222B") box.className += " MJXp-int"; + } + // ### FIXME: Handle embellished op spacing + // ### FIXME: Remap minus signs + return span; + }, + PHTMLadjustAccent: function (span) { + var parent = this.CoreParent(); + if (parent && parent.isa(MML.munderover) && + this.CoreText(parent.data[parent.base]).length === 1) { + var over = parent.data[parent.over], under = parent.data[parent.under]; + var c = this.data.join(""), C; + if (over && this === over.CoreMO() && parent.Get("accent")) {C = PHTML.REMAPACCENT[c]} + else if (under && this === under.CoreMO() && parent.Get("accentunder")) {C = PHTML.REMAPACCENTUNDER[c]} + if (C) c = span.innerHTML = C; + if (c.match(/[\u02C6-\u02DC\u00A8]/)) {this.PHTML.acc = -.52} + else if (c === "\u2192") {this.PHTML.acc = -.15; this.PHTML.vec = true} + } + }, + PHTMLcanStretch: function (direction,H,D) { + if (!this.Get("stretchy")) {return false} + var c = this.data.join(""); + if (c.length > 1) {return false} + c = PHTML.DELIMITERS[c]; + var stretch = (c && c.dir === direction.substr(0,1)); + if (stretch) { + stretch = (this.PHTML.h !== H || this.PHTML.d !== D || + (this.Get("minsize",true) || this.Get("maxsize",true))); + } + return stretch; + }, + PHTMLstretchV: function (h,d) { + var span = this.PHTMLspanElement(), bbox = this.PHTML; //bbox.w = .4; // ## adjust width + var values = this.getValues("symmetric","maxsize","minsize"); + if (values.symmetric) {H = 2*Math.max(h-.25,d+.25)} else {H = h + d} + values.maxsize = PHTML.length2em(values.maxsize,bbox.h+bbox.d); + values.minsize = PHTML.length2em(values.minsize,bbox.h+bbox.d); + H = Math.max(values.minsize,Math.min(values.maxsize,H)); + var scale = H/(bbox.h+bbox.d-.3); // ### adjusted for extra tall bbox + var box = HTML.Element("span",{style:{"font-size":PHTML.Em(scale)}}); + if (scale > 1.25) { + var sX = Math.ceil(1.25/scale * 10); + box.className = "MJXp-right MJXp-scale"+sX; + box.style.marginLeft = PHTML.Em(bbox.w*(sX/10-1)+.07); + bbox.w *= scale*sX/10; + } + box.appendChild(span.firstChild); span.appendChild(box); + if (values.symmetric) span.style.verticalAlign = PHTML.Em(.25*(1-scale)); + } + }); + + MML.mspace.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + var values = this.getValues("height","depth","width"); + var w = PHTML.length2em(values.width), + h = PHTML.length2em(values.height), + d = PHTML.length2em(values.depth); + var bbox = this.PHTML; + bbox.w = w; bbox.h = h; bbox.d = d; + if (w < 0) { + // ### FIXME: lastIsInt hack + if (!PHTML.lastIsInt) span.style.marginLeft = PHTML.Em(w); + w = 0; + } + span.style.width = PHTML.Em(w); + span.style.height = PHTML.Em(h+d); + if (d) span.style.verticalAlign = PHTML.Em(-d); + return span; + } + }); + + MML.mpadded.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{ + childSpans:true, className:"MJXp-box", forceChild:true + }); + var child = span.firstChild; + var values = this.getValues("width","height","depth","lspace","voffset"); + var dimen = this.PHTMLdimen(values.lspace); + var T = 0, B = 0, L = dimen.len, R = -dimen.len, V = 0; + if (values.width !== "") { + dimen = this.PHTMLdimen(values.width,"w",0); + if (dimen.pm) {R += dimen.len} else {span.style.width = PHTML.Em(dimen.len)} + } + if (values.height !== "") { + dimen = this.PHTMLdimen(values.height,"h",0); + if (!dimen.pm) T += -this.PHTMLbboxFor(0).h; + T += dimen.len; + } + if (values.depth !== "") { + dimen = this.PHTMLdimen(values.depth,"d",0); + if (!dimen.pm) {B += -this.PHTMLbboxFor(0).d; V += -dimen.len} + B += dimen.len; + } + if (values.voffset !== "") { + dimen = this.PHTMLdimen(values.voffset); + T -= dimen.len; B += dimen.len; + V += dimen.len; + } + if (T) child.style.marginTop = PHTML.Em(T); + if (B) child.style.marginBottom = PHTML.Em(B); + if (L) child.style.marginLeft = PHTML.Em(L); + if (R) child.style.marginRight = PHTML.Em(R); + if (V) span.style.verticalAlign = PHTML.Em(V); + return span; + }, + PHTMLdimen: function (length,d,m) { + if (m == null) {m = -BIGDIMEN} + length = String(length); + var match = length.match(/width|height|depth/); + var size = (match ? this.PHTML[match[0].charAt(0)] : (d ? this.PHTML[d] : 0)); + return {len: PHTML.length2em(length,size)||0, pm: !!length.match(/^[-+]/)}; + } + }); + + MML.munderover.Augment({ + toPreviewHTML: function (span) { + var values = this.getValues("displaystyle","accent","accentunder","align"); + var base = this.data[this.base]; + if (!values.displaystyle && base != null && + (base.movablelimits || base.CoreMO().Get("movablelimits"))) { + span = MML.msubsup.prototype.toPreviewHTML.call(this,span); + // + // Change class to msubsup for CSS rules. + // ### FIXME: should this be handled via adding another class instead? + // + span.className = span.className.replace(/munderover/,"msubsup"); + return span; + } + span = this.PHTMLdefaultSpan(span,{childSpans:true, className:"", noBBox:true}); + var obox = this.PHTMLbboxFor(this.over), + ubox = this.PHTMLbboxFor(this.under), + bbox = this.PHTMLbboxFor(this.base), + BBOX = this.PHTML, acc = obox.acc; + if (this.data[this.over]) { + if (span.lastChild.firstChild){ + span.lastChild.firstChild.style.marginLeft = obox.l = + span.lastChild.firstChild.style.marginRight = obox.r = 0; + } + var over = HTML.Element("span",{},[["span",{className:"MJXp-over"}]]); + over.firstChild.appendChild(span.lastChild); + if (span.childNodes.length > (this.data[this.under] ? 1 : 0)) + over.firstChild.appendChild(span.firstChild); + this.data[this.over].PHTMLhandleScriptlevel(over.firstChild.firstChild); + if (acc != null) { + if (obox.vec) { + over.firstChild.firstChild.firstChild.style.fontSize = "60%"; + obox.h *= .6; obox.d *= .6; obox.w *= .6; + } + acc = acc - obox.d + .1; if (bbox.t != null) {acc += bbox.t - bbox.h} + over.firstChild.firstChild.style.marginBottom = PHTML.Em(acc); + } + if (span.firstChild) {span.insertBefore(over,span.firstChild)} + else {span.appendChild(over)} + } + if (this.data[this.under]) { + if (span.lastChild.firstChild) { + span.lastChild.firstChild.style.marginLeft = ubox.l = + span.lastChild.firstChild.marginRight = ubox.r = 0; + } + this.data[this.under].PHTMLhandleScriptlevel(span.lastChild); + } + BBOX.w = Math.max(.8*obox.w,.8*ubox.w,bbox.w); + BBOX.h = .8*(obox.h+obox.d+(acc||0)) + bbox.h; + BBOX.d = bbox.d + .8*(ubox.h+ubox.d); + return span; + } + }); + + MML.msubsup.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{noBBox:true}); + if (!this.data[this.base]) { + if (span.firstChild) {span.insertBefore(HTML.Element("span"),span.firstChild)} + else {span.appendChild(HTML.Element("span"))} + } + var base = this.data[this.base], sub = this.data[this.sub], sup = this.data[this.sup]; + if (!base) base = {bbox: {h:.8, d:.2}}; + span.firstChild.style.marginRight = ".05em"; + var h = Math.max(.4,base.PHTML.h-.4), + d = Math.max(.2,base.PHTML.d+.1); + var bbox = this.PHTML; + if (sup && sub) { + var box = HTML.Element("span",{className:"MJXp-script-box", style:{ + height: PHTML.Em(h+sup.PHTML.h*.8 + d+sub.PHTML.d*.8), + "vertical-align": PHTML.Em(-d-sub.PHTML.d*.8) + }},[ + ["span",{},[["span",{},[["span",{ + style:{"margin-bottom":PHTML.Em(-(sup.PHTML.d-.05))} + }]]]]], + ["span",{},[["span",{},[["span",{ + style:{"margin-top":PHTML.Em(-(sup.PHTML.h-.05))} + }]]]]] + ]); + sub.PHTMLhandleScriptlevel(box.firstChild); + sup.PHTMLhandleScriptlevel(box.lastChild); + box.firstChild.firstChild.firstChild.appendChild(span.lastChild); + box.lastChild.firstChild.firstChild.appendChild(span.lastChild); + span.appendChild(box); + bbox.h = Math.max(base.PHTML.h,sup.PHTML.h*.8+h); + bbox.d = Math.max(base.PHTML.d,sub.PHTML.d*.8+d); + bbox.w = base.PHTML.w + Math.max(sup.PHTML.w,sub.PHTML.w) + .07; + } else if (sup) { + span.lastChild.style.verticalAlign = PHTML.Em(h); + sup.PHTMLhandleScriptlevel(span.lastChild); + bbox.h = Math.max(base.PHTML.h,sup.PHTML.h*.8+h); + bbox.d = Math.max(base.PHTML.d,sup.PHTML.d*.8-h); + bbox.w = base.PHTML.w + sup.PHTML.w + .07; + } else if (sub) { + span.lastChild.style.verticalAlign = PHTML.Em(-d); + sub.PHTMLhandleScriptlevel(span.lastChild); + bbox.h = Math.max(base.PHTML.h,sub.PHTML.h*.8-d); + bbox.d = Math.max(base.PHTML.d,sub.PHTML.d*.8+d); + bbox.w = base.PHTML.w + sub.PHTML.w + .07; + } + return span; + } + }); + + MML.mfrac.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{ + childSpans:true, className:"MJXp-box", forceChild:true, noBBox:true + }); + var values = this.getValues("linethickness","displaystyle"); + if (!values.displaystyle) { + if (this.data[0]) this.data[0].PHTMLhandleScriptlevel(span.firstChild); + if (this.data[1]) this.data[1].PHTMLhandleScriptlevel(span.lastChild); + } + var denom = HTML.Element("span",{className:"MJXp-box"},[ + ["span",{className:"MJXp-denom"},[ // inline-table + ["span",{},[["span",{className:"MJXp-rule",style:{height:"1em"}}]]], + ["span"] // spans are table-row + ]] + ]); + denom.firstChild.lastChild.appendChild(span.lastChild); + span.appendChild(denom); + var nbox = this.PHTMLbboxFor(0), dbox = this.PHTMLbboxFor(1), bbox = this.PHTML; + bbox.w = Math.max(nbox.w,dbox.w) * .8; + bbox.h = nbox.h+nbox.d + .1 + .25; + bbox.d = dbox.h+dbox.d - .25; + bbox.l = bbox.r = .125; + values.linethickness = Math.max(0,PHTML.length2em(values.linethickness||"0",0)); + if (values.linethickness) { + var rule = denom.firstChild.firstChild.firstChild; + var t = PHTML.Em(values.linethickness); + rule.style.borderTop = "none"; + rule.style.borderBottom = (values.linethickness < .15 ? "1px" : t)+" solid"; + rule.style.margin = t+" 0"; + t = values.linethickness; + denom.style.marginTop = PHTML.Em(3*t-1.2); + span.style.verticalAlign = PHTML.Em(1.5*t + .1); + bbox.h += 1.5*t - .1; bbox.d += 1.5*t; + } else { + denom.style.marginTop = "-.7em"; + } + return span; + } + }); + + MML.msqrt.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{ + childSpans:true, className:"MJXp-box", forceChild:true, noBBox:true + }); + this.PHTMLlayoutRoot(span,span.firstChild); + return span; + }, + PHTMLlayoutRoot: function (span,base) { + var bbox = this.PHTMLbboxFor(0); + var scale = Math.ceil((bbox.h+bbox.d+.14)*100), t = PHTML.Em(14/scale); + var surd = HTML.Element("span",{className:"MJXp-surd"},[ + ["span",{style:{"font-size":scale+"%","margin-top":t}},["\u221A"]] + ]); + var root = HTML.Element("span",{className:"MJXp-root"},[ + ["span",{className:"MJXp-rule",style:{"border-top":".08em solid"}}] + ]); + var W = (1.2/2.2)*scale/100; // width-of-surd = (height/H-to-W-ratio) + if (scale > 150) { + var sX = Math.ceil(150/scale * 10); + surd.firstChild.className = "MJXp-right MJXp-scale"+sX; + surd.firstChild.style.marginLeft = PHTML.Em(W*(sX/10-1)/scale*100); + W = W*sX/10; + root.firstChild.style.borderTopWidth = PHTML.Em(.08/Math.sqrt(sX/10)); + } + root.appendChild(base); + span.appendChild(surd); + span.appendChild(root); + this.PHTML.h = bbox.h + .18; this.PHTML.d = bbox.d; + this.PHTML.w = bbox.w + W; + return span; + } + }); + + MML.mroot.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{ + childSpans:true, className:"MJXp-box", forceChild:true, noBBox:true + }); + var rbox = this.PHTMLbboxFor(1), root = span.removeChild(span.lastChild); + var sqrt = this.PHTMLlayoutRoot(HTML.Element("span"),span.firstChild); + root.className = "MJXp-script"; // ### FIXME: should be scriptscript + var scale = parseInt(sqrt.firstChild.firstChild.style.fontSize); + var v = .55*(scale/120) + rbox.d*.8, r = -.6*(scale/120); + if (scale > 150) {r *= .95*Math.ceil(150/scale*10)/10} + root.style.marginRight = PHTML.Em(r); root.style.verticalAlign = PHTML.Em(v); + if (-r > rbox.w*.8) root.style.marginLeft = PHTML.Em(-r-rbox.w*.8); // ### depends on rbox.w + span.appendChild(root); span.appendChild(sqrt); + this.PHTML.w += Math.max(0,rbox.w*.8+r); + this.PHTML.h = Math.max(this.PHTML.h,rbox.h*.8+v); + return span; + }, + PHTMLlayoutRoot: MML.msqrt.prototype.PHTMLlayoutRoot + }); + + MML.mfenced.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLcreateSpan(span); + this.PHTMLhandleStyle(span); + this.PHTMLhandleColor(span); + // + // Make row of open, data, sep, ... data, close + // + this.addFakeNodes(); + this.PHTMLaddChild(span,"open",{}); + for (var i = 0, m = this.data.length; i < m; i++) { + this.PHTMLaddChild(span,"sep"+i,{}); + this.PHTMLaddChild(span,i,{}); + } + this.PHTMLaddChild(span,"close",{}); + // + // Check for streching the elements + // + var H = this.PHTML.h, D = this.PHTML.d; + this.PHTMLstretchChild("open",H,D); + for (i = 0, m = this.data.length; i < m; i++) { + this.PHTMLstretchChild("sep"+i,H,D); + this.PHTMLstretchChild(i,H,D); + } + this.PHTMLstretchChild("close",H,D); + return span; + } + }); + + MML.mrow.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + var H = this.PHTML.h, D = this.PHTML.d; + for (var i = 0, m = this.data.length; i < m; i++) this.PHTMLstretchChild(i,H,D); + return span; + } + }); + + MML.mstyle.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + this.PHTMLhandleScriptlevel(span); + return span; + } + }); + + MML.TeXAtom.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span); + // ### FIXME: handle TeX class? + span.className = "MJXp-mrow"; + return span; + } + }); + + MML.mtable.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLdefaultSpan(span,{noBBox:true}); + var values = this.getValues("columnalign","rowalign","columnspacing","rowspacing", + "columnwidth","equalcolumns","equalrows", + "columnlines","rowlines","frame","framespacing", + "align","width"); + var SPLIT = MathJax.Hub.SplitList, i, m, j, n; + var CSPACE = SPLIT(values.columnspacing), + RSPACE = SPLIT(values.rowspacing), + CALIGN = SPLIT(values.columnalign), + RALIGN = SPLIT(values.rowalign); + for (i = 0, m = CSPACE.length; i < m; i++) {CSPACE[i] = PHTML.length2em(CSPACE[i])} + for (i = 0, m = RSPACE.length; i < m; i++) {RSPACE[i] = PHTML.length2em(RSPACE[i])} + + var table = HTML.Element("span"); + while (span.firstChild) table.appendChild(span.firstChild); + span.appendChild(table); + var H = 0, W = 0; + for (i = 0, m = this.data.length; i < m; i++) { + var row = this.data[i]; + if (row) { + var rspace = PHTML.arrayEntry(RSPACE,i-1), ralign = PHTML.arrayEntry(RALIGN,i); + var rbox = row.PHTML, rspan = row.PHTMLspanElement(); + rspan.style.verticalAlign = ralign; + var k = (row.type === "mlabeledtr" ? 1 : 0); + for (j = 0, n = row.data.length; j < n-k; j++) { + var cell = row.data[j+k]; + if (cell) { + var cspace = PHTML.arrayEntry(CSPACE,j-1), calign = PHTML.arrayEntry(CALIGN,j); + var cspan = cell.PHTMLspanElement(); + if (j) {rbox.w += cspace; cspan.style.paddingLeft = PHTML.Em(cspace)} + if (i) cspan.style.paddingTop = PHTML.Em(rspace); + cspan.style.textAlign = calign; + } + } + H += rbox.h + rbox.d; if (i) {H += rspace} + if (rbox.w > W) W = rbox.w; + } + } + var bbox = this.PHTML; + bbox.w = W; bbox.h = H/2 + .25; bbox.d = H/2 - .25; + bbox.l = bbox.r = .125; + return span; + } + }); + MML.mlabeledtr.Augment({ + PHTMLdefaultSpan: function (span,options) { + if (!options) options = {}; + span = this.PHTMLcreateSpan(span); + this.PHTMLhandleStyle(span); + this.PHTMLhandleColor(span); + if (this.isToken) this.PHTMLhandleToken(span); + // skip label for now + for (var i = 1, m = this.data.length; i < m; i++) this.PHTMLaddChild(span,i,options); + return span; + } + }); + + MML.semantics.Augment({ + toPreviewHTML: function (span) { + span = this.PHTMLcreateSpan(span); + if (this.data[0]) { + this.data[0].toPreviewHTML(span); + MathJax.Hub.Insert(this.data[0].PHTML||{},this.PHTML); + } + return span; + } + }); + MML.annotation.Augment({toPreviewHTML: function(span) {}}); + MML["annotation-xml"].Augment({toPreviewHTML: function(span) {}}); + + // + // Loading isn't complete until the element jax is modified, + // but can't call loadComplete within the callback for "mml Jax Ready" + // (it would call PreviewHTML's Require routine, asking for the mml jax again) + // so wait until after the mml jax has finished processing. + // + // We also need to wait for the onload handler to run, since the loadComplete + // will call Config and Startup, which need to modify the body. + // + MathJax.Hub.Register.StartupHook("onLoad",function () { + setTimeout(MathJax.Callback(["loadComplete",PHTML,"jax.js"]),0); + }); + }); + + MathJax.Hub.Register.StartupHook("End Cookie", function () { + if (HUB.config.menuSettings.zoom !== "None") + {AJAX.Require("[MathJax]/extensions/MathZoom.js")} + }); + +})(MathJax.Ajax,MathJax.Hub,MathJax.HTML,MathJax.OutputJax.PreviewHTML); +// @license-end diff --git a/js/mathjax/local/local.js b/js/mathjax/local/local.js new file mode 100644 index 0000000..8827f0a --- /dev/null +++ b/js/mathjax/local/local.js @@ -0,0 +1,42 @@ +// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7dn=apache-2.0.txt Apache-2.0 +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ + +/************************************************************* + * + * MathJax/config/local/local.js + * + * Include changes and configuration local to your installation + * in this file. For example, common macros can be defined here + * (see below). To use this file, add "local/local.js" to the + * config array in MathJax.js or your MathJax.Hub.Config() call. + * + * --------------------------------------------------------------------- + * + * Copyright (c) 2009-2020 The MathJax Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { + var TEX = MathJax.InputJax.TeX; + + // place macros here. E.g.: + // TEX.Macro("R","{\\bf R}"); + // TEX.Macro("op","\\mathop{\\rm #1}",1); // a macro with 1 parameter + +}); + +MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js"); +// @license-end diff --git a/mathjax-librejs.sh b/mathjax-librejs.sh new file mode 100755 index 0000000..592a15d --- /dev/null +++ b/mathjax-librejs.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sed -i 's/^\s*\*\s*Copyright/ * @licstart The following is the entire license notice for the \n * JavaScript code in this page.\n *\n&/' $1 + +sed -i 's/^\s*\*\// *\n * @licend The above is the entire license notice\n * for the JavaScript code in this page.\n&/' $1 diff --git a/pages/index.org b/pages/index.org new file mode 100644 index 0000000..64a0e54 --- /dev/null +++ b/pages/index.org @@ -0,0 +1,13 @@ +#+title: Yuchen Pei + +Hello! I am Yuchen. You have reached my personal website. + +I am a programmer, mathematician and free software advocate. + +I did a PhD at the [[https://warwick.ac.uk/fac/sci/masdoc][MASDOC program at Warwick]], and spent two years in a postdoc position at [[http://cmsa.fas.harvard.edu][CMSA at Harvard]] and another one and a half years at the [[https://www.math.kth.se/RMSMA/][KTH RMSMA group]]. After that I worked as a full stack web developer for two years. + +I am an associate member and licensing volunteer of the [[https://fsf.org][Free Software Foundation]], and have applied the philosophy of free software to knowledge and research. For example I shared my research in Robinson-Schensted algorithms as a [[https://toywiki.xyz][wiki]] under a free Creative Commons license. I believe anyone can be an academic, seeking truth and sharing their findings with the public. + +I can be reached at: hi@[the domain of this site] (PGP key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0). Feel free to email me, whether you know me or not. + +Views expressed on this website do not represent those of my past, present or future employers or associates. diff --git a/pages/links.org b/pages/links.org new file mode 100644 index 0000000..d70091e --- /dev/null +++ b/pages/links.org @@ -0,0 +1,69 @@ +#+title: Links + +Here are some links I find interesting or helpful, or both. Listed in no +particular order. + +- [[http://worrydream.com/][Bret Victor]] +- [[https://www.peterkrautzberger.org/archive/][Peter Krautzberger]] +- [[https://web.stanford.edu/~cpiech/bio/index.html][Chris Piech]] +- [[https://www.scilag.net/][SciLag]] +- [[https://satwcomic.com/][Scandinavia and the World]] +- [[http://www.arxiv-sanity.com/][Arxiv Sanity Preserver]] +- [[http://www.shortscience.org/][ShortScience.org]] +- [[https://paperswithcode.com/][Papers with Code]] +- [[https://distill.pub/][Distill]] +- [[https://competitions.codalab.org/competitions/][CodaLab]] +- [[https://haskellformaths.blogspot.com/][HaskellForMaths]] +- [[http://www.openproblemgarden.org/][Open Problem Garden]] +- [[http://www.ams.org/open-math-notes][AMS open notes]] +- [[http://garsia.math.yorku.ca/MPWP/][Macdonald polynomials webpage]] +- [[https://news.ycombinator.com/][Hacker News]] +- [[http://arminstraub.com/][Armin Straub]] +- [[http://www-math.ucdenver.edu/~wcherowi/][Bill Cherowitzo]] +- [[https://stallman.org/][Richard Stallman]] +- [[http://www.aaronsw.com/][Aaron Swartz]] - The Internet's own boy +- [[https://docs.google.com/document/d/10eA5-mCZLSS4MQY5QGb5ewC3VAL6pLkT53V_81ZyitM/preview][False, + Misleading, Clickbait-y, and/or Satirical "News" Sources]] +- [[http://www.math.utah.edu/~jasonu/deala/][Differential Equations & + Linear Algebra]] - Lecture notes on the web +- [[http://wstein.org/][William Stein]] - William Stein, the creator of + SageMath + + - [[http://wstein.org/talks/2016-06-sage-bp/][The origins of + SageMath]] Stein's BP centenary talk at Harvard + +- [[http://www.sagemath.org/][SageMath]] - Open-source maths software + system\\ +- [[https://projecteuler.net/][Project Euler]] +- [[https://blockly-games.appspot.com/about?lang=en][Blockly games]] +- [[https://jeremykun.com/][Math ∩ Programming]] +- [[https://www.authorea.com/][Authorea]] +- [[http://bigdata.show][Big Data]] +- [[http://fermatslibrary.com/][Fermat's Library]] +- [[http://www.tricki.org/][Tricki]] +- [[http://www.ams.org/samplings/feature-column/fc-current.cgi][AMS + Feature Column]] +- [[https://arxiv.org][arXiv]] +- [[https://terrytao.wordpress.com/][What's new]] - Terence Tao's blog +- [[https://gowers.wordpress.com/][Gowers's weblog]] - Timothy Gowers's + blog +- [[http://michaelnielsen.org/polymath1/index.php?title=Main_Page][Polymath]] - + MMO maths research +- [[https://oeis.org/][OEIS]] - The On-Line Encyclopedia of Integer + Sequences® (OEIS®) +- +[[http://www.vim.org][Vi IMproved]] - the one true text editor.+ I'm + switching to using [[https://www.gnu.org/software/emacs/][GNU Emacs]] + now. +- [[http://regex.alf.nu/][Regex Golf]] +- [[http://regexcrossword.com/][Regex Crossword]] +- [[http://archlinux.org][Arch Linux]] +- [[https://jupyter.org/][Jupyter notebook]] - An open-source notebook +- Stackexchange sites + + - [[https://mathoverflow.net/][Mathoverflow]] + - [[https://math.stackexchange.com/][Mathematics]] + - [[https://codegolf.stackexchange.com/][Codegolf]] - The most fun + corner of Stackexchange. + +- [[http://math.stanford.edu/~bump/][Danial Bump]] +- [[http://www.math.ubc.ca/~cass/][Bill Casselman]] diff --git a/pages/notations.org b/pages/notations.org new file mode 100644 index 0000000..691a9d6 --- /dev/null +++ b/pages/notations.org @@ -0,0 +1,53 @@ +#+title: List of Notations + +#+date: 2019-03-15 + +Here I list meanings of notations that may have not been explained +elsewhere. + +- \(\text{ty}\): type. Given a word \(w \in [n]^\ell\), + \(\text{ty} w = (m_1, m_2, ..., m_n)\) where \(m_i\) is the number of + \(i\)'s in \(w\). For example + \(\text{ty} (1, 2, 2, 1, 4, 2) = (2, 3, 0, 1)\). The definition of + \(\text{ty} T\) for a tableau \(T\) is similar. +- \([n]\): for \(n \in \mathbb N_{>0}\), \([n]\) stands for the set + \(\{1, 2, ..., n\}\). +- \(i : j\): for \(i, j \in \mathbb Z\), \(i : j\) stands for the set + \(\{i, i + 1, ..., j\}\), or the sequence \((i, i + 1, ..., j)\), + depending on the context. +- \(k = i : j\): means \(k\) iterates over \(i\), \(i + 1\),..., \(j\). + For example \(\sum_{k = 1 : n} a_k := \sum_{k = 1}^n a_k\). +- \(x_{i : j}\): stands for the set \(\{x_k: k = i : j\}\) or the + sequence \((x_i, x_{i + 1}, ..., x_j)\), depending on the context. So + are notations like \(f(i : j)\), \(y^{i : j}\) etc. +- \(\mathbb N\): the set of natural numbers / nonnegative integer + numbers \(\{0, 1, 2,...\}\), whereas +- \(\mathbb N_{>0}\) or \(\mathbb N^+\): Are the set of positive integer + numbers. +- \(x^w\): when both \(x\) and \(w\) are tuples of objects, this means + \(\prod_i x_{w_i}\). For example say \(w = (1, 2, 2, 1, 4, 2)\), and + \(x = x_{1 : 7}\), then \(x^w = x_1^2 x_2^3 x_4\). +- \(LHS\), LHS, \(RHS\), RHS: left hand side and right hand side of a + formula +- \(e_i\): the \(i\)th standard basis in a vector space: + \(e_i = (0, 0, ..., 0, 1, 0, 0, ...)\) where the sequence is finite or + infinite depending on the dimension of the vector space and the \(1\) + is the \(i\)th entry and all other entries are \(0\). +- \(1_{A}(x)\) where \(A\) is a set: an indicator function, which + evaluates to \(1\) if \(x \in A\), and \(0\) otherwise. +- \(1_{p}\): an indicator function, which evaluates to \(1\) if the + predicate \(p\) is true and \(0\) otherwise. Example: \(1_{x \in A}\), + same as \(1_A(x)\). +- \(\xi \sim p\): the random variable \(xi\) is distributed according to + the probability density function / probability mass function / + probability measure \(p\). +- \(\xi \overset{d}{=} \eta\): the random variables \(\xi\) and \(\eta\) + have the same distribution. +- \(\mathbb E f(\xi)\): expectation of \(f(\xi)\). +- \(\mathbb P(A)\): probability of event \(A\). +- \(a \wedge b\): \(\min\{a, b\}\). +- \(a \vee b\): \(\max\{a, b\}\). +- \((\alpha)_+\): the positive part of \(\alpha\), + i.e. \(\alpha \vee 0\). +- \((\alpha)_-\): the negative part of \(\alpha\), + i.e. \((- \alpha)_+\). diff --git a/posts/2019-03-13-a-tail-of-two-densities.org b/posts/2019-03-13-a-tail-of-two-densities.org index f1b6b15..c57afcd 100644 --- a/posts/2019-03-13-a-tail-of-two-densities.org +++ b/posts/2019-03-13-a-tail-of-two-densities.org @@ -485,7 +485,7 @@ respectively. Then the following are equivalent: \(q_i(\cdot | y_{< i})\) are \((\epsilon, \delta)\)-ind 2. There exists events \(E_i, F_i \subset \Omega\) with - \(\mathbb P(E_i | \xi_{" + :html-head " +" :html-preamble me/html-preamble :html-self-link-headlines t :author ("Yuchen Pei") @@ -133,7 +134,9 @@ PUB-DIR is when the output will be placed." :recursive t :publishing-function org-html-publish-to-html :html-head " - " + + + " :html-preamble me/html-preamble :author ("Yuchen Pei") :html-postamble me/html-postamble diff --git a/rss.py b/rss.py new file mode 100644 index 0000000..869ef6f --- /dev/null +++ b/rss.py @@ -0,0 +1,111 @@ +import datetime +from lxml import etree, html +import os +import re + +_DOMAIN = 'https://ypei.me' +_RSS_TAGNAME = 'rss' +_RSS_ATTRIBS = {'version': '2.0'} + +_POSTS_HTML_DIR = 'site/posts' +_POSTS_ORG_DIR = 'posts' +_POSTS_BASE_URL = _DOMAIN + '/posts' +_BLOG_FEED_PATH = 'site/blog-feed.xml' + +_MICROBLOG_URL = _DOMAIN + '/microblog.html' +_MICROBLOG_PATH = 'site/microblog.html' +_MICROBLOG_FEED_PATH = 'site/microblog-feed.xml' + + +def get_date(org): + return re.search('^#\+(date|DATE): <(.*)>$', org, re.MULTILINE).group(2) + +def make_rss_root(): + return etree.Element(_RSS_TAGNAME, attrib=_RSS_ATTRIBS) + +def make_post_item(post_html, post_org, post_filename): + post = etree.Element('item') + tree = html.fromstring(post_html) + post.append(tree.find('./head/title')) + content = tree.find('.//div[@id="content"]') + content.tag = 'description' + content.attrib.clear() + post.append(content) + etree.SubElement(post, 'link').text = _POSTS_BASE_URL + '/' + post_filename + etree.SubElement(post, 'pubDate').text = get_date(post_org) + return post + +def make_post_items(): + posts = [] + for post in os.listdir(_POSTS_HTML_DIR): + post_sans_ext, ext = os.path.splitext(post) + if ext != '.html': continue + post_html = open(_POSTS_HTML_DIR + '/' + post, 'rb').read() + post_org = open(_POSTS_ORG_DIR + '/' + post_sans_ext + '.org').read() + posts.append(make_post_item(post_html, post_org, post)) + posts.sort(key=lambda post: post.find('./pubDate').text, reverse=True) + return posts + +def make_blog_channel(): + channel = etree.Element('channel') + etree.SubElement(channel, 'title').text = 'Yuchen Pei\'s blog' + etree.SubElement(channel, 'description').text = 'Yuchen Pei\'s blog' + etree.SubElement(channel, 'link').text = _DOMAIN + '/blog.html' + etree.SubElement(channel, 'copyright').text = '2013-2021 Yuchen Pei, licensed under CC BY-SA 4.0' + etree.SubElement(channel, 'lastBuildDate').text = str(datetime.datetime.now()) + for post in make_post_items(): + channel.append(post) + return channel + +def make_blog_rss(): + root = make_rss_root() + root.append(make_blog_channel()) + open(_BLOG_FEED_PATH, 'w').write(etree.tostring(root, encoding='unicode')) + return root + +def make_micropost_item(micropost_html): + """ + The header of a micropost has the following format: +

+ 2020-08-02 - ia lawsuit + +

+ """ + micropost = etree.Element('item') + header = micropost_html.find('./p') + etree.SubElement(micropost, 'link').text = _MICROBLOG_URL + header.find('.//a').attrib['href'] + etree.SubElement(micropost, 'pubDate').text = header.find('.//a').text + etree.SubElement(micropost, 'title').text = header.find('./b').tail[3:].strip() + micropost_html.remove(header) + micropost_html.tag = 'description' + micropost.append(micropost_html) + return micropost + +def make_and_add_micropost_items(channel): + microblog = html.fromstring(open(_MICROBLOG_PATH, 'rb').read()) + for micropost in microblog.findall('.//div[@id="content"]/ul/li'): + channel.append(make_micropost_item(micropost)) + +def make_microblog_channel(): + channel = etree.Element('channel') + etree.SubElement(channel, 'title').text = 'Yuchen Pei\'s microblog' + etree.SubElement(channel, 'description').text = 'Yuchen Pei\'s microblog' + etree.SubElement(channel, 'link').text = _MICROBLOG_URL + etree.SubElement(channel, 'lastBuildDate').text = str(datetime.datetime.now()) + make_and_add_micropost_items(channel) + return channel + +def make_microblog_rss(): + root = make_rss_root() + root.append(make_microblog_channel()) + open(_MICROBLOG_FEED_PATH, 'w').write(etree.tostring(root, encoding='unicode')) + return root + +def main(): + make_blog_rss() + print(f"Published blog rss to {_BLOG_FEED_PATH}.") + make_microblog_rss() + print(f"Published microblog rss to {_MICROBLOG_FEED_PATH}.") + +if __name__ == '__main__': + main() -- cgit v1.2.3