jekyll-theme-hydejack 8.3.2 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (392) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1208 -0
  3. data/LICENSE.md +9 -3
  4. data/NOTICE.md +290 -0
  5. data/README.md +135 -93
  6. data/_config.yml +73 -0
  7. data/_includes/base-classes +9 -0
  8. data/_includes/body/analytics.html +1 -1
  9. data/_includes/body/comments.html +1 -1
  10. data/_includes/body/footer.html +3 -3
  11. data/_includes/body/index.html +17 -16
  12. data/_includes/body/main.html +3 -13
  13. data/_includes/body/menu.html +3 -2
  14. data/_includes/body/nav.html +4 -4
  15. data/_includes/body/scripts.html +5 -20
  16. data/_includes/body/sidebar-bg.html +13 -0
  17. data/_includes/body/sidebar-sticky.html +25 -0
  18. data/_includes/body/sidebar.html +7 -40
  19. data/_includes/components/about.html +1 -1
  20. data/_includes/components/author.html +3 -3
  21. data/_includes/components/hy-img.html +15 -26
  22. data/_includes/components/link.html +1 -1
  23. data/_includes/components/message.html +1 -1
  24. data/_includes/components/post-list-item.html +3 -5
  25. data/_includes/components/post.html +14 -11
  26. data/_includes/components/related-posts.html +14 -4
  27. data/_includes/components/tag-list.html +5 -1
  28. data/_includes/head/css/inline +1 -0
  29. data/_includes/head/index.html +14 -8
  30. data/_includes/head/links-static.html +27 -0
  31. data/_includes/head/links.html +1 -34
  32. data/_includes/head/meta-static.html +18 -0
  33. data/_includes/head/meta.html +9 -21
  34. data/_includes/head/page-style.html +1 -3
  35. data/_includes/head/scripts.html +13 -14
  36. data/_includes/head/styles-inline.html +19 -0
  37. data/_includes/head/styles-layout.html +4 -0
  38. data/_includes/head/styles-no-inline.html +8 -0
  39. data/_includes/head/styles.html +5 -46
  40. data/_includes/header.txt +1 -1
  41. data/_includes/if-non-null +7 -0
  42. data/_includes/my-body.html +1 -1
  43. data/_includes/my-scripts.html +1 -1
  44. data/_includes/scripts/load-js.min.js +1 -1
  45. data/_includes/scripts/nomodule.js +21 -0
  46. data/_includes/scripts/nomodule.min.js +1 -0
  47. data/_includes/smart-url +1 -0
  48. data/_includes/smart-url.txt +1 -1
  49. data/_includes/styles/common.scss +18 -0
  50. data/_includes/styles/inline.scss +16 -38
  51. data/_includes/styles/page-style.scss +5 -52
  52. data/_includes/styles/style.scss +22 -43
  53. data/_includes/styles/variables.scss +62 -0
  54. data/_includes/templates/animation.html +1 -1
  55. data/_includes/templates/back.html +3 -3
  56. data/_includes/templates/error.html +1 -1
  57. data/_includes/templates/forward.html +6 -0
  58. data/_includes/templates/index.html +10 -10
  59. data/_includes/templates/loading.html +1 -1
  60. data/_includes/templates/permalink.html +2 -2
  61. data/_layouts/about.html +1 -1
  62. data/_layouts/base.html +7 -2
  63. data/_layouts/blog.html +9 -7
  64. data/_layouts/compress.html +1 -1
  65. data/_layouts/default.html +4 -4
  66. data/_layouts/list.html +11 -17
  67. data/_layouts/page.html +1 -0
  68. data/_layouts/post.html +5 -3
  69. data/_sass/_mixins.scss +7 -21
  70. data/_sass/_spinner.scss +1 -1
  71. data/_sass/_syntax.scss +142 -130
  72. data/_sass/_variables.scss +2 -43
  73. data/_sass/html.scss +42 -0
  74. data/_sass/hydejack/__inline__/_avatar.scss +10 -10
  75. data/_sass/hydejack/__inline__/_base.scss +7 -21
  76. data/_sass/hydejack/__inline__/_content.scss +9 -2
  77. data/_sass/hydejack/__inline__/_images.scss +1 -3
  78. data/_sass/hydejack/__inline__/_links.scss +28 -13
  79. data/_sass/hydejack/__inline__/_menu.scss +42 -13
  80. data/_sass/hydejack/__inline__/_sidebar.scss +40 -14
  81. data/_sass/hydejack/__inline__/_social.scss +3 -0
  82. data/_sass/hydejack/__inline__/_toc.scss +55 -0
  83. data/_sass/hydejack/__inline__/_utilities.scss +3 -0
  84. data/_sass/hydejack/__link__/_avatar.scss +0 -4
  85. data/_sass/hydejack/__link__/_base.scss +1 -2
  86. data/_sass/hydejack/__link__/_break-layout.scss +17 -8
  87. data/_sass/hydejack/__link__/_content.scss +1 -0
  88. data/_sass/hydejack/__link__/_footer.scss +6 -8
  89. data/_sass/hydejack/__link__/_images.scss +8 -39
  90. data/_sass/hydejack/__link__/_katex.scss +1 -26
  91. data/_sass/hydejack/__link__/_links.scss +29 -20
  92. data/_sass/hydejack/__link__/_mark-external.scss +2 -7
  93. data/_sass/hydejack/__link__/_menu.scss +63 -8
  94. data/_sass/hydejack/__link__/_sidebar.scss +12 -9
  95. data/_sass/hydejack/__link__/_toc.scss +53 -0
  96. data/_sass/hydejack/__link__/_utilities.scss +3 -0
  97. data/_sass/hydejack/_avatar.pre.scss +10 -12
  98. data/_sass/hydejack/_base.pre.scss +7 -23
  99. data/_sass/hydejack/_break-layout.pre.scss +19 -10
  100. data/_sass/hydejack/_content.pre.scss +10 -2
  101. data/_sass/hydejack/_footer.pre.scss +6 -8
  102. data/_sass/hydejack/_images.pre.scss +9 -41
  103. data/_sass/hydejack/_katex.pre.scss +3 -28
  104. data/_sass/hydejack/_links.pre.scss +49 -19
  105. data/_sass/hydejack/_mark-external.pre.scss +2 -7
  106. data/_sass/hydejack/_menu.pre.scss +91 -22
  107. data/_sass/hydejack/_sidebar.pre.scss +48 -22
  108. data/_sass/hydejack/_social.pre.scss +3 -0
  109. data/_sass/hydejack/_toc.pre.scss +65 -0
  110. data/_sass/hydejack/_utilities.pre.scss +3 -0
  111. data/_sass/my-inline.scss +2 -16
  112. data/_sass/my-style.scss +0 -9
  113. data/_sass/pooleparty/__inline__/_base.scss +14 -9
  114. data/_sass/pooleparty/__inline__/_message.scss +31 -0
  115. data/_sass/pooleparty/__inline__/_posts.scss +19 -2
  116. data/_sass/pooleparty/__inline__/_table.scss +0 -28
  117. data/_sass/pooleparty/__inline__/_type.scss +81 -15
  118. data/_sass/pooleparty/__link__/_base.scss +11 -5
  119. data/_sass/pooleparty/__link__/_code.scss +40 -7
  120. data/_sass/pooleparty/__link__/_footnotes.scss +4 -5
  121. data/_sass/pooleparty/__link__/_pagination.scss +3 -2
  122. data/_sass/pooleparty/__link__/_posts.scss +11 -6
  123. data/_sass/pooleparty/__link__/_read-more.scss +1 -1
  124. data/_sass/pooleparty/__link__/_table.scss +27 -17
  125. data/_sass/pooleparty/__link__/_type.scss +56 -19
  126. data/_sass/pooleparty/_base.pre.scss +29 -18
  127. data/_sass/pooleparty/_code.pre.scss +40 -7
  128. data/_sass/pooleparty/_footnotes.pre.scss +4 -5
  129. data/_sass/pooleparty/_message.pre.scss +33 -2
  130. data/_sass/pooleparty/_pagination.pre.scss +5 -4
  131. data/_sass/pooleparty/_posts.pre.scss +34 -12
  132. data/_sass/pooleparty/_read-more.pre.scss +1 -1
  133. data/_sass/pooleparty/_table.pre.scss +13 -21
  134. data/_sass/pooleparty/_type.pre.scss +100 -35
  135. data/assets/bower.json +1 -2
  136. data/assets/bower_components/MathJax/.bower.json +28 -0
  137. data/assets/bower_components/MathJax/LICENSE +202 -0
  138. data/assets/bower_components/MathJax/bower.json +11 -0
  139. data/assets/bower_components/MathJax/composer.json +14 -0
  140. data/assets/bower_components/MathJax/es5/a11y/assistive-mml.js +1 -0
  141. data/assets/bower_components/MathJax/es5/a11y/complexity.js +1 -0
  142. data/assets/bower_components/MathJax/es5/a11y/explorer.js +1 -0
  143. data/assets/bower_components/MathJax/es5/a11y/semantic-enrich.js +1 -0
  144. data/assets/bower_components/MathJax/es5/adaptors/liteDOM.js +1 -0
  145. data/assets/bower_components/MathJax/es5/core.js +1 -0
  146. data/assets/bower_components/MathJax/es5/input/asciimath.js +1 -0
  147. data/assets/bower_components/MathJax/es5/input/mml.js +1 -0
  148. data/assets/bower_components/MathJax/es5/input/mml/entities.js +1 -0
  149. data/assets/bower_components/MathJax/es5/input/tex-base.js +1 -0
  150. data/assets/bower_components/MathJax/es5/input/tex-full.js +1 -0
  151. data/assets/bower_components/MathJax/es5/input/tex.js +1 -0
  152. data/assets/bower_components/MathJax/es5/input/tex/extensions/action.js +1 -0
  153. data/assets/bower_components/MathJax/es5/input/tex/extensions/all-packages.js +1 -0
  154. data/assets/bower_components/MathJax/es5/input/tex/extensions/ams.js +1 -0
  155. data/assets/bower_components/MathJax/es5/input/tex/extensions/amscd.js +1 -0
  156. data/assets/bower_components/MathJax/es5/input/tex/extensions/autoload.js +1 -0
  157. data/assets/bower_components/MathJax/es5/input/tex/extensions/bbox.js +1 -0
  158. data/assets/bower_components/MathJax/es5/input/tex/extensions/boldsymbol.js +1 -0
  159. data/assets/bower_components/MathJax/es5/input/tex/extensions/braket.js +1 -0
  160. data/assets/bower_components/MathJax/es5/input/tex/extensions/bussproofs.js +1 -0
  161. data/assets/bower_components/MathJax/es5/input/tex/extensions/cancel.js +1 -0
  162. data/assets/bower_components/MathJax/es5/input/tex/extensions/color.js +1 -0
  163. data/assets/bower_components/MathJax/es5/input/tex/extensions/colorV2.js +1 -0
  164. data/assets/bower_components/MathJax/es5/input/tex/extensions/configMacros.js +1 -0
  165. data/assets/bower_components/MathJax/es5/input/tex/extensions/enclose.js +1 -0
  166. data/assets/bower_components/MathJax/es5/input/tex/extensions/extpfeil.js +1 -0
  167. data/assets/bower_components/MathJax/es5/input/tex/extensions/html.js +1 -0
  168. data/assets/bower_components/MathJax/es5/input/tex/extensions/mhchem.js +1 -0
  169. data/assets/bower_components/MathJax/es5/input/tex/extensions/newcommand.js +1 -0
  170. data/assets/bower_components/MathJax/es5/input/tex/extensions/noerrors.js +1 -0
  171. data/assets/bower_components/MathJax/es5/input/tex/extensions/noundefined.js +1 -0
  172. data/assets/bower_components/MathJax/es5/input/tex/extensions/physics.js +1 -0
  173. data/assets/bower_components/MathJax/es5/input/tex/extensions/require.js +1 -0
  174. data/assets/bower_components/MathJax/es5/input/tex/extensions/tagFormat.js +1 -0
  175. data/assets/bower_components/MathJax/es5/input/tex/extensions/unicode.js +1 -0
  176. data/assets/bower_components/MathJax/es5/input/tex/extensions/verb.js +1 -0
  177. data/assets/bower_components/MathJax/es5/latest.js +1 -0
  178. data/assets/bower_components/MathJax/es5/loader.js +1 -0
  179. data/assets/bower_components/MathJax/es5/mml-chtml.js +1 -0
  180. data/assets/bower_components/MathJax/es5/mml-svg.js +1 -0
  181. data/assets/bower_components/MathJax/es5/node-main.js +1 -0
  182. data/assets/bower_components/MathJax/es5/output/chtml.js +1 -0
  183. data/assets/bower_components/MathJax/es5/output/chtml/fonts/tex.js +1 -0
  184. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  185. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  186. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  187. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  188. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  189. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  190. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  191. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  192. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  193. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  194. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  195. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  196. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  197. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  198. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  199. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  200. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  201. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  202. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  203. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  204. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  205. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  206. data/assets/bower_components/MathJax/es5/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  207. data/assets/bower_components/MathJax/es5/output/svg.js +1 -0
  208. data/assets/bower_components/MathJax/es5/output/svg/fonts/tex.js +1 -0
  209. data/assets/bower_components/MathJax/es5/sre/mathmaps/en.js +104 -0
  210. data/assets/bower_components/MathJax/es5/sre/mathmaps/es.js +104 -0
  211. data/assets/bower_components/MathJax/es5/sre/mathmaps/fr.js +104 -0
  212. data/assets/bower_components/MathJax/es5/sre/mathmaps/mathmaps_ie.js +410 -0
  213. data/assets/bower_components/MathJax/es5/sre/mathmaps/nemeth.js +104 -0
  214. data/assets/bower_components/MathJax/es5/sre/sre_browser.js +1709 -0
  215. data/assets/bower_components/MathJax/es5/startup.js +1 -0
  216. data/assets/bower_components/MathJax/es5/tex-chtml-full.js +1 -0
  217. data/assets/bower_components/MathJax/es5/tex-chtml.js +1 -0
  218. data/assets/bower_components/MathJax/es5/tex-mml-chtml.js +1 -0
  219. data/assets/bower_components/MathJax/es5/tex-mml-svg.js +1 -0
  220. data/assets/bower_components/MathJax/es5/tex-svg-full.js +1 -0
  221. data/assets/bower_components/MathJax/es5/tex-svg.js +1 -0
  222. data/assets/bower_components/MathJax/es5/ui/menu.js +1 -0
  223. data/assets/bower_components/MathJax/package.json +59 -0
  224. data/assets/bower_components/katex/.bower.json +7 -8
  225. data/assets/bower_components/katex/bower.json +1 -1
  226. data/assets/bower_components/katex/dist/contrib/auto-render.js +4 -0
  227. data/assets/bower_components/katex/dist/contrib/auto-render.min.js +1 -1
  228. data/assets/bower_components/katex/dist/contrib/auto-render.mjs +215 -0
  229. data/assets/bower_components/katex/dist/contrib/copy-tex.js +9 -4
  230. data/assets/bower_components/katex/dist/contrib/copy-tex.min.css +1 -1
  231. data/assets/bower_components/katex/dist/contrib/copy-tex.min.js +1 -1
  232. data/assets/bower_components/katex/dist/contrib/copy-tex.mjs +85 -0
  233. data/assets/bower_components/katex/dist/contrib/mathtex-script-type.min.js +1 -1
  234. data/assets/bower_components/katex/dist/contrib/mathtex-script-type.mjs +24 -0
  235. data/assets/bower_components/katex/dist/contrib/mhchem.js +3241 -0
  236. data/assets/bower_components/katex/dist/contrib/mhchem.min.js +1 -0
  237. data/assets/bower_components/katex/dist/contrib/mhchem.mjs +3109 -0
  238. data/assets/bower_components/katex/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  239. data/assets/bower_components/katex/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  240. data/assets/bower_components/katex/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  241. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  242. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  243. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  244. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  245. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  246. data/assets/bower_components/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  247. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  248. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  249. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  250. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  251. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  252. data/assets/bower_components/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  253. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  254. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  255. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  256. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  257. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  258. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  259. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  260. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  261. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  262. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  263. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  264. data/assets/bower_components/katex/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  265. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  266. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  267. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  268. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  269. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  270. data/assets/bower_components/katex/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  271. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  272. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  273. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  274. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  275. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  276. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  277. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  278. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  279. data/assets/bower_components/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  280. data/assets/bower_components/katex/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  281. data/assets/bower_components/katex/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  282. data/assets/bower_components/katex/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  283. data/assets/bower_components/katex/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  284. data/assets/bower_components/katex/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  285. data/assets/bower_components/katex/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  286. data/assets/bower_components/katex/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  287. data/assets/bower_components/katex/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  288. data/assets/bower_components/katex/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  289. data/assets/bower_components/katex/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  290. data/assets/bower_components/katex/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  291. data/assets/bower_components/katex/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  292. data/assets/bower_components/katex/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  293. data/assets/bower_components/katex/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  294. data/assets/bower_components/katex/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  295. data/assets/bower_components/katex/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  296. data/assets/bower_components/katex/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  297. data/assets/bower_components/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  298. data/assets/bower_components/katex/dist/katex.css +18 -4
  299. data/assets/bower_components/katex/dist/katex.js +1011 -663
  300. data/assets/bower_components/katex/dist/katex.min.css +1 -1
  301. data/assets/bower_components/katex/dist/katex.min.js +1 -1
  302. data/assets/bower_components/katex/dist/katex.mjs +904 -645
  303. data/assets/bower_components/katex/yarn.lock +3091 -2622
  304. data/assets/css/{hydejack-8.3.2.css → hydejack-9.0.0.css} +0 -0
  305. data/assets/icomoon/fonts/icomoon.eot +0 -0
  306. data/assets/icomoon/fonts/icomoon.svg +10 -2
  307. data/assets/icomoon/fonts/icomoon.ttf +0 -0
  308. data/assets/icomoon/fonts/icomoon.woff +0 -0
  309. data/assets/icomoon/selection.json +1 -2555
  310. data/assets/icomoon/style.css +37 -12
  311. data/assets/js/.gitkeep +0 -0
  312. data/assets/js/LEGACY-drawer-hydejack-9.0.0.js +14 -0
  313. data/assets/js/LEGACY-fetch-hydejack-9.0.0.js +14 -0
  314. data/assets/js/LEGACY-hydejack-9.0.0.js +28 -0
  315. data/assets/js/LEGACY-navbar-hydejack-9.0.0.js +14 -0
  316. data/assets/js/LEGACY-push-state-hydejack-9.0.0.js +14 -0
  317. data/assets/js/LEGACY-resize-observer-hydejack-9.0.0.js +14 -0
  318. data/assets/js/LEGACY-shadydom-hydejack-9.0.0.js +14 -0
  319. data/assets/js/LEGACY-vendors~drawer-hydejack-9.0.0.js +47 -0
  320. data/assets/js/LEGACY-vendors~drawer~push-state-hydejack-9.0.0.js +215 -0
  321. data/assets/js/LEGACY-vendors~fetch-hydejack-9.0.0.js +14 -0
  322. data/assets/js/LEGACY-vendors~intersection-observer-hydejack-9.0.0.js +14 -0
  323. data/assets/js/LEGACY-vendors~push-state-hydejack-9.0.0.js +33 -0
  324. data/assets/js/LEGACY-vendors~shadydom-hydejack-9.0.0.js +155 -0
  325. data/assets/js/LEGACY-vendors~webanimations-hydejack-9.0.0.js +14 -0
  326. data/assets/js/LEGACY-vendors~webcomponents-hydejack-9.0.0.js +34 -0
  327. data/assets/js/LEGACY-webcomponents-hydejack-9.0.0.js +14 -0
  328. data/assets/js/drawer-hydejack-9.0.0.js +14 -0
  329. data/assets/js/fetch-hydejack-9.0.0.js +14 -0
  330. data/assets/js/hydejack-9.0.0.js +28 -0
  331. data/assets/js/navbar-hydejack-9.0.0.js +14 -0
  332. data/assets/js/push-state-hydejack-9.0.0.js +14 -0
  333. data/assets/js/resize-observer-hydejack-9.0.0.js +14 -0
  334. data/assets/js/shadydom-hydejack-9.0.0.js +14 -0
  335. data/assets/js/vendors~drawer-hydejack-9.0.0.js +47 -0
  336. data/assets/js/vendors~drawer~push-state-hydejack-9.0.0.js +163 -0
  337. data/assets/js/vendors~intersection-observer-hydejack-9.0.0.js +14 -0
  338. data/assets/js/vendors~push-state-hydejack-9.0.0.js +33 -0
  339. data/assets/js/vendors~shadydom-hydejack-9.0.0.js +146 -0
  340. data/assets/js/vendors~webanimations-hydejack-9.0.0.js +14 -0
  341. data/assets/js/webcomponents-hydejack-9.0.0.js +14 -0
  342. data/assets/version.json +3 -2
  343. data/licenses/PRO.md +4 -0
  344. data/licenses/README.md +1 -1
  345. data/licenses/{W3C.md → W3C-20150513.md} +0 -0
  346. metadata +170 -55
  347. data/assets/Resume.pdf +0 -0
  348. data/assets/bower_components/fontfaceobserver/.bower.json +0 -33
  349. data/assets/bower_components/fontfaceobserver/.gitignore +0 -2
  350. data/assets/bower_components/fontfaceobserver/.travis.yml +0 -16
  351. data/assets/bower_components/fontfaceobserver/Gruntfile.js +0 -101
  352. data/assets/bower_components/fontfaceobserver/LICENSE +0 -23
  353. data/assets/bower_components/fontfaceobserver/bower.json +0 -22
  354. data/assets/bower_components/fontfaceobserver/exports.js +0 -8
  355. data/assets/bower_components/fontfaceobserver/externs-commonjs.js +0 -10
  356. data/assets/bower_components/fontfaceobserver/externs.js +0 -15
  357. data/assets/bower_components/fontfaceobserver/fontfaceobserver.js +0 -12
  358. data/assets/bower_components/fontfaceobserver/fontfaceobserver.standalone.js +0 -8
  359. data/assets/bower_components/fontfaceobserver/package.json +0 -57
  360. data/assets/bower_components/fontfaceobserver/src/descriptors.js +0 -10
  361. data/assets/bower_components/fontfaceobserver/src/observer.js +0 -349
  362. data/assets/bower_components/fontfaceobserver/src/ruler.js +0 -130
  363. data/assets/bower_components/fontfaceobserver/vendor/google/base.js +0 -1489
  364. data/assets/bower_components/katex/dist/README.md +0 -90
  365. data/assets/bower_components/katex/lint_blacklist.txt +0 -5
  366. data/assets/img/blog/COLOURlovers.com-Hydejack.png +0 -0
  367. data/assets/img/blog/blog-layout.jpg +0 -0
  368. data/assets/img/blog/caleb-george-old.jpg +0 -0
  369. data/assets/img/blog/caleb-george.jpg +0 -0
  370. data/assets/img/blog/cover-page.jpg +0 -0
  371. data/assets/img/blog/dark-mode-ii.jpg +0 -0
  372. data/assets/img/blog/dark-mode.jpg +0 -0
  373. data/assets/img/blog/example-content-ii.jpg +0 -0
  374. data/assets/img/blog/example-content-iii.jpg +0 -0
  375. data/assets/img/blog/hydejack-8.png +0 -0
  376. data/assets/img/blog/hydejack-8@0,25x.png +0 -0
  377. data/assets/img/blog/hydejack-8@0,5x.png +0 -0
  378. data/assets/img/blog/lazy-images.jpg +0 -0
  379. data/assets/img/blog/resume.png +0 -0
  380. data/assets/img/blog/steve-harvey.jpg +0 -0
  381. data/assets/img/blog/w3m.png +0 -0
  382. data/assets/img/blog/wade-lambert.jpg +0 -0
  383. data/assets/img/docs/google-fonts.png +0 -0
  384. data/assets/img/projects/hy-drawer.svg +0 -12
  385. data/assets/img/projects/hy-img.svg +0 -17
  386. data/assets/img/projects/hy-push-state.svg +0 -13
  387. data/assets/js/hydejack-8.3.1.js +0 -47
  388. data/assets/js/hydejack-8.3.2.js +0 -47
  389. data/assets/video/blog-layout.mp4 +0 -0
  390. data/assets/video/cover-page.mp4 +0 -0
  391. data/assets/video/dark-mode.mp4 +0 -0
  392. data/assets/video/lazy-images.mp4 +0 -0
@@ -128,6 +128,9 @@
128
128
  .katex * {
129
129
  -ms-high-contrast-adjust: none !important;
130
130
  }
131
+ .katex .katex-version::after {
132
+ content: "0.10.2";
133
+ }
131
134
  .katex .katex-mathml {
132
135
  position: absolute;
133
136
  clip: rect(1px, 1px, 1px, 1px);
@@ -911,6 +914,13 @@
911
914
  .katex svg path {
912
915
  stroke: none;
913
916
  }
917
+ .katex img {
918
+ border-style: none;
919
+ min-width: 0;
920
+ min-height: 0;
921
+ max-width: none;
922
+ max-height: none;
923
+ }
914
924
  .katex .stretchy {
915
925
  width: 100%;
916
926
  display: block;
@@ -967,10 +977,7 @@
967
977
  .katex .boxpad {
968
978
  padding: 0 0.3em 0 0.3em;
969
979
  }
970
- .katex .fbox {
971
- box-sizing: border-box;
972
- border: 0.04em solid black;
973
- }
980
+ .katex .fbox,
974
981
  .katex .fcolorbox {
975
982
  box-sizing: border-box;
976
983
  border: 0.04em solid;
@@ -1004,4 +1011,11 @@
1004
1011
  position: absolute;
1005
1012
  right: 0;
1006
1013
  }
1014
+ .katex-display.leqno > .katex > .katex-html > .tag {
1015
+ left: 0;
1016
+ right: auto;
1017
+ }
1018
+ .katex-display.fleqn > .katex {
1019
+ text-align: left;
1020
+ }
1007
1021
 
@@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap
91
91
  /******/
92
92
  /******/
93
93
  /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 2);
94
+ /******/ return __webpack_require__(__webpack_require__.s = 1);
95
95
  /******/ })
96
96
  /************************************************************************/
97
97
  /******/ ([
@@ -101,8 +101,7 @@ return /******/ (function(modules) { // webpackBootstrap
101
101
  // extracted by mini-css-extract-plugin
102
102
 
103
103
  /***/ }),
104
- /* 1 */,
105
- /* 2 */
104
+ /* 1 */
106
105
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
107
106
 
108
107
  "use strict";
@@ -131,12 +130,6 @@ function () {
131
130
  this.start = start;
132
131
  this.end = end;
133
132
  }
134
-
135
- var _proto = SourceLocation.prototype;
136
-
137
- _proto.getSource = function getSource() {
138
- return this.lexer.input.slice(this.start, this.end);
139
- };
140
133
  /**
141
134
  * Merges two `SourceLocation`s from location providers, given they are
142
135
  * provided in order of appearance.
@@ -403,6 +396,8 @@ var Settings_Settings =
403
396
  function () {
404
397
  function Settings(options) {
405
398
  this.displayMode = void 0;
399
+ this.leqno = void 0;
400
+ this.fleqn = void 0;
406
401
  this.throwOnError = void 0;
407
402
  this.errorColor = void 0;
408
403
  this.macros = void 0;
@@ -414,6 +409,8 @@ function () {
414
409
  // allow null options
415
410
  options = options || {};
416
411
  this.displayMode = utils.deflt(options.displayMode, false);
412
+ this.leqno = utils.deflt(options.leqno, false);
413
+ this.fleqn = utils.deflt(options.fleqn, false);
417
414
  this.throwOnError = utils.deflt(options.throwOnError, true);
418
415
  this.errorColor = utils.deflt(options.errorColor, "#cc0000");
419
416
  this.macros = options.macros || {};
@@ -450,7 +447,7 @@ function () {
450
447
  // won't happen in type-safe code
451
448
  typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
452
449
  }
453
- };
450
+ }
454
451
  /**
455
452
  * Check whether to apply strict (LaTeX-adhering) behavior for unusual
456
453
  * input (like `\\`). Unlike `nonstrict`, will not throw an error;
@@ -459,7 +456,7 @@ function () {
459
456
  * "warn" prints a warning and returns `false`.
460
457
  * This is for the second category of `errorCode`s listed in the README.
461
458
  */
462
-
459
+ ;
463
460
 
464
461
  _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) {
465
462
  var strict = this.strict;
@@ -527,54 +524,54 @@ function () {
527
524
 
528
525
  _proto.sup = function sup() {
529
526
  return Style_styles[_sup[this.id]];
530
- };
527
+ }
531
528
  /**
532
529
  * Get the style of a subscript given a base in the current style.
533
530
  */
534
-
531
+ ;
535
532
 
536
533
  _proto.sub = function sub() {
537
534
  return Style_styles[_sub[this.id]];
538
- };
535
+ }
539
536
  /**
540
537
  * Get the style of a fraction numerator given the fraction in the current
541
538
  * style.
542
539
  */
543
-
540
+ ;
544
541
 
545
542
  _proto.fracNum = function fracNum() {
546
543
  return Style_styles[_fracNum[this.id]];
547
- };
544
+ }
548
545
  /**
549
546
  * Get the style of a fraction denominator given the fraction in the current
550
547
  * style.
551
548
  */
552
-
549
+ ;
553
550
 
554
551
  _proto.fracDen = function fracDen() {
555
552
  return Style_styles[_fracDen[this.id]];
556
- };
553
+ }
557
554
  /**
558
555
  * Get the cramped version of a style (in particular, cramping a cramped style
559
556
  * doesn't change the style).
560
557
  */
561
-
558
+ ;
562
559
 
563
560
  _proto.cramp = function cramp() {
564
561
  return Style_styles[_cramp[this.id]];
565
- };
562
+ }
566
563
  /**
567
564
  * Get a text or display version of this style.
568
565
  */
569
-
566
+ ;
570
567
 
571
568
  _proto.text = function text() {
572
569
  return Style_styles[_text[this.id]];
573
- };
570
+ }
574
571
  /**
575
572
  * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
576
573
  */
577
-
574
+ ;
578
575
 
579
576
  _proto.isTight = function isTight() {
580
577
  return this.size >= 2;
@@ -810,7 +807,7 @@ var svgGeometry_path = {
810
807
  // The next ten paths support reaction arrows from the mhchem package.
811
808
  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
812
809
  // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main
813
- baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 241v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
810
+ baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
814
811
  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
815
812
  rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
816
813
  // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
@@ -855,9 +852,9 @@ function () {
855
852
 
856
853
  _proto.hasClass = function hasClass(className) {
857
854
  return utils.contains(this.classes, className);
858
- };
855
+ }
859
856
  /** Convert the fragment into a node. */
860
-
857
+ ;
861
858
 
862
859
  _proto.toNode = function toNode() {
863
860
  var frag = document.createDocumentFragment();
@@ -867,9 +864,9 @@ function () {
867
864
  }
868
865
 
869
866
  return frag;
870
- };
867
+ }
871
868
  /** Convert the fragment into HTML markup. */
872
-
869
+ ;
873
870
 
874
871
  _proto.toMarkup = function toMarkup() {
875
872
  var markup = ""; // Simply concatenate the markup for the children together.
@@ -879,12 +876,12 @@ function () {
879
876
  }
880
877
 
881
878
  return markup;
882
- };
879
+ }
883
880
  /**
884
881
  * Converts the math node into a string, similar to innerText. Applies to
885
882
  * MathDomNode's only.
886
883
  */
887
-
884
+ ;
888
885
 
889
886
  _proto.toText = function toText() {
890
887
  // To avoid this, we would subclass documentFragment separately for
@@ -1118,6 +1115,70 @@ function () {
1118
1115
 
1119
1116
  return Anchor;
1120
1117
  }();
1118
+ /**
1119
+ * This node represents an image embed (<img>) element.
1120
+ */
1121
+
1122
+ var domTree_Img =
1123
+ /*#__PURE__*/
1124
+ function () {
1125
+ function Img(src, alt, style) {
1126
+ this.src = void 0;
1127
+ this.alt = void 0;
1128
+ this.classes = void 0;
1129
+ this.height = void 0;
1130
+ this.depth = void 0;
1131
+ this.maxFontSize = void 0;
1132
+ this.style = void 0;
1133
+ this.alt = alt;
1134
+ this.src = src;
1135
+ this.classes = ["mord"];
1136
+ this.style = style;
1137
+ }
1138
+
1139
+ var _proto3 = Img.prototype;
1140
+
1141
+ _proto3.hasClass = function hasClass(className) {
1142
+ return utils.contains(this.classes, className);
1143
+ };
1144
+
1145
+ _proto3.toNode = function toNode() {
1146
+ var node = document.createElement("img");
1147
+ node.src = this.src;
1148
+ node.alt = this.alt;
1149
+ node.className = "mord"; // Apply inline styles
1150
+
1151
+ for (var style in this.style) {
1152
+ if (this.style.hasOwnProperty(style)) {
1153
+ // $FlowFixMe
1154
+ node.style[style] = this.style[style];
1155
+ }
1156
+ }
1157
+
1158
+ return node;
1159
+ };
1160
+
1161
+ _proto3.toMarkup = function toMarkup() {
1162
+ var markup = "<img src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
1163
+
1164
+ var styles = "";
1165
+
1166
+ for (var style in this.style) {
1167
+ if (this.style.hasOwnProperty(style)) {
1168
+ styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
1169
+ }
1170
+ }
1171
+
1172
+ if (styles) {
1173
+ markup += " style=\"" + utils.escape(styles) + "\"";
1174
+ }
1175
+
1176
+ markup += "'/>";
1177
+ return markup;
1178
+ };
1179
+
1180
+ return Img;
1181
+ }();
1121
1182
  var iCombinations = {
1122
1183
  'î': "\u0131\u0302",
1123
1184
  'ï': "\u0131\u0308",
@@ -1172,18 +1233,18 @@ function () {
1172
1233
  }
1173
1234
  }
1174
1235
 
1175
- var _proto3 = SymbolNode.prototype;
1236
+ var _proto4 = SymbolNode.prototype;
1176
1237
 
1177
- _proto3.hasClass = function hasClass(className) {
1238
+ _proto4.hasClass = function hasClass(className) {
1178
1239
  return utils.contains(this.classes, className);
1179
- };
1240
+ }
1180
1241
  /**
1181
1242
  * Creates a text node or span from a symbol node. Note that a span is only
1182
1243
  * created if it is needed.
1183
1244
  */
1245
+ ;
1184
1246
 
1185
-
1186
- _proto3.toNode = function toNode() {
1247
+ _proto4.toNode = function toNode() {
1187
1248
  var node = document.createTextNode(this.text);
1188
1249
  var span = null;
1189
1250
 
@@ -1211,13 +1272,13 @@ function () {
1211
1272
  } else {
1212
1273
  return node;
1213
1274
  }
1214
- };
1275
+ }
1215
1276
  /**
1216
1277
  * Creates markup for a symbol node.
1217
1278
  */
1279
+ ;
1218
1280
 
1219
-
1220
- _proto3.toMarkup = function toMarkup() {
1281
+ _proto4.toMarkup = function toMarkup() {
1221
1282
  // TODO(alpert): More duplication than I'd like from
1222
1283
  // span.prototype.toMarkup and symbolNode.prototype.toNode...
1223
1284
  var needsSpan = false;
@@ -1275,9 +1336,9 @@ function () {
1275
1336
  this.attributes = attributes || {};
1276
1337
  }
1277
1338
 
1278
- var _proto4 = SvgNode.prototype;
1339
+ var _proto5 = SvgNode.prototype;
1279
1340
 
1280
- _proto4.toNode = function toNode() {
1341
+ _proto5.toNode = function toNode() {
1281
1342
  var svgNS = "http://www.w3.org/2000/svg";
1282
1343
  var node = document.createElementNS(svgNS, "svg"); // Apply attributes
1283
1344
 
@@ -1294,7 +1355,7 @@ function () {
1294
1355
  return node;
1295
1356
  };
1296
1357
 
1297
- _proto4.toMarkup = function toMarkup() {
1358
+ _proto5.toMarkup = function toMarkup() {
1298
1359
  var markup = "<svg"; // Apply attributes
1299
1360
 
1300
1361
  for (var attr in this.attributes) {
@@ -1325,9 +1386,9 @@ function () {
1325
1386
  this.alternate = alternate; // Used only for tall \sqrt
1326
1387
  }
1327
1388
 
1328
- var _proto5 = PathNode.prototype;
1389
+ var _proto6 = PathNode.prototype;
1329
1390
 
1330
- _proto5.toNode = function toNode() {
1391
+ _proto6.toNode = function toNode() {
1331
1392
  var svgNS = "http://www.w3.org/2000/svg";
1332
1393
  var node = document.createElementNS(svgNS, "path");
1333
1394
 
@@ -1340,7 +1401,7 @@ function () {
1340
1401
  return node;
1341
1402
  };
1342
1403
 
1343
- _proto5.toMarkup = function toMarkup() {
1404
+ _proto6.toMarkup = function toMarkup() {
1344
1405
  if (this.alternate) {
1345
1406
  return "<path d='" + this.alternate + "'/>";
1346
1407
  } else {
@@ -1358,9 +1419,9 @@ function () {
1358
1419
  this.attributes = attributes || {};
1359
1420
  }
1360
1421
 
1361
- var _proto6 = LineNode.prototype;
1422
+ var _proto7 = LineNode.prototype;
1362
1423
 
1363
- _proto6.toNode = function toNode() {
1424
+ _proto7.toNode = function toNode() {
1364
1425
  var svgNS = "http://www.w3.org/2000/svg";
1365
1426
  var node = document.createElementNS(svgNS, "line"); // Apply attributes
1366
1427
 
@@ -1373,7 +1434,7 @@ function () {
1373
1434
  return node;
1374
1435
  };
1375
1436
 
1376
- _proto6.toMarkup = function toMarkup() {
1437
+ _proto7.toMarkup = function toMarkup() {
1377
1438
  var markup = "<line";
1378
1439
 
1379
1440
  for (var attr in this.attributes) {
@@ -1913,7 +1974,6 @@ function assertSpan(group) {
1913
1974
  "730": [0, 0.69444, 0, 0, 0.86944],
1914
1975
  "732": [0, 0.69444, 0, 0, 0.575],
1915
1976
  "733": [0, 0.69444, 0, 0, 0.575],
1916
- "824": [0.19444, 0.69444, 0, 0, 0],
1917
1977
  "915": [0, 0.68611, 0, 0, 0.69166],
1918
1978
  "916": [0, 0.68611, 0, 0, 0.95833],
1919
1979
  "920": [0, 0.68611, 0, 0, 0.89444],
@@ -2041,7 +2101,8 @@ function assertSpan(group) {
2041
2101
  "10217": [0.25, 0.75, 0, 0, 0.44722],
2042
2102
  "10815": [0, 0.68611, 0, 0, 0.9],
2043
2103
  "10927": [0.19667, 0.69667, 0, 0, 0.89444],
2044
- "10928": [0.19667, 0.69667, 0, 0, 0.89444]
2104
+ "10928": [0.19667, 0.69667, 0, 0, 0.89444],
2105
+ "57376": [0.19444, 0.69444, 0, 0, 0]
2045
2106
  },
2046
2107
  "Main-BoldItalic": {
2047
2108
  "33": [0, 0.69444, 0.11417, 0, 0.38611],
@@ -2424,7 +2485,6 @@ function assertSpan(group) {
2424
2485
  "730": [0, 0.69444, 0, 0, 0.75],
2425
2486
  "732": [0, 0.66786, 0, 0, 0.5],
2426
2487
  "733": [0, 0.69444, 0, 0, 0.5],
2427
- "824": [0.19444, 0.69444, 0, 0, 0],
2428
2488
  "915": [0, 0.68333, 0, 0, 0.625],
2429
2489
  "916": [0, 0.68333, 0, 0, 0.83334],
2430
2490
  "920": [0, 0.68333, 0, 0, 0.77778],
@@ -2509,7 +2569,6 @@ function assertSpan(group) {
2509
2569
  "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
2510
2570
  "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
2511
2571
  "8784": [-0.133, 0.67, 0, 0, 0.778],
2512
- "8800": [0.215, 0.716, 0, 0, 0.778],
2513
2572
  "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
2514
2573
  "8804": [0.13597, 0.63597, 0, 0, 0.77778],
2515
2574
  "8805": [0.13597, 0.63597, 0, 0, 0.77778],
@@ -2576,10 +2635,10 @@ function assertSpan(group) {
2576
2635
  "10236": [0.011, 0.511, 0, 0, 1.638],
2577
2636
  "10815": [0, 0.68333, 0, 0, 0.75],
2578
2637
  "10927": [0.13597, 0.63597, 0, 0, 0.77778],
2579
- "10928": [0.13597, 0.63597, 0, 0, 0.77778]
2638
+ "10928": [0.13597, 0.63597, 0, 0, 0.77778],
2639
+ "57376": [0.19444, 0.69444, 0, 0, 0]
2580
2640
  },
2581
2641
  "Math-BoldItalic": {
2582
- "47": [0.19444, 0.69444, 0, 0, 0],
2583
2642
  "65": [0, 0.68611, 0, 0, 0.86944],
2584
2643
  "66": [0, 0.68611, 0.04835, 0, 0.8664],
2585
2644
  "67": [0, 0.68611, 0.06979, 0, 0.81694],
@@ -2675,7 +2734,6 @@ function assertSpan(group) {
2675
2734
  "1013": [0, 0.44444, 0, 0, 0.48333]
2676
2735
  },
2677
2736
  "Math-Italic": {
2678
- "47": [0.19444, 0.69444, 0, 0, 0],
2679
2737
  "65": [0, 0.68333, 0, 0.13889, 0.75],
2680
2738
  "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
2681
2739
  "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
@@ -3749,13 +3807,13 @@ function getCharacterMetrics(character, font, mode) {
3749
3807
  }
3750
3808
 
3751
3809
  var ch = character.charCodeAt(0);
3810
+ var metrics = fontMetricsData[font][ch];
3752
3811
 
3753
- if (character[0] in extraCharacterMap) {
3812
+ if (!metrics && character[0] in extraCharacterMap) {
3754
3813
  ch = extraCharacterMap[character[0]].charCodeAt(0);
3814
+ metrics = fontMetricsData[font][ch];
3755
3815
  }
3756
3816
 
3757
- var metrics = fontMetricsData[font][ch];
3758
-
3759
3817
  if (!metrics && mode === 'text') {
3760
3818
  // We don't typically have font metrics for Asian scripts.
3761
3819
  // But since we support them in text mode, we need to return
@@ -3820,7 +3878,7 @@ function getGlobalMetrics(size) {
3820
3878
  normal font), or "ams" (the ams fonts).
3821
3879
  * - group (required): the ParseNode group type the symbol should have (i.e.
3822
3880
  "textord", "mathord", etc).
3823
- See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types
3881
+ See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
3824
3882
  * - replace: the character that this symbol or function should be
3825
3883
  * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
3826
3884
  * character in the main font).
@@ -3883,7 +3941,7 @@ var op = "op-token";
3883
3941
  var symbols_open = "open";
3884
3942
  var punct = "punct";
3885
3943
  var rel = "rel";
3886
- var spacing = "spacing";
3944
+ var symbols_spacing = "spacing";
3887
3945
  var symbols_textord = "textord"; // Now comes the symbol table
3888
3946
  // Relation Symbols
3889
3947
 
@@ -3988,12 +4046,13 @@ defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true);
3988
4046
  defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true);
3989
4047
  defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations
3990
4048
 
3991
- defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true);
3992
- defineSymbol(symbols_math, ams, rel, "\uE010", "\\nleqslant");
3993
- defineSymbol(symbols_math, ams, rel, "\uE011", "\\nleqq");
4049
+ defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
4050
+
4051
+ defineSymbol(symbols_math, ams, rel, "\uE010", "\\@nleqslant");
4052
+ defineSymbol(symbols_math, ams, rel, "\uE011", "\\@nleqq");
3994
4053
  defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true);
3995
4054
  defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true);
3996
- defineSymbol(symbols_math, ams, rel, "\uE00C", "\\lvertneqq");
4055
+ defineSymbol(symbols_math, ams, rel, "\uE00C", "\\@lvertneqq");
3997
4056
  defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true);
3998
4057
  defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true);
3999
4058
  defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
@@ -4002,22 +4061,22 @@ defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true);
4002
4061
  defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true);
4003
4062
  defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true);
4004
4063
  defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true);
4005
- defineSymbol(symbols_math, ams, rel, "\uE006", "\\nshortmid");
4064
+ defineSymbol(symbols_math, ams, rel, "\uE006", "\\@nshortmid");
4006
4065
  defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true);
4007
4066
  defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true);
4008
4067
  defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true);
4009
4068
  defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft");
4010
4069
  defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true);
4011
4070
  defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true);
4012
- defineSymbol(symbols_math, ams, rel, "\uE01A", "\\varsubsetneq");
4071
+ defineSymbol(symbols_math, ams, rel, "\uE01A", "\\@varsubsetneq");
4013
4072
  defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true);
4014
- defineSymbol(symbols_math, ams, rel, "\uE017", "\\varsubsetneqq");
4073
+ defineSymbol(symbols_math, ams, rel, "\uE017", "\\@varsubsetneqq");
4015
4074
  defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true);
4016
- defineSymbol(symbols_math, ams, rel, "\uE00F", "\\ngeqslant");
4017
- defineSymbol(symbols_math, ams, rel, "\uE00E", "\\ngeqq");
4075
+ defineSymbol(symbols_math, ams, rel, "\uE00F", "\\@ngeqslant");
4076
+ defineSymbol(symbols_math, ams, rel, "\uE00E", "\\@ngeqq");
4018
4077
  defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true);
4019
4078
  defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true);
4020
- defineSymbol(symbols_math, ams, rel, "\uE00D", "\\gvertneqq");
4079
+ defineSymbol(symbols_math, ams, rel, "\uE00D", "\\@gvertneqq");
4021
4080
  defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true);
4022
4081
  defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true);
4023
4082
  defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
@@ -4027,20 +4086,20 @@ defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true);
4027
4086
  defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
4028
4087
 
4029
4088
  defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true);
4030
- defineSymbol(symbols_math, ams, rel, "\uE007", "\\nshortparallel");
4089
+ defineSymbol(symbols_math, ams, rel, "\uE007", "\\@nshortparallel");
4031
4090
  defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true);
4032
4091
  defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true);
4033
4092
  defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright");
4034
4093
  defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true);
4035
- defineSymbol(symbols_math, ams, rel, "\uE018", "\\nsupseteqq");
4094
+ defineSymbol(symbols_math, ams, rel, "\uE018", "\\@nsupseteqq");
4036
4095
  defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true);
4037
- defineSymbol(symbols_math, ams, rel, "\uE01B", "\\varsupsetneq");
4096
+ defineSymbol(symbols_math, ams, rel, "\uE01B", "\\@varsupsetneq");
4038
4097
  defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true);
4039
- defineSymbol(symbols_math, ams, rel, "\uE019", "\\varsupsetneqq");
4098
+ defineSymbol(symbols_math, ams, rel, "\uE019", "\\@varsupsetneqq");
4040
4099
  defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true);
4041
4100
  defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true);
4042
4101
  defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true);
4043
- defineSymbol(symbols_math, ams, rel, "\uE016", "\\nsubseteqq");
4102
+ defineSymbol(symbols_math, ams, rel, "\uE016", "\\@nsubseteqq");
4044
4103
  defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd");
4045
4104
  defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows
4046
4105
 
@@ -4063,7 +4122,6 @@ defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists");
4063
4122
  defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho");
4064
4123
  defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true);
4065
4124
  defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true);
4066
- defineSymbol(symbols_math, ams, symbols_textord, "k", "\\Bbbk");
4067
4125
  defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime");
4068
4126
  defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle");
4069
4127
  defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown");
@@ -4346,7 +4404,7 @@ defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true);
4346
4404
  defineSymbol(symbols_math, main, rel, "\u2190", "\\gets");
4347
4405
  defineSymbol(symbols_math, main, rel, ">", "\\gt");
4348
4406
  defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true);
4349
- defineSymbol(symbols_math, main, rel, "\u0338", "\\@not");
4407
+ defineSymbol(symbols_math, main, rel, "\uE020", "\\@not");
4350
4408
  defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true);
4351
4409
  defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true);
4352
4410
  defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true);
@@ -4362,17 +4420,17 @@ defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true);
4362
4420
  defineSymbol(symbols_math, main, rel, "\u2192", "\\to");
4363
4421
  defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true);
4364
4422
  defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true);
4365
- defineSymbol(symbols_math, main, spacing, "\xA0", "\\ ");
4366
- defineSymbol(symbols_math, main, spacing, "\xA0", "~");
4367
- defineSymbol(symbols_math, main, spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
4368
-
4369
- defineSymbol(symbols_math, main, spacing, "\xA0", "\\nobreakspace");
4370
- defineSymbol(symbols_text, main, spacing, "\xA0", "\\ ");
4371
- defineSymbol(symbols_text, main, spacing, "\xA0", "~");
4372
- defineSymbol(symbols_text, main, spacing, "\xA0", "\\space");
4373
- defineSymbol(symbols_text, main, spacing, "\xA0", "\\nobreakspace");
4374
- defineSymbol(symbols_math, main, spacing, null, "\\nobreak");
4375
- defineSymbol(symbols_math, main, spacing, null, "\\allowbreak");
4423
+ defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\ ");
4424
+ defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "~");
4425
+ defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
4426
+
4427
+ defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\nobreakspace");
4428
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ ");
4429
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~");
4430
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\space");
4431
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\nobreakspace");
4432
+ defineSymbol(symbols_math, main, symbols_spacing, null, "\\nobreak");
4433
+ defineSymbol(symbols_math, main, symbols_spacing, null, "\\allowbreak");
4376
4434
  defineSymbol(symbols_math, main, punct, ",", ",");
4377
4435
  defineSymbol(symbols_math, main, punct, ";", ";");
4378
4436
  defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true);
@@ -4422,6 +4480,8 @@ defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|");
4422
4480
  defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert");
4423
4481
  defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl");
4424
4482
  defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde");
4483
+ defineSymbol(symbols_text, main, symbols_textord, "\\", "\\textbackslash");
4484
+ defineSymbol(symbols_text, main, symbols_textord, "^", "\\textasciicircum");
4425
4485
  defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true);
4426
4486
  defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true);
4427
4487
  defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true);
@@ -4535,9 +4595,9 @@ defineSymbol(symbols_text, main, mathord, "\xA3", "\\pounds");
4535
4595
  defineSymbol(symbols_text, main, mathord, "\xA3", "\\textsterling", true);
4536
4596
  defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese");
4537
4597
  defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese");
4538
- defineSymbol(symbols_text, main, spacing, "\xA0", "\\ ");
4539
- defineSymbol(symbols_text, main, spacing, "\xA0", " ");
4540
- defineSymbol(symbols_text, main, spacing, "\xA0", "~"); // There are lots of symbols which are the same, so we add them in afterwards.
4598
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ ");
4599
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", " ");
4600
+ defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~"); // There are lots of symbols which are the same, so we add them in afterwards.
4541
4601
  // All of these are textords in math mode
4542
4602
 
4543
4603
  var mathTextSymbols = "0123456789/@.\"";
@@ -4564,62 +4624,81 @@ for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) {
4564
4624
 
4565
4625
  defineSymbol(symbols_math, main, mathord, _ch2, _ch2);
4566
4626
  defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2);
4567
- } // The next loop loads wide (surrogate pair) characters.
4627
+ } // Blackboard bold and script letters in Unicode range
4628
+
4629
+
4630
+ defineSymbol(symbols_math, ams, symbols_textord, "C", "\u2102"); // blackboard bold
4631
+
4632
+ defineSymbol(symbols_text, ams, symbols_textord, "C", "\u2102");
4633
+ defineSymbol(symbols_math, ams, symbols_textord, "H", "\u210D");
4634
+ defineSymbol(symbols_text, ams, symbols_textord, "H", "\u210D");
4635
+ defineSymbol(symbols_math, ams, symbols_textord, "N", "\u2115");
4636
+ defineSymbol(symbols_text, ams, symbols_textord, "N", "\u2115");
4637
+ defineSymbol(symbols_math, ams, symbols_textord, "P", "\u2119");
4638
+ defineSymbol(symbols_text, ams, symbols_textord, "P", "\u2119");
4639
+ defineSymbol(symbols_math, ams, symbols_textord, "Q", "\u211A");
4640
+ defineSymbol(symbols_text, ams, symbols_textord, "Q", "\u211A");
4641
+ defineSymbol(symbols_math, ams, symbols_textord, "R", "\u211D");
4642
+ defineSymbol(symbols_text, ams, symbols_textord, "R", "\u211D");
4643
+ defineSymbol(symbols_math, ams, symbols_textord, "Z", "\u2124");
4644
+ defineSymbol(symbols_text, ams, symbols_textord, "Z", "\u2124");
4645
+ defineSymbol(symbols_math, main, mathord, "h", "\u210E"); // italic h, Planck constant
4646
+
4647
+ defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
4568
4648
  // We support some letters in the Unicode range U+1D400 to U+1D7FF,
4569
4649
  // Mathematical Alphanumeric Symbols.
4570
4650
  // Some editors do not deal well with wide characters. So don't write the
4571
4651
  // string into this file. Instead, create the string from the surrogate pair.
4572
4652
 
4573
-
4574
4653
  var symbols_wideChar = "";
4575
4654
 
4576
- for (var _i3 = 0; _i3 < letters.length; _i3++) {
4577
- var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair.
4655
+ for (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) {
4656
+ var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair.
4578
4657
  // 0xD835 is the high surrogate for all letters in the range we support.
4579
4658
  // 0xDC00 is the low surrogate for bold A.
4580
4659
 
4581
4660
 
4582
- symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold
4661
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold
4583
4662
 
4584
4663
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4585
4664
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4586
- symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic
4665
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic
4587
4666
 
4588
4667
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4589
4668
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4590
- symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic
4669
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic
4591
4670
 
4592
4671
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4593
4672
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4594
- symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
4673
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur
4595
4674
 
4596
4675
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4597
4676
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4598
- symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif
4677
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif
4599
4678
 
4600
4679
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4601
4680
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4602
- symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold
4681
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold
4603
4682
 
4604
4683
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4605
4684
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4606
- symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic
4685
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic
4607
4686
 
4608
4687
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4609
4688
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4610
- symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace
4689
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace
4611
4690
 
4612
4691
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4613
4692
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4614
4693
 
4615
- if (_i3 < 26) {
4694
+ if (symbols_i3 < 26) {
4616
4695
  // KaTeX fonts have only capital letters for blackboard bold and script.
4617
4696
  // See exception for k below.
4618
- symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck
4697
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck
4619
4698
 
4620
4699
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4621
4700
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4622
- symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script
4701
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script
4623
4702
 
4624
4703
  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4625
4704
  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
@@ -4633,22 +4712,22 @@ symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
4633
4712
  defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar);
4634
4713
  defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals
4635
4714
 
4636
- for (var _i4 = 0; _i4 < 10; _i4++) {
4637
- var _ch4 = _i4.toString();
4715
+ for (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) {
4716
+ var _ch4 = symbols_i4.toString();
4638
4717
 
4639
- symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold
4718
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold
4640
4719
 
4641
4720
  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4642
4721
  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4643
- symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif
4722
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif
4644
4723
 
4645
4724
  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4646
4725
  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4647
- symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans
4726
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans
4648
4727
 
4649
4728
  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4650
4729
  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4651
- symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace
4730
+ symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace
4652
4731
 
4653
4732
  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4654
4733
  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
@@ -4784,7 +4863,8 @@ var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes
4784
4863
 
4785
4864
  var sizeAtStyle = function sizeAtStyle(size, style) {
4786
4865
  return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
4787
- };
4866
+ }; // In these types, "" (empty string) means "no change".
4867
+
4788
4868
 
4789
4869
  /**
4790
4870
  * This is the main options class. It contains the current style, size, color,
@@ -4858,12 +4938,12 @@ function () {
4858
4938
  }
4859
4939
 
4860
4940
  return new Options(data);
4861
- };
4941
+ }
4862
4942
  /**
4863
4943
  * Return an options object with the given style. If `this.style === style`,
4864
4944
  * returns `this`.
4865
4945
  */
4866
-
4946
+ ;
4867
4947
 
4868
4948
  _proto.havingStyle = function havingStyle(style) {
4869
4949
  if (this.style === style) {
@@ -4874,21 +4954,21 @@ function () {
4874
4954
  size: sizeAtStyle(this.textSize, style)
4875
4955
  });
4876
4956
  }
4877
- };
4957
+ }
4878
4958
  /**
4879
4959
  * Return an options object with a cramped version of the current style. If
4880
4960
  * the current style is cramped, returns `this`.
4881
4961
  */
4882
-
4962
+ ;
4883
4963
 
4884
4964
  _proto.havingCrampedStyle = function havingCrampedStyle() {
4885
4965
  return this.havingStyle(this.style.cramp());
4886
- };
4966
+ }
4887
4967
  /**
4888
4968
  * Return an options object with the given size and in at least `\textstyle`.
4889
4969
  * Returns `this` if appropriate.
4890
4970
  */
4891
-
4971
+ ;
4892
4972
 
4893
4973
  _proto.havingSize = function havingSize(size) {
4894
4974
  if (this.size === size && this.textSize === size) {
@@ -4901,12 +4981,12 @@ function () {
4901
4981
  sizeMultiplier: sizeMultipliers[size - 1]
4902
4982
  });
4903
4983
  }
4904
- };
4984
+ }
4905
4985
  /**
4906
4986
  * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
4907
4987
  * changes to at least `\textstyle`.
4908
4988
  */
4909
-
4989
+ ;
4910
4990
 
4911
4991
  _proto.havingBaseStyle = function havingBaseStyle(style) {
4912
4992
  style = style || this.style.text();
@@ -4920,12 +5000,12 @@ function () {
4920
5000
  size: wantSize
4921
5001
  });
4922
5002
  }
4923
- };
5003
+ }
4924
5004
  /**
4925
5005
  * Remove the effect of sizing changes such as \Huge.
4926
5006
  * Keep the effect of the current style, such as \scriptstyle.
4927
5007
  */
4928
-
5008
+ ;
4929
5009
 
4930
5010
  _proto.havingBaseSizing = function havingBaseSizing() {
4931
5011
  var size;
@@ -4952,76 +5032,76 @@ function () {
4952
5032
  style: this.style.text(),
4953
5033
  size: size
4954
5034
  });
4955
- };
5035
+ }
4956
5036
  /**
4957
5037
  * Create a new options object with the given color.
4958
5038
  */
4959
-
5039
+ ;
4960
5040
 
4961
5041
  _proto.withColor = function withColor(color) {
4962
5042
  return this.extend({
4963
5043
  color: color
4964
5044
  });
4965
- };
5045
+ }
4966
5046
  /**
4967
5047
  * Create a new options object with "phantom" set to true.
4968
5048
  */
4969
-
5049
+ ;
4970
5050
 
4971
5051
  _proto.withPhantom = function withPhantom() {
4972
5052
  return this.extend({
4973
5053
  phantom: true
4974
5054
  });
4975
- };
5055
+ }
4976
5056
  /**
4977
5057
  * Creates a new options object with the given math font or old text font.
4978
5058
  * @type {[type]}
4979
5059
  */
4980
-
5060
+ ;
4981
5061
 
4982
5062
  _proto.withFont = function withFont(font) {
4983
5063
  return this.extend({
4984
5064
  font: font
4985
5065
  });
4986
- };
5066
+ }
4987
5067
  /**
4988
5068
  * Create a new options objects with the given fontFamily.
4989
5069
  */
4990
-
5070
+ ;
4991
5071
 
4992
5072
  _proto.withTextFontFamily = function withTextFontFamily(fontFamily) {
4993
5073
  return this.extend({
4994
5074
  fontFamily: fontFamily,
4995
5075
  font: ""
4996
5076
  });
4997
- };
5077
+ }
4998
5078
  /**
4999
5079
  * Creates a new options object with the given font weight
5000
5080
  */
5001
-
5081
+ ;
5002
5082
 
5003
5083
  _proto.withTextFontWeight = function withTextFontWeight(fontWeight) {
5004
5084
  return this.extend({
5005
5085
  fontWeight: fontWeight,
5006
5086
  font: ""
5007
5087
  });
5008
- };
5088
+ }
5009
5089
  /**
5010
5090
  * Creates a new options object with the given font weight
5011
5091
  */
5012
-
5092
+ ;
5013
5093
 
5014
5094
  _proto.withTextFontShape = function withTextFontShape(fontShape) {
5015
5095
  return this.extend({
5016
5096
  fontShape: fontShape,
5017
5097
  font: ""
5018
5098
  });
5019
- };
5099
+ }
5020
5100
  /**
5021
5101
  * Return the CSS sizing classes required to switch from enclosing options
5022
5102
  * `oldOptions` to `this`. Returns an array of classes.
5023
5103
  */
5024
-
5104
+ ;
5025
5105
 
5026
5106
  _proto.sizingClasses = function sizingClasses(oldOptions) {
5027
5107
  if (oldOptions.size !== this.size) {
@@ -5029,12 +5109,12 @@ function () {
5029
5109
  } else {
5030
5110
  return [];
5031
5111
  }
5032
- };
5112
+ }
5033
5113
  /**
5034
5114
  * Return the CSS sizing classes required to switch to the base size. Like
5035
5115
  * `this.havingSize(BASESIZE).sizingClasses(this)`.
5036
5116
  */
5037
-
5117
+ ;
5038
5118
 
5039
5119
  _proto.baseSizingClasses = function baseSizingClasses() {
5040
5120
  if (this.size !== Options.BASESIZE) {
@@ -5042,11 +5122,11 @@ function () {
5042
5122
  } else {
5043
5123
  return [];
5044
5124
  }
5045
- };
5125
+ }
5046
5126
  /**
5047
5127
  * Return the font metrics for this size.
5048
5128
  */
5049
-
5129
+ ;
5050
5130
 
5051
5131
  _proto.fontMetrics = function fontMetrics() {
5052
5132
  if (!this._fontMetrics) {
@@ -5054,22 +5134,15 @@ function () {
5054
5134
  }
5055
5135
 
5056
5136
  return this._fontMetrics;
5057
- };
5137
+ }
5058
5138
  /**
5059
- * A map of color names to CSS colors.
5060
- * TODO(emily): Remove this when we have real macros
5139
+ * Gets the CSS color of the current options object
5061
5140
  */
5141
+ ;
5062
5142
 
5063
-
5064
- /**
5065
- * Gets the CSS color of the current options object, accounting for the
5066
- * `colorMap`.
5067
- */
5068
5143
  _proto.getColor = function getColor() {
5069
5144
  if (this.phantom) {
5070
5145
  return "transparent";
5071
- } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) {
5072
- return Options.colorMap[this.color];
5073
5146
  } else {
5074
5147
  return this.color;
5075
5148
  }
@@ -5079,64 +5152,6 @@ function () {
5079
5152
  }();
5080
5153
 
5081
5154
  Options_Options.BASESIZE = 6;
5082
- Options_Options.colorMap = {
5083
- "katex-blue": "#6495ed",
5084
- "katex-orange": "#ffa500",
5085
- "katex-pink": "#ff00af",
5086
- "katex-red": "#df0030",
5087
- "katex-green": "#28ae7b",
5088
- "katex-gray": "gray",
5089
- "katex-purple": "#9d38bd",
5090
- "katex-blueA": "#ccfaff",
5091
- "katex-blueB": "#80f6ff",
5092
- "katex-blueC": "#63d9ea",
5093
- "katex-blueD": "#11accd",
5094
- "katex-blueE": "#0c7f99",
5095
- "katex-tealA": "#94fff5",
5096
- "katex-tealB": "#26edd5",
5097
- "katex-tealC": "#01d1c1",
5098
- "katex-tealD": "#01a995",
5099
- "katex-tealE": "#208170",
5100
- "katex-greenA": "#b6ffb0",
5101
- "katex-greenB": "#8af281",
5102
- "katex-greenC": "#74cf70",
5103
- "katex-greenD": "#1fab54",
5104
- "katex-greenE": "#0d923f",
5105
- "katex-goldA": "#ffd0a9",
5106
- "katex-goldB": "#ffbb71",
5107
- "katex-goldC": "#ff9c39",
5108
- "katex-goldD": "#e07d10",
5109
- "katex-goldE": "#a75a05",
5110
- "katex-redA": "#fca9a9",
5111
- "katex-redB": "#ff8482",
5112
- "katex-redC": "#f9685d",
5113
- "katex-redD": "#e84d39",
5114
- "katex-redE": "#bc2612",
5115
- "katex-maroonA": "#ffbde0",
5116
- "katex-maroonB": "#ff92c6",
5117
- "katex-maroonC": "#ed5fa6",
5118
- "katex-maroonD": "#ca337c",
5119
- "katex-maroonE": "#9e034e",
5120
- "katex-purpleA": "#ddd7ff",
5121
- "katex-purpleB": "#c6b9fc",
5122
- "katex-purpleC": "#aa87ff",
5123
- "katex-purpleD": "#7854ab",
5124
- "katex-purpleE": "#543b78",
5125
- "katex-mintA": "#f5f9e8",
5126
- "katex-mintB": "#edf2df",
5127
- "katex-mintC": "#e0e5cc",
5128
- "katex-grayA": "#f6f7f7",
5129
- "katex-grayB": "#f0f1f2",
5130
- "katex-grayC": "#e3e5e6",
5131
- "katex-grayD": "#d6d8da",
5132
- "katex-grayE": "#babec2",
5133
- "katex-grayF": "#888d93",
5134
- "katex-grayG": "#626569",
5135
- "katex-grayH": "#3b3e40",
5136
- "katex-grayI": "#21242c",
5137
- "katex-kaBlue": "#314453",
5138
- "katex-kaGreen": "#71B307"
5139
- };
5140
5155
  /* harmony default export */ var src_Options = (Options_Options);
5141
5156
  // CONCATENATED MODULE: ./src/units.js
5142
5157
  /**
@@ -6270,25 +6285,8 @@ var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbi
6270
6285
  // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
6271
6286
  // and the text before Rule 19.
6272
6287
 
6273
- var buildHTML_isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) {
6274
- // TODO: This code assumes that a node's math class is the first element
6275
- // of its `classes` array. A later cleanup should ensure this, for
6276
- // instance by changing the signature of `makeSpan`.
6277
- if (node) {
6278
- return utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], getTypeOfDomTree(node, "right"));
6279
- } else {
6280
- return isRealGroup;
6281
- }
6282
- };
6283
-
6284
- var buildHTML_isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) {
6285
- if (node) {
6286
- return utils.contains(["mrel", "mclose", "mpunct"], getTypeOfDomTree(node, "left"));
6287
- } else {
6288
- return isRealGroup;
6289
- }
6290
- };
6291
-
6288
+ var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
6289
+ var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
6292
6290
  var buildHTML_styleMap = {
6293
6291
  "display": src_Style.DISPLAY,
6294
6292
  "text": src_Style.TEXT,
@@ -6320,114 +6318,159 @@ var buildHTML_buildExpression = function buildExpression(expression, options, is
6320
6318
  }
6321
6319
 
6322
6320
  // Parse expressions into `groups`.
6323
- var rawGroups = [];
6321
+ var groups = [];
6324
6322
 
6325
6323
  for (var i = 0; i < expression.length; i++) {
6326
6324
  var output = buildHTML_buildGroup(expression[i], options);
6327
6325
 
6328
6326
  if (output instanceof tree_DocumentFragment) {
6329
6327
  var children = output.children;
6330
- rawGroups.push.apply(rawGroups, children);
6328
+ groups.push.apply(groups, children);
6331
6329
  } else {
6332
- rawGroups.push(output);
6330
+ groups.push(output);
6333
6331
  }
6334
- } // At this point `rawGroups` consists entirely of `symbolNode`s and `span`s.
6335
- // Ignore explicit spaces (e.g., \;, \,) when determining what implicit
6336
- // spacing should go between atoms of different classes, and add dummy
6337
- // spans for determining spacings between surrounding atoms.
6332
+ } // If `expression` is a partial group, let the parent handle spacings
6333
+ // to avoid processing groups multiple times.
6338
6334
 
6339
6335
 
6340
- var nonSpaces = [surrounding[0] ? buildHTML_makeSpan([surrounding[0]], [], options) : null].concat(rawGroups.filter(function (group) {
6341
- return group && group.classes[0] !== "mspace";
6342
- }), [surrounding[1] ? buildHTML_makeSpan([surrounding[1]], [], options) : null]); // Before determining what spaces to insert, perform bin cancellation.
6343
- // Binary operators change to ordinary symbols in some contexts.
6336
+ if (!isRealGroup) {
6337
+ return groups;
6338
+ }
6344
6339
 
6345
- for (var _i = 1; _i < nonSpaces.length - 1; _i++) {
6346
- var nonSpacesI = assert(nonSpaces[_i]);
6347
- var left = buildHTML_getOutermostNode(nonSpacesI, "left");
6340
+ var glueOptions = options;
6348
6341
 
6349
- if (left.classes[0] === "mbin" && buildHTML_isBinLeftCanceller(nonSpaces[_i - 1], isRealGroup)) {
6350
- left.classes[0] = "mord";
6342
+ if (expression.length === 1) {
6343
+ var node = checkNodeType(expression[0], "sizing") || checkNodeType(expression[0], "styling");
6344
+
6345
+ if (!node) {// No match.
6346
+ } else if (node.type === "sizing") {
6347
+ glueOptions = options.havingSize(node.size);
6348
+ } else if (node.type === "styling") {
6349
+ glueOptions = options.havingStyle(buildHTML_styleMap[node.style]);
6351
6350
  }
6351
+ } // Dummy spans for determining spacings between surrounding atoms.
6352
+ // If `expression` has no atoms on the left or right, class "leftmost"
6353
+ // or "rightmost", respectively, is used to indicate it.
6354
+
6355
+
6356
+ var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options);
6357
+ var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
6358
+ // of its `classes` array. A later cleanup should ensure this, for
6359
+ // instance by changing the signature of `makeSpan`.
6360
+ // Before determining what spaces to insert, perform bin cancellation.
6361
+ // Binary operators change to ordinary symbols in some contexts.
6352
6362
 
6353
- var right = buildHTML_getOutermostNode(nonSpacesI, "right");
6363
+ traverseNonSpaceNodes(groups, function (node, prev) {
6364
+ var prevType = prev.classes[0];
6365
+ var type = node.classes[0];
6354
6366
 
6355
- if (right.classes[0] === "mbin" && buildHTML_isBinRightCanceller(nonSpaces[_i + 1], isRealGroup)) {
6356
- right.classes[0] = "mord";
6367
+ if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
6368
+ prev.classes[0] = "mord";
6369
+ } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
6370
+ node.classes[0] = "mord";
6357
6371
  }
6358
- }
6372
+ }, {
6373
+ node: dummyPrev
6374
+ }, dummyNext);
6375
+ traverseNonSpaceNodes(groups, function (node, prev) {
6376
+ var prevType = getTypeOfDomTree(prev);
6377
+ var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.
6359
6378
 
6360
- var groups = [];
6361
- var j = 0;
6379
+ var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;
6362
6380
 
6363
- for (var _i2 = 0; _i2 < rawGroups.length; _i2++) {
6364
- groups.push(rawGroups[_i2]); // For any group that is not a space, get the next non-space. Then
6365
- // lookup what implicit space should be placed between those atoms and
6366
- // add it to groups.
6381
+ if (space) {
6382
+ // Insert glue (spacing) after the `prev`.
6383
+ return buildCommon.makeGlue(space, glueOptions);
6384
+ }
6385
+ }, {
6386
+ node: dummyPrev
6387
+ }, dummyNext);
6388
+ return groups;
6389
+ }; // Depth-first traverse non-space `nodes`, calling `callback` with the current and
6390
+ // previous node as arguments, optionally returning a node to insert after the
6391
+ // previous node. `prev` is an object with the previous node and `insertAfter`
6392
+ // function to insert after it. `next` is a node that will be added to the right.
6393
+ // Used for bin cancellation and inserting spacings.
6394
+
6395
+ var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next) {
6396
+ if (next) {
6397
+ // temporarily append the right node, if exists
6398
+ nodes.push(next);
6399
+ }
6367
6400
 
6368
- if (rawGroups[_i2].classes[0] !== "mspace" && j < nonSpaces.length - 1) {
6369
- // if current non-space node is left dummy span, add a glue before
6370
- // first real non-space node
6371
- if (j === 0) {
6372
- groups.pop();
6373
- _i2--;
6374
- } // Get the type of the current non-space node. If it's a document
6375
- // fragment, get the type of the rightmost node in the fragment.
6401
+ var i = 0;
6376
6402
 
6403
+ for (; i < nodes.length; i++) {
6404
+ var node = nodes[i];
6405
+ var partialGroup = buildHTML_checkPartialGroup(node);
6377
6406
 
6378
- var _left = getTypeOfDomTree(nonSpaces[j], "right"); // Get the type of the next non-space node. If it's a document
6379
- // fragment, get the type of the leftmost node in the fragment.
6407
+ if (partialGroup) {
6408
+ // Recursive DFS
6409
+ traverseNonSpaceNodes(partialGroup.children, callback, prev);
6410
+ continue;
6411
+ } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit
6412
+ // spacing should go between atoms of different classes
6380
6413
 
6381
6414
 
6382
- var _right = getTypeOfDomTree(nonSpaces[j + 1], "left"); // We use buildExpression inside of sizingGroup, but it returns a
6383
- // document fragment of elements. sizingGroup sets `isRealGroup`
6384
- // to false to avoid processing spans multiple times.
6415
+ if (node.classes[0] === "mspace") {
6416
+ continue;
6417
+ }
6385
6418
 
6419
+ var result = callback(node, prev.node);
6386
6420
 
6387
- if (_left && _right && isRealGroup) {
6388
- var nonSpacesJp1 = assert(nonSpaces[j + 1]);
6389
- var space = isLeftTight(nonSpacesJp1) ? tightSpacings[_left][_right] : spacings[_left][_right];
6421
+ if (result) {
6422
+ if (prev.insertAfter) {
6423
+ prev.insertAfter(result);
6424
+ } else {
6425
+ // insert at front
6426
+ nodes.unshift(result);
6427
+ i++;
6428
+ }
6429
+ }
6390
6430
 
6391
- if (space) {
6392
- var glueOptions = options;
6431
+ prev.node = node;
6393
6432
 
6394
- if (expression.length === 1) {
6395
- var node = checkNodeType(expression[0], "sizing") || checkNodeType(expression[0], "styling");
6433
+ prev.insertAfter = function (index) {
6434
+ return function (n) {
6435
+ nodes.splice(index + 1, 0, n);
6436
+ i++;
6437
+ };
6438
+ }(i);
6439
+ }
6396
6440
 
6397
- if (!node) {// No match.
6398
- } else if (node.type === "sizing") {
6399
- glueOptions = options.havingSize(node.size);
6400
- } else if (node.type === "styling") {
6401
- glueOptions = options.havingStyle(buildHTML_styleMap[node.style]);
6402
- }
6403
- }
6441
+ if (next) {
6442
+ nodes.pop();
6443
+ }
6444
+ }; // Check if given node is a partial group, i.e., does not affect spacing around.
6404
6445
 
6405
- groups.push(buildCommon.makeGlue(space, glueOptions));
6406
- }
6407
- }
6408
6446
 
6409
- j++;
6410
- }
6447
+ var buildHTML_checkPartialGroup = function checkPartialGroup(node) {
6448
+ if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor) {
6449
+ return node;
6411
6450
  }
6412
6451
 
6413
- return groups;
6452
+ return null;
6414
6453
  }; // Return the outermost node of a domTree.
6415
6454
 
6416
- var buildHTML_getOutermostNode = function getOutermostNode(node, side) {
6417
- if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor) {
6418
- var children = node.children;
6455
+
6456
+ var getOutermostNode = function getOutermostNode(node, side) {
6457
+ var partialGroup = buildHTML_checkPartialGroup(node);
6458
+
6459
+ if (partialGroup) {
6460
+ var children = partialGroup.children;
6419
6461
 
6420
6462
  if (children.length) {
6421
6463
  if (side === "right") {
6422
6464
  return getOutermostNode(children[children.length - 1], "right");
6423
6465
  } else if (side === "left") {
6424
- return getOutermostNode(children[0], "right");
6466
+ return getOutermostNode(children[0], "left");
6425
6467
  }
6426
6468
  }
6427
6469
  }
6428
6470
 
6429
6471
  return node;
6430
6472
  }; // Return math atom class (mclass) of a domTree.
6473
+ // If `side` is given, it will get the type of the outermost node at given side.
6431
6474
 
6432
6475
 
6433
6476
  var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
@@ -6435,18 +6478,13 @@ var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
6435
6478
  return null;
6436
6479
  }
6437
6480
 
6438
- node = buildHTML_getOutermostNode(node, side); // This makes a lot of assumptions as to where the type of atom
6481
+ if (side) {
6482
+ node = getOutermostNode(node, side);
6483
+ } // This makes a lot of assumptions as to where the type of atom
6439
6484
  // appears. We should do a better job of enforcing this.
6440
6485
 
6486
+
6441
6487
  return DomEnum[node.classes[0]] || null;
6442
- }; // If `node` is an atom return whether it's been assigned the mtight class.
6443
- // If `node` is a document fragment, return the value of isLeftTight() for the
6444
- // leftmost node in the fragment.
6445
- // 'mtight' indicates that the node is script or scriptscript style.
6446
-
6447
- var isLeftTight = function isLeftTight(node) {
6448
- node = buildHTML_getOutermostNode(node, "left");
6449
- return node.hasClass("mtight");
6450
6488
  };
6451
6489
  var makeNullDelimiter = function makeNullDelimiter(options, classes) {
6452
6490
  var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
@@ -6534,10 +6572,10 @@ function buildHTML(tree, options) {
6534
6572
 
6535
6573
  if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
6536
6574
  // Put any post-operator glue on same line as operator.
6537
- // Watch for \nobreak along the way.
6575
+ // Watch for \nobreak along the way, and stop at \newline.
6538
6576
  var nobreak = false;
6539
6577
 
6540
- while (i < expression.length - 1 && expression[i + 1].hasClass("mspace")) {
6578
+ while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
6541
6579
  i++;
6542
6580
  parts.push(expression[i]);
6543
6581
 
@@ -6632,19 +6670,19 @@ function () {
6632
6670
 
6633
6671
  _proto.setAttribute = function setAttribute(name, value) {
6634
6672
  this.attributes[name] = value;
6635
- };
6673
+ }
6636
6674
  /**
6637
6675
  * Gets an attribute on a MathML node.
6638
6676
  */
6639
-
6677
+ ;
6640
6678
 
6641
6679
  _proto.getAttribute = function getAttribute(name) {
6642
6680
  return this.attributes[name];
6643
- };
6681
+ }
6644
6682
  /**
6645
6683
  * Converts the math node into a MathML-namespaced DOM element.
6646
6684
  */
6647
-
6685
+ ;
6648
6686
 
6649
6687
  _proto.toNode = function toNode() {
6650
6688
  var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
@@ -6660,11 +6698,11 @@ function () {
6660
6698
  }
6661
6699
 
6662
6700
  return node;
6663
- };
6701
+ }
6664
6702
  /**
6665
6703
  * Converts the math node into an HTML markup string.
6666
6704
  */
6667
-
6705
+ ;
6668
6706
 
6669
6707
  _proto.toMarkup = function toMarkup() {
6670
6708
  var markup = "<" + this.type; // Add the attributes
@@ -6685,11 +6723,11 @@ function () {
6685
6723
 
6686
6724
  markup += "</" + this.type + ">";
6687
6725
  return markup;
6688
- };
6726
+ }
6689
6727
  /**
6690
6728
  * Converts the math node into a string, similar to innerText, but escaped.
6691
6729
  */
6692
-
6730
+ ;
6693
6731
 
6694
6732
  _proto.toText = function toText() {
6695
6733
  return this.children.map(function (child) {
@@ -6706,15 +6744,9 @@ function () {
6706
6744
  var mathMLTree_TextNode =
6707
6745
  /*#__PURE__*/
6708
6746
  function () {
6709
- function TextNode(text, needsEscape) {
6710
- if (needsEscape === void 0) {
6711
- needsEscape = true;
6712
- }
6713
-
6747
+ function TextNode(text) {
6714
6748
  this.text = void 0;
6715
- this.needsEscape = void 0;
6716
6749
  this.text = text;
6717
- this.needsEscape = needsEscape;
6718
6750
  }
6719
6751
  /**
6720
6752
  * Converts the text node into a DOM text node.
@@ -6724,25 +6756,25 @@ function () {
6724
6756
  var _proto2 = TextNode.prototype;
6725
6757
 
6726
6758
  _proto2.toNode = function toNode() {
6727
- return document.createTextNode(this.toText());
6728
- };
6759
+ return document.createTextNode(this.text);
6760
+ }
6729
6761
  /**
6730
6762
  * Converts the text node into escaped HTML markup
6731
6763
  * (representing the text itself).
6732
6764
  */
6733
-
6765
+ ;
6734
6766
 
6735
6767
  _proto2.toMarkup = function toMarkup() {
6736
- return this.toText();
6737
- };
6768
+ return utils.escape(this.toText());
6769
+ }
6738
6770
  /**
6739
- * Converts the text node into an escaped string
6771
+ * Converts the text node into a string
6740
6772
  * (representing the text iteself).
6741
6773
  */
6742
-
6774
+ ;
6743
6775
 
6744
6776
  _proto2.toText = function toText() {
6745
- return this.needsEscape ? utils.escape(this.text) : this.text;
6777
+ return this.text;
6746
6778
  };
6747
6779
 
6748
6780
  return TextNode;
@@ -6762,26 +6794,26 @@ function () {
6762
6794
  this.width = void 0;
6763
6795
  this.character = void 0;
6764
6796
  this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
6765
- // for a table of space-like characters. We consistently use the
6766
- // &LongNames; because Unicode does not have single characters for
6767
- // &ThickSpace; (\u2005\u200a) and all negative spaces.
6797
+ // for a table of space-like characters. We use Unicode
6798
+ // representations instead of &LongNames; as it's not clear how to
6799
+ // make the latter via document.createTextNode.
6768
6800
 
6769
6801
  if (width >= 0.05555 && width <= 0.05556) {
6770
- this.character = "&VeryThinSpace;"; // \u200a
6802
+ this.character = "\u200A"; // &VeryThinSpace;
6771
6803
  } else if (width >= 0.1666 && width <= 0.1667) {
6772
- this.character = "&ThinSpace;"; // \u2009
6804
+ this.character = "\u2009"; // &ThinSpace;
6773
6805
  } else if (width >= 0.2222 && width <= 0.2223) {
6774
- this.character = "&MediumSpace;"; // \u2005
6806
+ this.character = "\u2005"; // &MediumSpace;
6775
6807
  } else if (width >= 0.2777 && width <= 0.2778) {
6776
- this.character = "&ThickSpace;"; // \u2005\u200a
6808
+ this.character = "\u2005\u200A"; // &ThickSpace;
6777
6809
  } else if (width >= -0.05556 && width <= -0.05555) {
6778
- this.character = "&NegativeVeryThinSpace;";
6810
+ this.character = "\u200A\u2063"; // &NegativeVeryThinSpace;
6779
6811
  } else if (width >= -0.1667 && width <= -0.1666) {
6780
- this.character = "&NegativeThinSpace;";
6812
+ this.character = "\u2009\u2063"; // &NegativeThinSpace;
6781
6813
  } else if (width >= -0.2223 && width <= -0.2222) {
6782
- this.character = "&NegativeMediumSpace;";
6814
+ this.character = "\u205F\u2063"; // &NegativeMediumSpace;
6783
6815
  } else if (width >= -0.2778 && width <= -0.2777) {
6784
- this.character = "&NegativeThickSpace;";
6816
+ this.character = "\u2005\u2063"; // &NegativeThickSpace;
6785
6817
  } else {
6786
6818
  this.character = null;
6787
6819
  }
@@ -6801,11 +6833,11 @@ function () {
6801
6833
  node.setAttribute("width", this.width + "em");
6802
6834
  return node;
6803
6835
  }
6804
- };
6836
+ }
6805
6837
  /**
6806
6838
  * Converts the math node into an HTML markup string.
6807
6839
  */
6808
-
6840
+ ;
6809
6841
 
6810
6842
  _proto3.toMarkup = function toMarkup() {
6811
6843
  if (this.character) {
@@ -6813,11 +6845,11 @@ function () {
6813
6845
  } else {
6814
6846
  return "<mspace width=\"" + this.width + "em\"/>";
6815
6847
  }
6816
- };
6848
+ }
6817
6849
  /**
6818
6850
  * Converts the math node into a string, similar to innerText.
6819
6851
  */
6820
-
6852
+ ;
6821
6853
 
6822
6854
  _proto3.toText = function toText() {
6823
6855
  if (this.character) {
@@ -6971,13 +7003,24 @@ var buildMathML_buildExpression = function buildExpression(expression, options)
6971
7003
 
6972
7004
  continue;
6973
7005
  }
7006
+ } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
7007
+ var lastChild = lastGroup.children[0];
7008
+
7009
+ if (lastChild instanceof mathMLTree_TextNode && lastChild.text === "\u0338" && (group.type === 'mo' || group.type === 'mi' || group.type === 'mn')) {
7010
+ var _child = group.children[0];
7011
+
7012
+ if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) {
7013
+ // Overlay with combining character long solidus
7014
+ _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1);
7015
+ groups.pop();
7016
+ }
7017
+ }
6974
7018
  }
6975
7019
  }
6976
7020
 
6977
7021
  groups.push(group);
6978
7022
  lastGroup = group;
6979
- } // TODO(kevinb): combine \\not with mrels and mords
6980
-
7023
+ }
6981
7024
 
6982
7025
  return groups;
6983
7026
  };
@@ -7055,28 +7098,36 @@ var buildTree_optionsFromSettings = function optionsFromSettings(settings) {
7055
7098
  });
7056
7099
  };
7057
7100
 
7101
+ var buildTree_displayWrap = function displayWrap(node, settings) {
7102
+ if (settings.displayMode) {
7103
+ var classes = ["katex-display"];
7104
+
7105
+ if (settings.leqno) {
7106
+ classes.push("leqno");
7107
+ }
7108
+
7109
+ if (settings.fleqn) {
7110
+ classes.push("fleqn");
7111
+ }
7112
+
7113
+ node = buildCommon.makeSpan(classes, [node]);
7114
+ }
7115
+
7116
+ return node;
7117
+ };
7118
+
7058
7119
  var buildTree_buildTree = function buildTree(tree, expression, settings) {
7059
7120
  var options = buildTree_optionsFromSettings(settings);
7060
7121
  var mathMLNode = buildMathML(tree, expression, options);
7061
7122
  var htmlNode = buildHTML(tree, options);
7062
7123
  var katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]);
7063
-
7064
- if (settings.displayMode) {
7065
- return buildCommon.makeSpan(["katex-display"], [katexNode]);
7066
- } else {
7067
- return katexNode;
7068
- }
7124
+ return buildTree_displayWrap(katexNode, settings);
7069
7125
  };
7070
7126
  var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) {
7071
7127
  var options = buildTree_optionsFromSettings(settings);
7072
7128
  var htmlNode = buildHTML(tree, options);
7073
7129
  var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
7074
-
7075
- if (settings.displayMode) {
7076
- return buildCommon.makeSpan(["katex-display"], [katexNode]);
7077
- } else {
7078
- return katexNode;
7079
- }
7130
+ return buildTree_displayWrap(katexNode, settings);
7080
7131
  };
7081
7132
  /* harmony default export */ var src_buildTree = (buildTree_buildTree);
7082
7133
  // CONCATENATED MODULE: ./src/stretchy.js
@@ -7100,8 +7151,10 @@ var stretchyCodePoint = {
7100
7151
  overrightarrow: "\u2192",
7101
7152
  underrightarrow: "\u2192",
7102
7153
  xrightarrow: "\u2192",
7103
- underbrace: "\u23B5",
7154
+ underbrace: "\u23DF",
7104
7155
  overbrace: "\u23DE",
7156
+ overgroup: "\u23E0",
7157
+ undergroup: "\u23E1",
7105
7158
  overleftrightarrow: "\u2194",
7106
7159
  underleftrightarrow: "\u2194",
7107
7160
  xleftrightarrow: "\u2194",
@@ -7707,9 +7760,18 @@ defineFunction({
7707
7760
 
7708
7761
 
7709
7762
 
7710
- // Stretchy arrows with an optional argument
7711
- defineFunction({
7712
- type: "xArrow",
7763
+
7764
+ // Helper function
7765
+ var arrow_paddedNode = function paddedNode(group) {
7766
+ var node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
7767
+ node.setAttribute("width", "+0.6em");
7768
+ node.setAttribute("lspace", "0.3em");
7769
+ return node;
7770
+ }; // Stretchy arrows with an optional argument
7771
+
7772
+
7773
+ defineFunction({
7774
+ type: "xArrow",
7713
7775
  names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension.
7714
7776
  // Direct use of these functions is discouraged and may break someday.
7715
7777
  "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"],
@@ -7802,22 +7864,25 @@ defineFunction({
7802
7864
  mathmlBuilder: function mathmlBuilder(group, options) {
7803
7865
  var arrowNode = stretchy.mathMLnode(group.label);
7804
7866
  var node;
7805
- var lowerNode;
7806
7867
 
7807
7868
  if (group.body) {
7808
- var upperNode = buildMathML_buildGroup(group.body, options);
7869
+ var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options));
7809
7870
 
7810
7871
  if (group.below) {
7811
- lowerNode = buildMathML_buildGroup(group.below, options);
7872
+ var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));
7812
7873
  node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
7813
7874
  } else {
7814
7875
  node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
7815
7876
  }
7816
7877
  } else if (group.below) {
7817
- lowerNode = buildMathML_buildGroup(group.below, options);
7818
- node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]);
7878
+ var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));
7879
+
7880
+ node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
7819
7881
  } else {
7820
- node = new mathMLTree.MathNode("mover", [arrowNode]);
7882
+ // This should never happen.
7883
+ // Parser.js throws an error if there is no argument.
7884
+ node = arrow_paddedNode();
7885
+ node = new mathMLTree.MathNode("mover", [arrowNode, node]);
7821
7886
  }
7822
7887
 
7823
7888
  return node;
@@ -7879,7 +7944,7 @@ var color_htmlBuilder = function htmlBuilder(group, options) {
7879
7944
  };
7880
7945
 
7881
7946
  var color_mathmlBuilder = function mathmlBuilder(group, options) {
7882
- var inner = buildMathML_buildExpression(group.body, options);
7947
+ var inner = buildMathML_buildExpression(group.body, options.withColor(group.color));
7883
7948
  var node = new mathMLTree.MathNode("mstyle", inner);
7884
7949
  node.setAttribute("mathcolor", group.color);
7885
7950
  return node;
@@ -7907,29 +7972,6 @@ defineFunction({
7907
7972
  },
7908
7973
  htmlBuilder: color_htmlBuilder,
7909
7974
  mathmlBuilder: color_mathmlBuilder
7910
- }); // TODO(kevinb): define these using macros
7911
-
7912
- defineFunction({
7913
- type: "color",
7914
- names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"],
7915
- props: {
7916
- numArgs: 1,
7917
- allowedInText: true,
7918
- greediness: 3
7919
- },
7920
- handler: function handler(_ref2, args) {
7921
- var parser = _ref2.parser,
7922
- funcName = _ref2.funcName;
7923
- var body = args[0];
7924
- return {
7925
- type: "color",
7926
- mode: parser.mode,
7927
- color: "katex-" + funcName.slice(1),
7928
- body: defineFunction_ordargument(body)
7929
- };
7930
- },
7931
- htmlBuilder: color_htmlBuilder,
7932
- mathmlBuilder: color_mathmlBuilder
7933
7975
  });
7934
7976
  defineFunction({
7935
7977
  type: "color",
@@ -7940,9 +7982,9 @@ defineFunction({
7940
7982
  greediness: 3,
7941
7983
  argTypes: ["color"]
7942
7984
  },
7943
- handler: function handler(_ref3, args) {
7944
- var parser = _ref3.parser,
7945
- breakOnTokenText = _ref3.breakOnTokenText;
7985
+ handler: function handler(_ref2, args) {
7986
+ var parser = _ref2.parser,
7987
+ breakOnTokenText = _ref2.breakOnTokenText;
7946
7988
  var color = assertNodeType(args[0], "color-token").color; // If we see a styling function, parse out the implicit body
7947
7989
 
7948
7990
  var body = parser.parseExpression(true, breakOnTokenText);
@@ -8867,7 +8909,7 @@ defineFunction({
8867
8909
  htmlBuilder: function htmlBuilder(group, options) {
8868
8910
  assertParsed(group); // Build the inner expression
8869
8911
 
8870
- var inner = buildHTML_buildExpression(group.body, options, true, [null, "mclose"]);
8912
+ var inner = buildHTML_buildExpression(group.body, options, true, ["mopen", "mclose"]);
8871
8913
  var innerHeight = 0;
8872
8914
  var innerDepth = 0;
8873
8915
  var hadMiddle = false; // Calculate its height and depth
@@ -8990,8 +9032,17 @@ defineFunction({
8990
9032
  return middleDelim;
8991
9033
  },
8992
9034
  mathmlBuilder: function mathmlBuilder(group, options) {
8993
- var middleNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.delim, group.mode)]);
8994
- middleNode.setAttribute("fence", "true");
9035
+ // A Firefox \middle will strech a character vertically only if it
9036
+ // is in the fence part of the operator dictionary at:
9037
+ // https://www.w3.org/TR/MathML3/appendixc.html.
9038
+ // So we need to avoid U+2223 and use plain "|" instead.
9039
+ var textNode = group.delim === "\\vert" || group.delim === "|" ? buildMathML_makeText("|", "text") : buildMathML_makeText(group.delim, group.mode);
9040
+ var middleNode = new mathMLTree.MathNode("mo", [textNode]);
9041
+ middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
9042
+ // \middle should get delimiter spacing instead.
9043
+
9044
+ middleNode.setAttribute("lspace", "0.05em");
9045
+ middleNode.setAttribute("rspace", "0.05em");
8995
9046
  return middleNode;
8996
9047
  }
8997
9048
  });
@@ -9106,7 +9157,7 @@ var enclose_htmlBuilder = function htmlBuilder(group, options) {
9106
9157
  };
9107
9158
 
9108
9159
  var enclose_mathmlBuilder = function mathmlBuilder(group, options) {
9109
- var node = new mathMLTree.MathNode("menclose", [buildMathML_buildGroup(group.body, options)]);
9160
+ var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]);
9110
9161
 
9111
9162
  switch (group.label) {
9112
9163
  case "\\cancel":
@@ -9126,8 +9177,20 @@ var enclose_mathmlBuilder = function mathmlBuilder(group, options) {
9126
9177
  break;
9127
9178
 
9128
9179
  case "\\fcolorbox":
9129
- // TODO(ron): I don't know any way to set the border color.
9130
- node.setAttribute("notation", "box");
9180
+ case "\\colorbox":
9181
+ // <menclose> doesn't have a good notation option. So use <mpadded>
9182
+ // instead. Set some attributes that come included with <menclose>.
9183
+ node.setAttribute("width", "+6pt");
9184
+ node.setAttribute("height", "+6pt");
9185
+ node.setAttribute("lspace", "3pt"); // LaTeX source2e: \fboxsep = 3pt
9186
+
9187
+ node.setAttribute("voffset", "3pt");
9188
+
9189
+ if (group.label === "\\fcolorbox") {
9190
+ var thk = options.fontMetrics().defaultRuleThickness;
9191
+ node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
9192
+ }
9193
+
9131
9194
  break;
9132
9195
 
9133
9196
  case "\\xcancel":
@@ -9315,7 +9378,8 @@ function parseArray(parser, _ref, style) {
9315
9378
  var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
9316
9379
  addJot = _ref.addJot,
9317
9380
  cols = _ref.cols,
9318
- arraystretch = _ref.arraystretch;
9381
+ arraystretch = _ref.arraystretch,
9382
+ colSeparationType = _ref.colSeparationType;
9319
9383
  // Parse body of array with \\ temporarily mapped to \cr
9320
9384
  parser.gullet.beginGroup();
9321
9385
  parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment
@@ -9400,7 +9464,8 @@ function parseArray(parser, _ref, style) {
9400
9464
  cols: cols,
9401
9465
  rowGaps: rowGaps,
9402
9466
  hskipBeforeAndAfter: hskipBeforeAndAfter,
9403
- hLinesBeforeRow: hLinesBeforeRow
9467
+ hLinesBeforeRow: hLinesBeforeRow,
9468
+ colSeparationType: colSeparationType
9404
9469
  };
9405
9470
  } // Decides on a style for cells in an array according to whether the given
9406
9471
  // environment name starts with the letter 'd'.
@@ -9650,12 +9715,118 @@ var array_htmlBuilder = function htmlBuilder(group, options) {
9650
9715
  return buildCommon.makeSpan(["mord"], [body], options);
9651
9716
  };
9652
9717
 
9718
+ var alignMap = {
9719
+ c: "center ",
9720
+ l: "left ",
9721
+ r: "right "
9722
+ };
9723
+
9653
9724
  var array_mathmlBuilder = function mathmlBuilder(group, options) {
9654
- return new mathMLTree.MathNode("mtable", group.body.map(function (row) {
9725
+ var table = new mathMLTree.MathNode("mtable", group.body.map(function (row) {
9655
9726
  return new mathMLTree.MathNode("mtr", row.map(function (cell) {
9656
9727
  return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]);
9657
9728
  }));
9658
- }));
9729
+ })); // Set column alignment, row spacing, column spacing, and
9730
+ // array lines by setting attributes on the table element.
9731
+ // Set the row spacing. In MathML, we specify a gap distance.
9732
+ // We do not use rowGap[] because MathML automatically increases
9733
+ // cell height with the height/depth of the element content.
9734
+ // LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
9735
+ // We simulate this by adding (arraystretch - 1)em to the gap. This
9736
+ // does a reasonable job of adjusting arrays containing 1 em tall content.
9737
+ // The 0.16 and 0.09 values are found emprically. They produce an array
9738
+ // similar to LaTeX and in which content does not interfere with \hines.
9739
+
9740
+ var gap = 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
9741
+ table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells.
9742
+ // To place a line on an edge we'll use <menclose>, if necessary.
9743
+
9744
+ var menclose = "";
9745
+ var align = "";
9746
+
9747
+ if (group.cols) {
9748
+ // Find column alignment, column spacing, and vertical lines.
9749
+ var cols = group.cols;
9750
+ var columnLines = "";
9751
+ var prevTypeWasAlign = false;
9752
+ var iStart = 0;
9753
+ var iEnd = cols.length;
9754
+
9755
+ if (cols[0].type === "separator") {
9756
+ menclose += "top ";
9757
+ iStart = 1;
9758
+ }
9759
+
9760
+ if (cols[cols.length - 1].type === "separator") {
9761
+ menclose += "bottom ";
9762
+ iEnd -= 1;
9763
+ }
9764
+
9765
+ for (var i = iStart; i < iEnd; i++) {
9766
+ if (cols[i].type === "align") {
9767
+ align += alignMap[cols[i].align];
9768
+
9769
+ if (prevTypeWasAlign) {
9770
+ columnLines += "none ";
9771
+ }
9772
+
9773
+ prevTypeWasAlign = true;
9774
+ } else if (cols[i].type === "separator") {
9775
+ // MathML accepts only single lines between cells.
9776
+ // So we read only the first of consecutive separators.
9777
+ if (prevTypeWasAlign) {
9778
+ columnLines += cols[i].separator === "|" ? "solid " : "dashed ";
9779
+ prevTypeWasAlign = false;
9780
+ }
9781
+ }
9782
+ }
9783
+
9784
+ table.setAttribute("columnalign", align.trim());
9785
+
9786
+ if (/[sd]/.test(columnLines)) {
9787
+ table.setAttribute("columnlines", columnLines.trim());
9788
+ }
9789
+ } // Set column spacing.
9790
+
9791
+
9792
+ if (group.colSeparationType === "align") {
9793
+ var _cols = group.cols || [];
9794
+
9795
+ var spacing = "";
9796
+
9797
+ for (var _i = 1; _i < _cols.length; _i++) {
9798
+ spacing += _i % 2 ? "0em " : "1em ";
9799
+ }
9800
+
9801
+ table.setAttribute("columnspacing", spacing.trim());
9802
+ } else if (group.colSeparationType === "alignat") {
9803
+ table.setAttribute("columnspacing", "0em");
9804
+ } else {
9805
+ table.setAttribute("columnspacing", "1em");
9806
+ } // Address \hline and \hdashline
9807
+
9808
+
9809
+ var rowLines = "";
9810
+ var hlines = group.hLinesBeforeRow;
9811
+ menclose += hlines[0].length > 0 ? "left " : "";
9812
+ menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
9813
+
9814
+ for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) {
9815
+ rowLines += hlines[_i2].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element.
9816
+ : hlines[_i2][0] ? "dashed " : "solid ";
9817
+ }
9818
+
9819
+ if (/[sd]/.test(rowLines)) {
9820
+ table.setAttribute("rowlines", rowLines.trim());
9821
+ }
9822
+
9823
+ if (menclose === "") {
9824
+ return table;
9825
+ } else {
9826
+ var wrapper = new mathMLTree.MathNode("menclose", [table]);
9827
+ wrapper.setAttribute("notation", menclose.trim());
9828
+ return wrapper;
9829
+ }
9659
9830
  }; // Convenience function for aligned and alignedat environments.
9660
9831
 
9661
9832
 
@@ -9697,9 +9868,9 @@ var array_alignedHandler = function alignedHandler(context, args) {
9697
9868
 
9698
9869
  var isAligned = !numCols;
9699
9870
  res.body.forEach(function (row) {
9700
- for (var _i = 1; _i < row.length; _i += 2) {
9871
+ for (var _i3 = 1; _i3 < row.length; _i3 += 2) {
9701
9872
  // Modify ordgroup node within styling node
9702
- var styling = assertNodeType(row[_i], "styling");
9873
+ var styling = assertNodeType(row[_i3], "styling");
9703
9874
 
9704
9875
  var _ordgroup = assertNodeType(styling.body[0], "ordgroup");
9705
9876
 
@@ -9721,18 +9892,18 @@ var array_alignedHandler = function alignedHandler(context, args) {
9721
9892
  // In aligned mode, we add one \qquad between columns;
9722
9893
  // otherwise we add nothing.
9723
9894
 
9724
- for (var _i2 = 0; _i2 < numCols; ++_i2) {
9895
+ for (var _i4 = 0; _i4 < numCols; ++_i4) {
9725
9896
  var align = "r";
9726
9897
  var pregap = 0;
9727
9898
 
9728
- if (_i2 % 2 === 1) {
9899
+ if (_i4 % 2 === 1) {
9729
9900
  align = "l";
9730
- } else if (_i2 > 0 && isAligned) {
9901
+ } else if (_i4 > 0 && isAligned) {
9731
9902
  // "aligned" mode.
9732
9903
  pregap = 1; // add one \quad
9733
9904
  }
9734
9905
 
9735
- cols[_i2] = {
9906
+ cols[_i4] = {
9736
9907
  type: "align",
9737
9908
  align: align,
9738
9909
  pregap: pregap,
@@ -9740,6 +9911,7 @@ var array_alignedHandler = function alignedHandler(context, args) {
9740
9911
  };
9741
9912
  }
9742
9913
 
9914
+ res.colSeparationType = isAligned ? "align" : "alignat";
9743
9915
  return res;
9744
9916
  }; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
9745
9917
  // is part of the source2e.pdf file of LaTeX2e source documentation.
@@ -10107,6 +10279,7 @@ defineFunction({
10107
10279
  mode: baseArg.mode,
10108
10280
  limits: true,
10109
10281
  alwaysHandleSupSub: true,
10282
+ parentIsSupSub: false,
10110
10283
  symbol: false,
10111
10284
  suppressBaseShift: funcName !== "\\stackrel",
10112
10285
  body: defineFunction_ordargument(baseArg)
@@ -10221,7 +10394,6 @@ defineFunction({
10221
10394
  funcName = _ref3.funcName,
10222
10395
  breakOnTokenText = _ref3.breakOnTokenText;
10223
10396
  var mode = parser.mode;
10224
- parser.consumeSpaces();
10225
10397
  var body = parser.parseExpression(true, breakOnTokenText);
10226
10398
  var style = "math" + funcName.slice(1);
10227
10399
  return {
@@ -10250,23 +10422,30 @@ defineFunction({
10250
10422
 
10251
10423
 
10252
10424
 
10253
- var genfrac_htmlBuilder = function htmlBuilder(group, options) {
10254
- // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
10425
+ var genfrac_adjustStyle = function adjustStyle(size, originalStyle) {
10255
10426
  // Figure out what style this fraction should be in based on the
10256
10427
  // function used
10257
- var style = options.style;
10428
+ var style = originalStyle;
10258
10429
 
10259
- if (group.size === "display") {
10260
- style = src_Style.DISPLAY;
10261
- } else if (group.size === "text" && style.size === src_Style.DISPLAY.size) {
10430
+ if (size === "display") {
10431
+ // Get display style as a default.
10432
+ // If incoming style is sub/sup, use style.text() to get correct size.
10433
+ style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY;
10434
+ } else if (size === "text" && style.size === src_Style.DISPLAY.size) {
10262
10435
  // We're in a \tfrac but incoming style is displaystyle, so:
10263
10436
  style = src_Style.TEXT;
10264
- } else if (group.size === "script") {
10437
+ } else if (size === "script") {
10265
10438
  style = src_Style.SCRIPT;
10266
- } else if (group.size === "scriptscript") {
10439
+ } else if (size === "scriptscript") {
10267
10440
  style = src_Style.SCRIPTSCRIPT;
10268
10441
  }
10269
10442
 
10443
+ return style;
10444
+ };
10445
+
10446
+ var genfrac_htmlBuilder = function htmlBuilder(group, options) {
10447
+ // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
10448
+ var style = genfrac_adjustStyle(group.size, options.style);
10270
10449
  var nstyle = style.fracNum();
10271
10450
  var dstyle = style.fracDen();
10272
10451
  var newOptions;
@@ -10309,7 +10488,7 @@ var genfrac_htmlBuilder = function htmlBuilder(group, options) {
10309
10488
  var clearance;
10310
10489
  var denomShift;
10311
10490
 
10312
- if (style.size === src_Style.DISPLAY.size) {
10491
+ if (style.size === src_Style.DISPLAY.size || group.size === "display") {
10313
10492
  numShift = options.fontMetrics().num1;
10314
10493
 
10315
10494
  if (ruleWidth > 0) {
@@ -10429,11 +10608,20 @@ var genfrac_mathmlBuilder = function mathmlBuilder(group, options) {
10429
10608
  node.setAttribute("linethickness", ruleWidth + "em");
10430
10609
  }
10431
10610
 
10611
+ var style = genfrac_adjustStyle(group.size, options.style);
10612
+
10613
+ if (style.size !== options.style.size) {
10614
+ node = new mathMLTree.MathNode("mstyle", [node]);
10615
+ var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false";
10616
+ node.setAttribute("displaystyle", isDisplay);
10617
+ node.setAttribute("scriptlevel", "0");
10618
+ }
10619
+
10432
10620
  if (group.leftDelim != null || group.rightDelim != null) {
10433
10621
  var withDelims = [];
10434
10622
 
10435
10623
  if (group.leftDelim != null) {
10436
- var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim)]);
10624
+ var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
10437
10625
  leftOp.setAttribute("fence", "true");
10438
10626
  withDelims.push(leftOp);
10439
10627
  }
@@ -10441,7 +10629,7 @@ var genfrac_mathmlBuilder = function mathmlBuilder(group, options) {
10441
10629
  withDelims.push(node);
10442
10630
 
10443
10631
  if (group.rightDelim != null) {
10444
- var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim)]);
10632
+ var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
10445
10633
  rightOp.setAttribute("fence", "true");
10446
10634
  withDelims.push(rightOp);
10447
10635
  }
@@ -10609,24 +10797,20 @@ defineFunction({
10609
10797
  var numer = args[4];
10610
10798
  var denom = args[5]; // Look into the parse nodes to get the desired delimiters.
10611
10799
 
10612
- var leftNode = checkNodeType(args[0], "ordgroup");
10800
+ var leftNode = checkNodeType(args[0], "atom");
10613
10801
 
10614
10802
  if (leftNode) {
10615
- leftNode = assertAtomFamily(leftNode.body[0], "open");
10616
- } else {
10617
10803
  leftNode = assertAtomFamily(args[0], "open");
10618
10804
  }
10619
10805
 
10620
- var leftDelim = delimFromValue(leftNode.text);
10621
- var rightNode = checkNodeType(args[1], "ordgroup");
10806
+ var leftDelim = leftNode ? delimFromValue(leftNode.text) : null;
10807
+ var rightNode = checkNodeType(args[1], "atom");
10622
10808
 
10623
10809
  if (rightNode) {
10624
- rightNode = assertAtomFamily(rightNode.body[0], "close");
10625
- } else {
10626
10810
  rightNode = assertAtomFamily(args[1], "close");
10627
10811
  }
10628
10812
 
10629
- var rightDelim = delimFromValue(rightNode.text);
10813
+ var rightDelim = rightNode ? delimFromValue(rightNode.text) : null;
10630
10814
  var barNode = assertNodeType(args[2], "size");
10631
10815
  var hasBarLine;
10632
10816
  var barSize = null;
@@ -11214,7 +11398,10 @@ defineFunction({
11214
11398
 
11215
11399
 
11216
11400
 
11217
- // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
11401
+ // Most operators have a large successor symbol, but these don't.
11402
+ var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
11403
+ // "supsub" since some of them (like \int) can affect super/subscripting.
11404
+
11218
11405
  var op_htmlBuilder = function htmlBuilder(grp, options) {
11219
11406
  // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
11220
11407
  var supGroup;
@@ -11235,9 +11422,7 @@ var op_htmlBuilder = function htmlBuilder(grp, options) {
11235
11422
  group = assertNodeType(grp, "op");
11236
11423
  }
11237
11424
 
11238
- var style = options.style; // Most operators have a large successor symbol, but these don't.
11239
-
11240
- var noSuccessor = ["\\smallint"];
11425
+ var style = options.style;
11241
11426
  var large = false;
11242
11427
 
11243
11428
  if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
@@ -11449,11 +11634,15 @@ var op_htmlBuilder = function htmlBuilder(grp, options) {
11449
11634
  };
11450
11635
 
11451
11636
  var op_mathmlBuilder = function mathmlBuilder(group, options) {
11452
- var node; // TODO(emily): handle big operators using the `largeop` attribute
11637
+ var node;
11453
11638
 
11454
11639
  if (group.symbol) {
11455
11640
  // This is a symbol. Just add the symbol.
11456
11641
  node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]);
11642
+
11643
+ if (utils.contains(noSuccessor, group.name)) {
11644
+ node.setAttribute("largeop", "false");
11645
+ }
11457
11646
  } else if (group.body) {
11458
11647
  // This is an operator with children. Add them.
11459
11648
  node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options));
@@ -11466,7 +11655,12 @@ var op_mathmlBuilder = function mathmlBuilder(group, options) {
11466
11655
  // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
11467
11656
 
11468
11657
  var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]);
11469
- return newDocumentFragment([node, operator]);
11658
+
11659
+ if (group.parentIsSupSub) {
11660
+ node = new mathMLTree_MathNode("mo", [node, operator]);
11661
+ } else {
11662
+ node = newDocumentFragment([node, operator]);
11663
+ }
11470
11664
  }
11471
11665
 
11472
11666
  return node;
@@ -11479,7 +11673,7 @@ var singleCharBigOps = {
11479
11673
  "\u22C0": "\\bigwedge",
11480
11674
  "\u22C1": "\\bigvee",
11481
11675
  "\u22C2": "\\bigcap",
11482
- "\u22C3": "\\bigcap",
11676
+ "\u22C3": "\\bigcup",
11483
11677
  "\u2A00": "\\bigodot",
11484
11678
  "\u2A01": "\\bigoplus",
11485
11679
  "\u2A02": "\\bigotimes",
@@ -11505,6 +11699,7 @@ defineFunction({
11505
11699
  type: "op",
11506
11700
  mode: parser.mode,
11507
11701
  limits: true,
11702
+ parentIsSupSub: false,
11508
11703
  symbol: true,
11509
11704
  name: fName
11510
11705
  };
@@ -11527,6 +11722,7 @@ defineFunction({
11527
11722
  type: "op",
11528
11723
  mode: parser.mode,
11529
11724
  limits: false,
11725
+ parentIsSupSub: false,
11530
11726
  symbol: false,
11531
11727
  body: defineFunction_ordargument(body)
11532
11728
  };
@@ -11559,6 +11755,7 @@ defineFunction({
11559
11755
  type: "op",
11560
11756
  mode: parser.mode,
11561
11757
  limits: false,
11758
+ parentIsSupSub: false,
11562
11759
  symbol: false,
11563
11760
  name: funcName
11564
11761
  };
@@ -11580,6 +11777,7 @@ defineFunction({
11580
11777
  type: "op",
11581
11778
  mode: parser.mode,
11582
11779
  limits: true,
11780
+ parentIsSupSub: false,
11583
11781
  symbol: false,
11584
11782
  name: funcName
11585
11783
  };
@@ -11607,6 +11805,7 @@ defineFunction({
11607
11805
  type: "op",
11608
11806
  mode: parser.mode,
11609
11807
  limits: false,
11808
+ parentIsSupSub: false,
11610
11809
  symbol: true,
11611
11810
  name: fName
11612
11811
  };
@@ -11717,9 +11916,8 @@ defineFunction({
11717
11916
  // Write a single TextNode instead of multiple nested tags.
11718
11917
  var word = expression.map(function (node) {
11719
11918
  return node.toText();
11720
- }).join(""); // word has already been escaped by `node.toText()`
11721
-
11722
- expression = [new mathMLTree.TextNode(word, false)];
11919
+ }).join("");
11920
+ expression = [new mathMLTree.TextNode(word)];
11723
11921
  }
11724
11922
 
11725
11923
  var identifier = new mathMLTree.MathNode("mi", expression);
@@ -11738,6 +11936,10 @@ defineFunction({
11738
11936
  defineFunctionBuilders({
11739
11937
  type: "ordgroup",
11740
11938
  htmlBuilder: function htmlBuilder(group, options) {
11939
+ if (group.semisimple) {
11940
+ return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false));
11941
+ }
11942
+
11741
11943
  return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options);
11742
11944
  },
11743
11945
  mathmlBuilder: function mathmlBuilder(group, options) {
@@ -11866,13 +12068,16 @@ defineFunction({
11866
12068
  type: "elem",
11867
12069
  elem: node
11868
12070
  }]
11869
- }, options);
11870
- return node;
12071
+ }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord).
12072
+
12073
+ return buildCommon.makeSpan(["mord"], [node], options);
11871
12074
  },
11872
12075
  mathmlBuilder: function mathmlBuilder(group, options) {
11873
12076
  var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);
11874
- var node = new mathMLTree.MathNode("mphantom", inner);
12077
+ var phantom = new mathMLTree.MathNode("mphantom", inner);
12078
+ var node = new mathMLTree.MathNode("mpadded", [phantom]);
11875
12079
  node.setAttribute("height", "0px");
12080
+ node.setAttribute("depth", "0px");
11876
12081
  return node;
11877
12082
  }
11878
12083
  });
@@ -11899,7 +12104,8 @@ defineFunction({
11899
12104
  },
11900
12105
  mathmlBuilder: function mathmlBuilder(group, options) {
11901
12106
  var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);
11902
- var node = new mathMLTree.MathNode("mphantom", inner);
12107
+ var phantom = new mathMLTree.MathNode("mphantom", inner);
12108
+ var node = new mathMLTree.MathNode("mpadded", [phantom]);
11903
12109
  node.setAttribute("width", "0px");
11904
12110
  return node;
11905
12111
  }
@@ -11952,7 +12158,6 @@ defineFunction({
11952
12158
  var breakOnTokenText = _ref.breakOnTokenText,
11953
12159
  funcName = _ref.funcName,
11954
12160
  parser = _ref.parser;
11955
- parser.consumeSpaces();
11956
12161
  var body = parser.parseExpression(false, breakOnTokenText);
11957
12162
  return {
11958
12163
  type: "sizing",
@@ -12068,14 +12273,9 @@ defineFunction({
12068
12273
  // Make an empty span for the rule
12069
12274
  var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
12070
12275
 
12071
- var shift = 0;
12072
-
12073
- if (group.shift) {
12074
- shift = units_calculateSize(group.shift, options);
12075
- }
12076
-
12077
12276
  var width = units_calculateSize(group.width, options);
12078
- var height = units_calculateSize(group.height, options); // Style the rule to the right size
12277
+ var height = units_calculateSize(group.height, options);
12278
+ var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size
12079
12279
 
12080
12280
  rule.style.borderRightWidth = width + "em";
12081
12281
  rule.style.borderTopWidth = height + "em";
@@ -12091,10 +12291,25 @@ defineFunction({
12091
12291
  return rule;
12092
12292
  },
12093
12293
  mathmlBuilder: function mathmlBuilder(group, options) {
12094
- // TODO(emily): Figure out if there's an actual way to draw black boxes
12095
- // in MathML.
12096
- var node = new mathMLTree.MathNode("mrow");
12097
- return node;
12294
+ var width = units_calculateSize(group.width, options);
12295
+ var height = units_calculateSize(group.height, options);
12296
+ var shift = group.shift ? units_calculateSize(group.shift, options) : 0;
12297
+ var color = options.color && options.getColor() || "black";
12298
+ var rule = new mathMLTree.MathNode("mspace");
12299
+ rule.setAttribute("mathbackground", color);
12300
+ rule.setAttribute("width", width + "em");
12301
+ rule.setAttribute("height", height + "em");
12302
+ var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
12303
+
12304
+ if (shift >= 0) {
12305
+ wrapper.setAttribute("height", "+" + shift + "em");
12306
+ } else {
12307
+ wrapper.setAttribute("height", shift + "em");
12308
+ wrapper.setAttribute("depth", "+" + -shift + "em");
12309
+ }
12310
+
12311
+ wrapper.setAttribute("voffset", shift + "em");
12312
+ return wrapper;
12098
12313
  }
12099
12314
  });
12100
12315
  // CONCATENATED MODULE: ./src/functions/smash.js
@@ -12155,7 +12370,7 @@ defineFunction({
12155
12370
  };
12156
12371
  },
12157
12372
  htmlBuilder: function htmlBuilder(group, options) {
12158
- var node = buildCommon.makeSpan(["mord"], [buildHTML_buildGroup(group.body, options)]);
12373
+ var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]);
12159
12374
 
12160
12375
  if (!group.smashHeight && !group.smashDepth) {
12161
12376
  return node;
@@ -12185,13 +12400,15 @@ defineFunction({
12185
12400
  // from acting on that line height. So we'll call makeVList now.
12186
12401
 
12187
12402
 
12188
- return buildCommon.makeVList({
12403
+ var smashedNode = buildCommon.makeVList({
12189
12404
  positionType: "firstBaseline",
12190
12405
  children: [{
12191
12406
  type: "elem",
12192
12407
  elem: node
12193
12408
  }]
12194
- }, options);
12409
+ }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
12410
+
12411
+ return buildCommon.makeSpan(["mord"], [smashedNode], options);
12195
12412
  },
12196
12413
  mathmlBuilder: function mathmlBuilder(group, options) {
12197
12414
  var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
@@ -12348,7 +12565,6 @@ defineFunction({
12348
12565
  funcName = _ref.funcName,
12349
12566
  parser = _ref.parser;
12350
12567
  // parse out the implicit body
12351
- parser.consumeSpaces();
12352
12568
  var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
12353
12569
  // here and in buildHTML and de-dupe the enumeration of all the styles).
12354
12570
  // $FlowFixMe: The names above exactly match the styles.
@@ -12596,6 +12812,10 @@ defineFunctionBuilders({
12596
12812
  }
12597
12813
  }
12598
12814
 
12815
+ if (group.base && group.base.type === "op") {
12816
+ group.base.parentIsSupSub = true;
12817
+ }
12818
+
12599
12819
  var children = [buildMathML_buildGroup(group.base, options)];
12600
12820
 
12601
12821
  if (group.sub) {
@@ -12613,7 +12833,7 @@ defineFunctionBuilders({
12613
12833
  } else if (!group.sub) {
12614
12834
  var base = group.base;
12615
12835
 
12616
- if (base && base.type === "op" && base.limits && options.style === src_Style.DISPLAY) {
12836
+ if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) {
12617
12837
  nodeType = "mover";
12618
12838
  } else {
12619
12839
  nodeType = "msup";
@@ -12621,7 +12841,7 @@ defineFunctionBuilders({
12621
12841
  } else if (!group.sup) {
12622
12842
  var _base = group.base;
12623
12843
 
12624
- if (_base && _base.type === "op" && _base.limits && options.style === src_Style.DISPLAY) {
12844
+ if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) {
12625
12845
  nodeType = "munder";
12626
12846
  } else {
12627
12847
  nodeType = "msub";
@@ -12662,6 +12882,10 @@ defineFunctionBuilders({
12662
12882
  }
12663
12883
  } else if (group.family === "punct") {
12664
12884
  node.setAttribute("separator", "true");
12885
+ } else if (group.family === "open" || group.family === "close") {
12886
+ // Delims built here should not stretch vertically.
12887
+ // See delimsizing.js for stretchy delims.
12888
+ node.setAttribute("stretchy", "false");
12665
12889
  }
12666
12890
 
12667
12891
  return node;
@@ -12792,12 +13016,25 @@ defineFunctionBuilders({
12792
13016
 
12793
13017
 
12794
13018
 
13019
+
13020
+ var tag_pad = function pad() {
13021
+ var padNode = new mathMLTree.MathNode("mtd", []);
13022
+ padNode.setAttribute("width", "50%");
13023
+ return padNode;
13024
+ };
13025
+
12795
13026
  defineFunctionBuilders({
12796
13027
  type: "tag",
12797
13028
  mathmlBuilder: function mathmlBuilder(group, options) {
12798
- var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mlabeledtr", [new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)]), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)])])]);
12799
- table.setAttribute("side", "right");
12800
- return table;
13029
+ var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
13030
+ table.setAttribute("width", "100%");
13031
+ return table; // TODO: Left-aligned tags.
13032
+ // Currently, the group and options passed here do not contain
13033
+ // enough info to set tag alignment. `leqno` is in Settings but it is
13034
+ // not passed to Options. On the HTML side, leqno is
13035
+ // set by a CSS class applied in buildTree.js. That would have worked
13036
+ // in MathML if browsers supported <mlabeledtr>. Since they don't, we
13037
+ // need to rewrite the way this function is called.
12801
13038
  }
12802
13039
  });
12803
13040
  // CONCATENATED MODULE: ./src/functions/text.js
@@ -12814,10 +13051,12 @@ var textFontFamilies = {
12814
13051
  "\\textnormal": "textrm"
12815
13052
  };
12816
13053
  var textFontWeights = {
12817
- "\\textbf": "textbf"
13054
+ "\\textbf": "textbf",
13055
+ "\\textmd": "textmd"
12818
13056
  };
12819
13057
  var textFontShapes = {
12820
- "\\textit": "textit"
13058
+ "\\textit": "textit",
13059
+ "\\textup": "textup"
12821
13060
  };
12822
13061
 
12823
13062
  var optionsWithFont = function optionsWithFont(group, options) {
@@ -12838,8 +13077,8 @@ defineFunction({
12838
13077
  type: "text",
12839
13078
  names: [// Font families
12840
13079
  "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
12841
- "\\textbf", // Font Shapes
12842
- "\\textit"],
13080
+ "\\textbf", "\\textmd", // Font Shapes
13081
+ "\\textit", "\\textup"],
12843
13082
  props: {
12844
13083
  numArgs: 1,
12845
13084
  argTypes: ["text"],
@@ -12997,6 +13236,8 @@ var functions = _functions;
12997
13236
 
12998
13237
 
12999
13238
 
13239
+ // Disabled until https://github.com/KaTeX/KaTeX/pull/1794 is merged.
13240
+ // import "./functions/includegraphics";
13000
13241
 
13001
13242
 
13002
13243
 
@@ -13070,28 +13311,37 @@ combiningDiacriticalMarkString + "*") + // ...plus accents
13070
13311
  "|\\\\verb([^*a-zA-Z]).*?\\4" + ( // \verb unstarred
13071
13312
  "|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces
13072
13313
  "|" + controlSymbolRegexString + ")"); // \\, \', etc.
13073
- // These regexs are for matching results from tokenRegex,
13074
- // so they do have ^ markers.
13075
13314
 
13076
- var controlWordRegex = new RegExp("^" + controlWordRegexString);
13077
13315
  /** Main Lexer class */
13078
13316
 
13079
13317
  var Lexer_Lexer =
13080
13318
  /*#__PURE__*/
13081
13319
  function () {
13082
- function Lexer(input) {
13320
+ // category codes, only supports comment characters (14) for now
13321
+ function Lexer(input, settings) {
13083
13322
  this.input = void 0;
13323
+ this.settings = void 0;
13084
13324
  this.tokenRegex = void 0;
13325
+ this.catcodes = void 0;
13085
13326
  // Separate accents from characters
13086
13327
  this.input = input;
13328
+ this.settings = settings;
13087
13329
  this.tokenRegex = new RegExp(tokenRegexString, 'g');
13330
+ this.catcodes = {
13331
+ "%": 14 // comment character
13332
+
13333
+ };
13334
+ }
13335
+
13336
+ var _proto = Lexer.prototype;
13337
+
13338
+ _proto.setCatcode = function setCatcode(char, code) {
13339
+ this.catcodes[char] = code;
13088
13340
  }
13089
13341
  /**
13090
13342
  * This function lexes a single token.
13091
13343
  */
13092
-
13093
-
13094
- var _proto = Lexer.prototype;
13344
+ ;
13095
13345
 
13096
13346
  _proto.lex = function lex() {
13097
13347
  var input = this.input;
@@ -13107,7 +13357,23 @@ function () {
13107
13357
  throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1)));
13108
13358
  }
13109
13359
 
13110
- var text = match[2] || " "; // Trim any trailing whitespace from control word match
13360
+ var text = match[2] || " ";
13361
+
13362
+ if (this.catcodes[text] === 14) {
13363
+ // comment character
13364
+ var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex);
13365
+
13366
+ if (nlIndex === -1) {
13367
+ this.tokenRegex.lastIndex = input.length; // EOF
13368
+
13369
+ this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)");
13370
+ } else {
13371
+ this.tokenRegex.lastIndex = nlIndex + 1;
13372
+ }
13373
+
13374
+ return this.lex();
13375
+ } // Trim any trailing whitespace from control word match
13376
+
13111
13377
 
13112
13378
  var controlMatch = text.match(controlWordWhitespaceRegex);
13113
13379
 
@@ -13166,11 +13432,11 @@ function () {
13166
13432
 
13167
13433
  _proto.beginGroup = function beginGroup() {
13168
13434
  this.undefStack.push({});
13169
- };
13435
+ }
13170
13436
  /**
13171
13437
  * End current nested group, restoring values before the group began.
13172
13438
  */
13173
-
13439
+ ;
13174
13440
 
13175
13441
  _proto.endGroup = function endGroup() {
13176
13442
  if (this.undefStack.length === 0) {
@@ -13188,16 +13454,16 @@ function () {
13188
13454
  }
13189
13455
  }
13190
13456
  }
13191
- };
13457
+ }
13192
13458
  /**
13193
13459
  * Detect whether `name` has a definition. Equivalent to
13194
13460
  * `get(name) != null`.
13195
13461
  */
13196
-
13462
+ ;
13197
13463
 
13198
13464
  _proto.has = function has(name) {
13199
13465
  return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
13200
- };
13466
+ }
13201
13467
  /**
13202
13468
  * Get the current value of a name, or `undefined` if there is no value.
13203
13469
  *
@@ -13206,7 +13472,7 @@ function () {
13206
13472
  * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or
13207
13473
  * `if (namespace.has(...))`.
13208
13474
  */
13209
-
13475
+ ;
13210
13476
 
13211
13477
  _proto.get = function get(name) {
13212
13478
  if (this.current.hasOwnProperty(name)) {
@@ -13214,14 +13480,14 @@ function () {
13214
13480
  } else {
13215
13481
  return this.builtins[name];
13216
13482
  }
13217
- };
13483
+ }
13218
13484
  /**
13219
13485
  * Set the current value of a name, and optionally set it globally too.
13220
13486
  * Local set() sets the current value and (when appropriate) adds an undo
13221
13487
  * operation to the undo stack. Global set() may change the undo
13222
13488
  * operation at every level, so takes time linear in their number.
13223
13489
  */
13224
-
13490
+ ;
13225
13491
 
13226
13492
  _proto.set = function set(name, value, global) {
13227
13493
  if (global === void 0) {
@@ -13544,9 +13810,7 @@ defineMacro("\\providecommand", function (context) {
13544
13810
  // \let\bgroup={ \let\egroup=}
13545
13811
 
13546
13812
  defineMacro("\\bgroup", "{");
13547
- defineMacro("\\egroup", "}");
13548
- defineMacro("\\begingroup", "{");
13549
- defineMacro("\\endgroup", "}"); // Symbols from latex.ltx:
13813
+ defineMacro("\\egroup", "}"); // Symbols from latex.ltx:
13550
13814
  // \def\lq{`}
13551
13815
  // \def\rq{'}
13552
13816
  // \def \aa {\r a}
@@ -13564,17 +13828,7 @@ defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use r
13564
13828
 
13565
13829
  defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
13566
13830
  defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
13567
- defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Unicode double-struck letters
13568
-
13569
- defineMacro("\u2102", "\\mathbb{C}");
13570
- defineMacro("\u210D", "\\mathbb{H}");
13571
- defineMacro("\u2115", "\\mathbb{N}");
13572
- defineMacro("\u2119", "\\mathbb{P}");
13573
- defineMacro("\u211A", "\\mathbb{Q}");
13574
- defineMacro("\u211D", "\\mathbb{R}");
13575
- defineMacro("\u2124", "\\mathbb{Z}");
13576
- defineMacro("\u210E", "\\mathit{h}"); // Planck constant
13577
- // Characters omitted from Unicode range 1D400–1D7FF
13831
+ defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF
13578
13832
 
13579
13833
  defineMacro("\u212C", "\\mathscr{B}"); // script
13580
13834
 
@@ -13588,7 +13842,9 @@ defineMacro("\u211B", "\\mathscr{R}");
13588
13842
  defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
13589
13843
 
13590
13844
  defineMacro("\u210C", "\\mathfrak{H}");
13591
- defineMacro("\u2128", "\\mathfrak{Z}"); // Unicode middle dot
13845
+ defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML.
13846
+
13847
+ defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot
13592
13848
  // The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
13593
13849
  // the dot at U+22C5 and gives it punct spacing.
13594
13850
 
@@ -13600,8 +13856,9 @@ defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fo
13600
13856
  // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
13601
13857
  // It's thus treated like a \mathrel, but defined by a symbol that has zero
13602
13858
  // width but extends to the right. We use \rlap to get that spacing.
13859
+ // For MathML we write U+0338 here. buildMathML.js will then do the overlay.
13603
13860
 
13604
- defineMacro("\\not", '\\mathrel{\\mathrlap\\@not}'); // Negated symbols from base/fontmath.ltx:
13861
+ defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx:
13605
13862
  // \def\neq{\not=} \let\ne=\neq
13606
13863
  // \DeclareRobustCommand
13607
13864
  // \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
@@ -13917,31 +14174,37 @@ defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinary
13917
14174
 
13918
14175
  defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
13919
14176
 
13920
- defineMacro("\\dblcolon", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
14177
+ defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
14178
+
14179
+ defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔
14180
+ // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
13921
14181
 
13922
- defineMacro("\\coloneqq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
14182
+ defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
13923
14183
 
13924
- defineMacro("\\Coloneqq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
14184
+ defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
13925
14185
 
13926
- defineMacro("\\coloneq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
14186
+ defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
13927
14187
 
13928
- defineMacro("\\Coloneq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
14188
+ defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕
14189
+ // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
13929
14190
 
13930
- defineMacro("\\eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
14191
+ defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
13931
14192
 
13932
- defineMacro("\\Eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
14193
+ defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
13933
14194
 
13934
- defineMacro("\\eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
14195
+ defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
13935
14196
 
13936
- defineMacro("\\Eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
14197
+ defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
13937
14198
 
13938
- defineMacro("\\colonapprox", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
14199
+ defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
13939
14200
 
13940
- defineMacro("\\Colonapprox", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
14201
+ defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
13941
14202
 
13942
- defineMacro("\\colonsim", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
14203
+ defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions.
13943
14204
 
13944
- defineMacro("\\Colonsim", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // Some Unicode characters are implemented with macros to mathtools functions.
14205
+ defineMacro("\u2237", "\\dblcolon"); // ::
14206
+
14207
+ defineMacro("\u2239", "\\eqcolon"); // -:
13945
14208
 
13946
14209
  defineMacro("\u2254", "\\coloneqq"); // :=
13947
14210
 
@@ -13975,13 +14238,37 @@ defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\d
13975
14238
  defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
13976
14239
  defineMacro("\\limsup", "\\DOTSB\\mathop{\\operatorname{lim\\,sup}}\\limits");
13977
14240
  defineMacro("\\liminf", "\\DOTSB\\mathop{\\operatorname{lim\\,inf}}\\limits"); //////////////////////////////////////////////////////////////////////
13978
- // semantic
13979
- // The semantic package renders the next two items by calling a glyph from the
13980
- // bbold package. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
13981
-
13982
- defineMacro("\u27E6", "\\mathopen{[\\mkern-3.2mu[}"); // blackboard bold [
13983
-
13984
- defineMacro("\u27E7", "\\mathclose{]\\mkern-3.2mu]}"); // blackboard bold ]
14241
+ // MathML alternates for KaTeX glyphs in the Unicode private area
14242
+
14243
+ defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
14244
+ defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
14245
+ defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
14246
+ defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
14247
+ defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
14248
+ defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
14249
+ defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
14250
+ defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
14251
+ defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
14252
+ defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
14253
+ defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
14254
+ defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
14255
+ defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
14256
+ defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); //////////////////////////////////////////////////////////////////////
14257
+ // stmaryrd and semantic
14258
+ // The stmaryrd and semantic packages render the next four items by calling a
14259
+ // glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
14260
+
14261
+ defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}");
14262
+ defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}");
14263
+ defineMacro("\u27E6", "\\llbracket"); // blackboard bold [
14264
+
14265
+ defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ]
14266
+
14267
+ defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
14268
+ defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
14269
+ defineMacro("\u2983", "\\lBrace"); // blackboard bold {
14270
+
14271
+ defineMacro("\u2984", "\\rBrace"); // blackboard bold }
13985
14272
  // TODO: Create variable sized versions of the last two items. I believe that
13986
14273
  // will require new font glyphs.
13987
14274
  //////////////////////////////////////////////////////////////////////
@@ -14043,7 +14330,7 @@ defineMacro("\\Rarr", "\\Rightarrow");
14043
14330
  defineMacro("\\real", "\\Re");
14044
14331
  defineMacro("\\reals", "\\mathbb{R}");
14045
14332
  defineMacro("\\Reals", "\\mathbb{R}");
14046
- defineMacro("\\Rho", "\\mathrm{R}");
14333
+ defineMacro("\\Rho", "\\mathrm{P}");
14047
14334
  defineMacro("\\sdot", "\\cdot");
14048
14335
  defineMacro("\\sect", "\\S");
14049
14336
  defineMacro("\\spades", "\\spadesuit");
@@ -14054,7 +14341,69 @@ defineMacro("\\Tau", "\\mathrm{T}");
14054
14341
  defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}");
14055
14342
 
14056
14343
  defineMacro("\\weierp", "\\wp");
14057
- defineMacro("\\Zeta", "\\mathrm{Z}");
14344
+ defineMacro("\\Zeta", "\\mathrm{Z}"); //////////////////////////////////////////////////////////////////////
14345
+ // statmath.sty
14346
+ // https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
14347
+
14348
+ defineMacro("\\argmin", "\\DOTSB\\mathop{\\operatorname{arg\\,min}}\\limits");
14349
+ defineMacro("\\argmax", "\\DOTSB\\mathop{\\operatorname{arg\\,max}}\\limits"); // Custom Khan Academy colors, should be moved to an optional package
14350
+
14351
+ defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
14352
+ defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
14353
+ defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
14354
+ defineMacro("\\red", "\\textcolor{##df0030}{#1}");
14355
+ defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
14356
+ defineMacro("\\gray", "\\textcolor{gray}{##1}");
14357
+ defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
14358
+ defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
14359
+ defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
14360
+ defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
14361
+ defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
14362
+ defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
14363
+ defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
14364
+ defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
14365
+ defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
14366
+ defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
14367
+ defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
14368
+ defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
14369
+ defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
14370
+ defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
14371
+ defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
14372
+ defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
14373
+ defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
14374
+ defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
14375
+ defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
14376
+ defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
14377
+ defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
14378
+ defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
14379
+ defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
14380
+ defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
14381
+ defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
14382
+ defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
14383
+ defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
14384
+ defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
14385
+ defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
14386
+ defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
14387
+ defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
14388
+ defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
14389
+ defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
14390
+ defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
14391
+ defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
14392
+ defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
14393
+ defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
14394
+ defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
14395
+ defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
14396
+ defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
14397
+ defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
14398
+ defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
14399
+ defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
14400
+ defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
14401
+ defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
14402
+ defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
14403
+ defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
14404
+ defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
14405
+ defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
14406
+ defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
14058
14407
  // CONCATENATED MODULE: ./src/MacroExpander.js
14059
14408
  /**
14060
14409
  * This file contains the “gullet” where macros are expanded
@@ -14109,37 +14458,37 @@ function () {
14109
14458
  var _proto = MacroExpander.prototype;
14110
14459
 
14111
14460
  _proto.feed = function feed(input) {
14112
- this.lexer = new Lexer_Lexer(input);
14113
- };
14461
+ this.lexer = new Lexer_Lexer(input, this.settings);
14462
+ }
14114
14463
  /**
14115
14464
  * Switches between "text" and "math" modes.
14116
14465
  */
14117
-
14466
+ ;
14118
14467
 
14119
14468
  _proto.switchMode = function switchMode(newMode) {
14120
14469
  this.mode = newMode;
14121
- };
14470
+ }
14122
14471
  /**
14123
14472
  * Start a new group nesting within all namespaces.
14124
14473
  */
14125
-
14474
+ ;
14126
14475
 
14127
14476
  _proto.beginGroup = function beginGroup() {
14128
14477
  this.macros.beginGroup();
14129
- };
14478
+ }
14130
14479
  /**
14131
14480
  * End current group nesting within all namespaces.
14132
14481
  */
14133
-
14482
+ ;
14134
14483
 
14135
14484
  _proto.endGroup = function endGroup() {
14136
14485
  this.macros.endGroup();
14137
- };
14486
+ }
14138
14487
  /**
14139
14488
  * Returns the topmost token on the stack, without expanding it.
14140
14489
  * Similar in behavior to TeX's `\futurelet`.
14141
14490
  */
14142
-
14491
+ ;
14143
14492
 
14144
14493
  _proto.future = function future() {
14145
14494
  if (this.stack.length === 0) {
@@ -14147,40 +14496,40 @@ function () {
14147
14496
  }
14148
14497
 
14149
14498
  return this.stack[this.stack.length - 1];
14150
- };
14499
+ }
14151
14500
  /**
14152
14501
  * Remove and return the next unexpanded token.
14153
14502
  */
14154
-
14503
+ ;
14155
14504
 
14156
14505
  _proto.popToken = function popToken() {
14157
14506
  this.future(); // ensure non-empty stack
14158
14507
 
14159
14508
  return this.stack.pop();
14160
- };
14509
+ }
14161
14510
  /**
14162
14511
  * Add a given token to the token stack. In particular, this get be used
14163
14512
  * to put back a token returned from one of the other methods.
14164
14513
  */
14165
-
14514
+ ;
14166
14515
 
14167
14516
  _proto.pushToken = function pushToken(token) {
14168
14517
  this.stack.push(token);
14169
- };
14518
+ }
14170
14519
  /**
14171
14520
  * Append an array of tokens to the token stack.
14172
14521
  */
14173
-
14522
+ ;
14174
14523
 
14175
14524
  _proto.pushTokens = function pushTokens(tokens) {
14176
14525
  var _this$stack;
14177
14526
 
14178
14527
  (_this$stack = this.stack).push.apply(_this$stack, tokens);
14179
- };
14528
+ }
14180
14529
  /**
14181
14530
  * Consume all following space tokens, without expansion.
14182
14531
  */
14183
-
14532
+ ;
14184
14533
 
14185
14534
  _proto.consumeSpaces = function consumeSpaces() {
14186
14535
  for (;;) {
@@ -14192,12 +14541,12 @@ function () {
14192
14541
  break;
14193
14542
  }
14194
14543
  }
14195
- };
14544
+ }
14196
14545
  /**
14197
14546
  * Consume the specified number of arguments from the token stream,
14198
14547
  * and return the resulting array of arguments.
14199
14548
  */
14200
-
14549
+ ;
14201
14550
 
14202
14551
  _proto.consumeArgs = function consumeArgs(numArgs) {
14203
14552
  var args = []; // obtain arguments, either single token or balanced {…} group
@@ -14237,7 +14586,7 @@ function () {
14237
14586
  }
14238
14587
 
14239
14588
  return args;
14240
- };
14589
+ }
14241
14590
  /**
14242
14591
  * Expand the next token only once if possible.
14243
14592
  *
@@ -14258,7 +14607,7 @@ function () {
14258
14607
  * i.e. things like those defined by \def\foo#1\end{…}.
14259
14608
  * See the TeX book page 202ff. for details on how those should behave.
14260
14609
  */
14261
-
14610
+ ;
14262
14611
 
14263
14612
  _proto.expandOnce = function expandOnce() {
14264
14613
  var topToken = this.popToken();
@@ -14314,23 +14663,23 @@ function () {
14314
14663
 
14315
14664
  this.pushTokens(tokens);
14316
14665
  return tokens;
14317
- };
14666
+ }
14318
14667
  /**
14319
14668
  * Expand the next token only once (if possible), and return the resulting
14320
14669
  * top token on the stack (without removing anything from the stack).
14321
14670
  * Similar in behavior to TeX's `\expandafter\futurelet`.
14322
14671
  * Equivalent to expandOnce() followed by future().
14323
14672
  */
14324
-
14673
+ ;
14325
14674
 
14326
14675
  _proto.expandAfterFuture = function expandAfterFuture() {
14327
14676
  this.expandOnce();
14328
14677
  return this.future();
14329
- };
14678
+ }
14330
14679
  /**
14331
14680
  * Recursively expand first token, then return first non-expandable token.
14332
14681
  */
14333
-
14682
+ ;
14334
14683
 
14335
14684
  _proto.expandNextToken = function expandNextToken() {
14336
14685
  for (;;) {
@@ -14350,12 +14699,12 @@ function () {
14350
14699
 
14351
14700
 
14352
14701
  throw new Error(); // eslint-disable-line no-unreachable
14353
- };
14702
+ }
14354
14703
  /**
14355
14704
  * Fully expand the given macro name and return the resulting list of
14356
14705
  * tokens, or return `undefined` if no such macro is defined.
14357
14706
  */
14358
-
14707
+ ;
14359
14708
 
14360
14709
  _proto.expandMacro = function expandMacro(name) {
14361
14710
  if (!this.macros.get(name)) {
@@ -14375,12 +14724,12 @@ function () {
14375
14724
  }
14376
14725
 
14377
14726
  return output;
14378
- };
14727
+ }
14379
14728
  /**
14380
14729
  * Fully expand the given macro name and return the result as a string,
14381
14730
  * or return `undefined` if no such macro is defined.
14382
14731
  */
14383
-
14732
+ ;
14384
14733
 
14385
14734
  _proto.expandMacroAsText = function expandMacroAsText(name) {
14386
14735
  var tokens = this.expandMacro(name);
@@ -14392,12 +14741,12 @@ function () {
14392
14741
  } else {
14393
14742
  return tokens;
14394
14743
  }
14395
- };
14744
+ }
14396
14745
  /**
14397
14746
  * Returns the expanded macro as a reversed array of tokens and a macro
14398
14747
  * argument count. Or returns `null` if no such macro.
14399
14748
  */
14400
-
14749
+ ;
14401
14750
 
14402
14751
  _proto._getExpansion = function _getExpansion(name) {
14403
14752
  var definition = this.macros.get(name);
@@ -14420,7 +14769,7 @@ function () {
14420
14769
  }
14421
14770
  }
14422
14771
 
14423
- var bodyLexer = new Lexer_Lexer(expansion);
14772
+ var bodyLexer = new Lexer_Lexer(expansion, this.settings);
14424
14773
  var tokens = [];
14425
14774
  var tok = bodyLexer.lex();
14426
14775
 
@@ -14439,14 +14788,14 @@ function () {
14439
14788
  }
14440
14789
 
14441
14790
  return expansion;
14442
- };
14791
+ }
14443
14792
  /**
14444
14793
  * Determine whether a command is currently "defined" (has some
14445
14794
  * functionality), meaning that it's a macro (in the current group),
14446
14795
  * a function, a symbol, or one of the special commands listed in
14447
14796
  * `implicitCommands`.
14448
14797
  */
14449
-
14798
+ ;
14450
14799
 
14451
14800
  _proto.isDefined = function isDefined(name) {
14452
14801
  return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
@@ -15229,29 +15578,29 @@ function () {
15229
15578
  if (consume) {
15230
15579
  this.consume();
15231
15580
  }
15232
- };
15581
+ }
15233
15582
  /**
15234
15583
  * Considers the current look ahead token as consumed,
15235
15584
  * and fetches the one after that as the new look ahead.
15236
15585
  */
15237
-
15586
+ ;
15238
15587
 
15239
15588
  _proto.consume = function consume() {
15240
15589
  this.nextToken = this.gullet.expandNextToken();
15241
- };
15590
+ }
15242
15591
  /**
15243
15592
  * Switches between "text" and "math" modes.
15244
15593
  */
15245
-
15594
+ ;
15246
15595
 
15247
15596
  _proto.switchMode = function switchMode(newMode) {
15248
15597
  this.mode = newMode;
15249
15598
  this.gullet.switchMode(newMode);
15250
- };
15599
+ }
15251
15600
  /**
15252
15601
  * Main parsing function, which parses an entire input.
15253
15602
  */
15254
-
15603
+ ;
15255
15604
 
15256
15605
  _proto.parse = function parse() {
15257
15606
  // Create a group namespace for the math expression.
@@ -15274,17 +15623,6 @@ function () {
15274
15623
  return parse;
15275
15624
  };
15276
15625
 
15277
- /**
15278
- * Parses an "expression", which is a list of atoms.
15279
- *
15280
- * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
15281
- * happens when functions have higher precendence han infix
15282
- * nodes in implicit parses.
15283
- *
15284
- * `breakOnTokenText`: The text of the token that the expression should end
15285
- * with, or `null` if something else should end the
15286
- * expression.
15287
- */
15288
15626
  _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) {
15289
15627
  var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either
15290
15628
  // we reached the end, a }, or a \right)
@@ -15323,7 +15661,7 @@ function () {
15323
15661
  }
15324
15662
 
15325
15663
  return this.handleInfixNodes(body);
15326
- };
15664
+ }
15327
15665
  /**
15328
15666
  * Rewrites infix operators such as \over with corresponding commands such
15329
15667
  * as \frac.
@@ -15331,7 +15669,7 @@ function () {
15331
15669
  * There can only be one infix operator per group. If there's more than one
15332
15670
  * then the expression is ambiguous. This can be resolved by adding {}.
15333
15671
  */
15334
-
15672
+ ;
15335
15673
 
15336
15674
  _proto.handleInfixNodes = function handleInfixNodes(body) {
15337
15675
  var overIndex = -1;
@@ -15388,8 +15726,8 @@ function () {
15388
15726
  } else {
15389
15727
  return body;
15390
15728
  }
15391
- }; // The greediness of a superscript or subscript
15392
-
15729
+ } // The greediness of a superscript or subscript
15730
+ ;
15393
15731
 
15394
15732
  /**
15395
15733
  * Handle a subscript or superscript with nice errors.
@@ -15407,12 +15745,12 @@ function () {
15407
15745
  }
15408
15746
 
15409
15747
  return group;
15410
- };
15748
+ }
15411
15749
  /**
15412
15750
  * Converts the textual input of an unsupported command into a text node
15413
15751
  * contained within a color node whose color is determined by errorColor
15414
15752
  */
15415
-
15753
+ ;
15416
15754
 
15417
15755
  _proto.handleUnsupportedCmd = function handleUnsupportedCmd() {
15418
15756
  var text = this.nextToken.text;
@@ -15439,11 +15777,11 @@ function () {
15439
15777
  };
15440
15778
  this.consume();
15441
15779
  return colorNode;
15442
- };
15780
+ }
15443
15781
  /**
15444
15782
  * Parses a group with optional super/subscripts.
15445
15783
  */
15446
-
15784
+ ;
15447
15785
 
15448
15786
  _proto.parseAtom = function parseAtom(breakOnTokenText) {
15449
15787
  // The body of an atom is an implicit group, so that things like
@@ -15524,8 +15862,6 @@ function () {
15524
15862
  mode: this.mode,
15525
15863
  body: primes
15526
15864
  };
15527
- } else if (lex.text === "%") {
15528
- this.consumeComment();
15529
15865
  } else {
15530
15866
  // If it wasn't ^, _, or ', stop parsing super/subscripts
15531
15867
  break;
@@ -15547,11 +15883,11 @@ function () {
15547
15883
  // Otherwise return the original body
15548
15884
  return base;
15549
15885
  }
15550
- };
15886
+ }
15551
15887
  /**
15552
15888
  * Parses an entire function, including its base and all of its arguments.
15553
15889
  */
15554
-
15890
+ ;
15555
15891
 
15556
15892
  _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting.
15557
15893
  greediness) {
@@ -15569,6 +15905,11 @@ function () {
15569
15905
  throw new src_ParseError("Can't use function '" + func + "' in text mode", token);
15570
15906
  } else if (this.mode === "math" && funcData.allowedInMath === false) {
15571
15907
  throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
15908
+ } // hyperref package sets the catcode of % as an active character
15909
+
15910
+
15911
+ if (funcData.argTypes && funcData.argTypes[0] === "url") {
15912
+ this.gullet.lexer.setCatcode("%", 13);
15572
15913
  } // Consume the command token after possibly switching to the
15573
15914
  // mode specified by the function (for instant mode switching),
15574
15915
  // and then immediately switch back.
@@ -15588,11 +15929,11 @@ function () {
15588
15929
  optArgs = _this$parseArguments.optArgs;
15589
15930
 
15590
15931
  return this.callFunction(func, args, optArgs, token, breakOnTokenText);
15591
- };
15932
+ }
15592
15933
  /**
15593
15934
  * Call a function handler with a suitable context and arguments.
15594
15935
  */
15595
-
15936
+ ;
15596
15937
 
15597
15938
  _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) {
15598
15939
  var context = {
@@ -15608,11 +15949,11 @@ function () {
15608
15949
  } else {
15609
15950
  throw new src_ParseError("No function handler for " + name);
15610
15951
  }
15611
- };
15952
+ }
15612
15953
  /**
15613
15954
  * Parses the arguments of a function or environment
15614
15955
  */
15615
-
15956
+ ;
15616
15957
 
15617
15958
  _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}".
15618
15959
  funcData) {
@@ -15669,11 +16010,11 @@ function () {
15669
16010
  args: args,
15670
16011
  optArgs: optArgs
15671
16012
  };
15672
- };
16013
+ }
15673
16014
  /**
15674
16015
  * Parses a group when the mode is changing.
15675
16016
  */
15676
-
16017
+ ;
15677
16018
 
15678
16019
  _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness) {
15679
16020
  switch (type) {
@@ -15690,6 +16031,25 @@ function () {
15690
16031
  case "text":
15691
16032
  return this.parseGroup(name, optional, greediness, undefined, type);
15692
16033
 
16034
+ case "raw":
16035
+ {
16036
+ if (optional && this.nextToken.text === "{") {
16037
+ return null;
16038
+ }
16039
+
16040
+ var token = this.parseStringGroup("raw", optional, true);
16041
+
16042
+ if (token) {
16043
+ return {
16044
+ type: "raw",
16045
+ mode: "text",
16046
+ string: token.text
16047
+ };
16048
+ } else {
16049
+ throw new src_ParseError("Expected raw group", this.nextToken);
16050
+ }
16051
+ }
16052
+
15693
16053
  case "original":
15694
16054
  case null:
15695
16055
  case undefined:
@@ -15704,34 +16064,12 @@ function () {
15704
16064
  while (this.nextToken.text === " ") {
15705
16065
  this.consume();
15706
16066
  }
15707
- };
15708
-
15709
- _proto.consumeComment = function consumeComment() {
15710
- // the newline character is normalized in Lexer, check original source
15711
- while (this.nextToken.text !== "EOF" && this.nextToken.loc && this.nextToken.loc.getSource().indexOf("\n") === -1) {
15712
- this.consume();
15713
- }
15714
-
15715
- if (this.nextToken.text === "EOF") {
15716
- this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)");
15717
- }
15718
-
15719
- if (this.mode === "math") {
15720
- this.consumeSpaces(); // ignore spaces in math mode
15721
- } else if (this.nextToken.loc) {
15722
- // text mode
15723
- var source = this.nextToken.loc.getSource();
15724
-
15725
- if (source.indexOf("\n") === source.length - 1) {
15726
- this.consumeSpaces(); // if no space after the first newline
15727
- }
15728
- }
15729
- };
16067
+ }
15730
16068
  /**
15731
16069
  * Parses a group, essentially returning the string formed by the
15732
16070
  * brace-enclosed tokens plus some position information.
15733
16071
  */
15734
-
16072
+ ;
15735
16073
 
15736
16074
  _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages.
15737
16075
  optional, raw) {
@@ -15744,6 +16082,8 @@ function () {
15744
16082
  return null;
15745
16083
  } else if (raw && nextToken.text !== "EOF" && /[^{}[\]]/.test(nextToken.text)) {
15746
16084
  // allow a single character in raw string group
16085
+ this.gullet.lexer.setCatcode("%", 14); // reset the catcode of %
16086
+
15747
16087
  this.consume();
15748
16088
  return nextToken;
15749
16089
  }
@@ -15763,15 +16103,6 @@ function () {
15763
16103
  case "EOF":
15764
16104
  throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str));
15765
16105
 
15766
- case "%":
15767
- if (!raw) {
15768
- // allow % in raw string group
15769
- this.consumeComment();
15770
- continue;
15771
- }
15772
-
15773
- break;
15774
-
15775
16106
  case groupBegin:
15776
16107
  nested++;
15777
16108
  break;
@@ -15787,15 +16118,17 @@ function () {
15787
16118
  }
15788
16119
 
15789
16120
  this.mode = outerMode;
16121
+ this.gullet.lexer.setCatcode("%", 14); // reset the catcode of %
16122
+
15790
16123
  this.expect(groupEnd);
15791
16124
  return firstToken.range(lastToken, str);
15792
- };
16125
+ }
15793
16126
  /**
15794
16127
  * Parses a regex-delimited group: the largest sequence of tokens
15795
16128
  * whose concatenated strings match `regex`. Returns the string
15796
16129
  * formed by the tokens plus some position information.
15797
16130
  */
15798
-
16131
+ ;
15799
16132
 
15800
16133
  _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) {
15801
16134
  var outerMode = this.mode;
@@ -15804,12 +16137,7 @@ function () {
15804
16137
  var lastToken = firstToken;
15805
16138
  var str = "";
15806
16139
 
15807
- while (this.nextToken.text !== "EOF" && (regex.test(str + this.nextToken.text) || this.nextToken.text === "%")) {
15808
- if (this.nextToken.text === "%") {
15809
- this.consumeComment();
15810
- continue;
15811
- }
15812
-
16140
+ while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) {
15813
16141
  lastToken = this.nextToken;
15814
16142
  str += lastToken.text;
15815
16143
  this.consume();
@@ -15821,11 +16149,11 @@ function () {
15821
16149
 
15822
16150
  this.mode = outerMode;
15823
16151
  return firstToken.range(lastToken, str);
15824
- };
16152
+ }
15825
16153
  /**
15826
16154
  * Parses a color description.
15827
16155
  */
15828
-
16156
+ ;
15829
16157
 
15830
16158
  _proto.parseColorGroup = function parseColorGroup(optional) {
15831
16159
  var res = this.parseStringGroup("color", optional);
@@ -15854,11 +16182,11 @@ function () {
15854
16182
  mode: this.mode,
15855
16183
  color: color
15856
16184
  };
15857
- };
16185
+ }
15858
16186
  /**
15859
16187
  * Parses a size specification, consisting of magnitude and unit.
15860
16188
  */
15861
-
16189
+ ;
15862
16190
 
15863
16191
  _proto.parseSizeGroup = function parseSizeGroup(optional) {
15864
16192
  var res;
@@ -15905,11 +16233,11 @@ function () {
15905
16233
  value: data,
15906
16234
  isBlank: isBlank
15907
16235
  };
15908
- };
16236
+ }
15909
16237
  /**
15910
16238
  * Parses an URL, checking escaped letters and allowed protocols.
15911
16239
  */
15912
-
16240
+ ;
15913
16241
 
15914
16242
  _proto.parseUrlGroup = function parseUrlGroup(optional) {
15915
16243
  var res = this.parseStringGroup("url", optional, true); // get raw string
@@ -15936,7 +16264,7 @@ function () {
15936
16264
  mode: this.mode,
15937
16265
  url: url
15938
16266
  };
15939
- };
16267
+ }
15940
16268
  /**
15941
16269
  * If `optional` is false or absent, this parses an ordinary group,
15942
16270
  * which is either a single nucleus (like "x") or an expression
@@ -15949,7 +16277,7 @@ function () {
15949
16277
  * If `mode` is present, switches to that mode while parsing the group,
15950
16278
  * and switches back after.
15951
16279
  */
15952
-
16280
+ ;
15953
16281
 
15954
16282
  _proto.parseGroup = function parseGroup(name, // For error reporting.
15955
16283
  optional, greediness, breakOnTokenText, mode) {
@@ -15961,29 +16289,29 @@ function () {
15961
16289
  this.switchMode(mode);
15962
16290
  }
15963
16291
 
15964
- var result; // Try to parse an open brace
16292
+ var groupEnd;
16293
+ var result; // Try to parse an open brace or \begingroup
16294
+
16295
+ if (optional ? text === "[" : text === "{" || text === "\\begingroup") {
16296
+ groupEnd = Parser.endOfGroup[text]; // Start a new group namespace
15965
16297
 
15966
- if (text === (optional ? "[" : "{")) {
15967
- // Start a new group namespace
15968
16298
  this.gullet.beginGroup(); // If we get a brace, parse an expression
15969
16299
 
15970
16300
  this.consume();
15971
- var expression = this.parseExpression(false, optional ? "]" : "}");
15972
- var lastToken = this.nextToken; // Switch mode back before consuming symbol after close brace
15973
-
15974
- if (mode) {
15975
- this.switchMode(outerMode);
15976
- } // End group namespace before consuming symbol after close brace
15977
-
16301
+ var expression = this.parseExpression(false, groupEnd);
16302
+ var lastToken = this.nextToken; // End group namespace before consuming symbol after close brace
15978
16303
 
15979
- this.gullet.endGroup(); // Make sure we get a close brace
15980
-
15981
- this.expect(optional ? "]" : "}");
15982
- return {
16304
+ this.gullet.endGroup();
16305
+ result = {
15983
16306
  type: "ordgroup",
15984
16307
  mode: this.mode,
15985
16308
  loc: SourceLocation.range(firstToken, lastToken),
15986
- body: expression
16309
+ body: expression,
16310
+ // A group formed by \begingroup...\endgroup is a semi-simple group
16311
+ // which doesn't affect spacing in math mode, i.e., is transparent.
16312
+ // https://tex.stackexchange.com/questions/1930/when-should-one-
16313
+ // use-begingroup-instead-of-bgroup
16314
+ semisimple: text === "\\begingroup" || undefined
15987
16315
  };
15988
16316
  } else if (optional) {
15989
16317
  // Return nothing for an optional group
@@ -16005,10 +16333,15 @@ function () {
16005
16333
 
16006
16334
  if (mode) {
16007
16335
  this.switchMode(outerMode);
16336
+ } // Make sure we got a close brace
16337
+
16338
+
16339
+ if (groupEnd) {
16340
+ this.expect(groupEnd);
16008
16341
  }
16009
16342
 
16010
16343
  return result;
16011
- };
16344
+ }
16012
16345
  /**
16013
16346
  * Form ligature-like combinations of characters for text mode.
16014
16347
  * This includes inputs like "--", "---", "``" and "''".
@@ -16017,7 +16350,7 @@ function () {
16017
16350
  * characters in its value. The representation is still ASCII source.
16018
16351
  * The group will be modified in place.
16019
16352
  */
16020
-
16353
+ ;
16021
16354
 
16022
16355
  _proto.formLigatures = function formLigatures(group) {
16023
16356
  var n = group.length - 1;
@@ -16057,12 +16390,12 @@ function () {
16057
16390
  n -= 1;
16058
16391
  }
16059
16392
  }
16060
- };
16393
+ }
16061
16394
  /**
16062
16395
  * Parse a single symbol out of the string. Here, we handle single character
16063
16396
  * symbols and special functions like verbatim
16064
16397
  */
16065
-
16398
+ ;
16066
16399
 
16067
16400
  _proto.parseSymbol = function parseSymbol() {
16068
16401
  var nucleus = this.nextToken;
@@ -16091,9 +16424,6 @@ function () {
16091
16424
  body: arg,
16092
16425
  star: star
16093
16426
  };
16094
- } else if (text === "%") {
16095
- this.consumeComment();
16096
- return this.parseSymbol();
16097
16427
  } // At this point, we should have a symbol, possibly with accents.
16098
16428
  // First expand any accented base symbol according to unicodeSymbols.
16099
16429
 
@@ -16207,7 +16537,24 @@ function () {
16207
16537
  return Parser;
16208
16538
  }();
16209
16539
 
16210
- Parser_Parser.endOfExpression = ["}", "\\end", "\\right", "&"];
16540
+ Parser_Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
16541
+ Parser_Parser.endOfGroup = {
16542
+ "[": "]",
16543
+ "{": "}",
16544
+ "\\begingroup": "\\endgroup"
16545
+ /**
16546
+ * Parses an "expression", which is a list of atoms.
16547
+ *
16548
+ * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
16549
+ * happens when functions have higher precendence han infix
16550
+ * nodes in implicit parses.
16551
+ *
16552
+ * `breakOnTokenText`: The text of the token that the expression should end
16553
+ * with, or `null` if something else should end the
16554
+ * expression.
16555
+ */
16556
+
16557
+ };
16211
16558
  Parser_Parser.SUPSUB_GREEDINESS = 1;
16212
16559
 
16213
16560
  // CONCATENATED MODULE: ./src/parseTree.js
@@ -16363,7 +16710,7 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) {
16363
16710
  /**
16364
16711
  * Current KaTeX version
16365
16712
  */
16366
- version: "0.10.0",
16713
+ version: "0.10.2",
16367
16714
 
16368
16715
  /**
16369
16716
  * Renders the given LaTeX into an HTML+MathML combination, and adds
@@ -16446,8 +16793,9 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) {
16446
16793
  });
16447
16794
  // CONCATENATED MODULE: ./katex.webpack.js
16448
16795
  /**
16449
- * This is the webpack entry point for KaTeX. As flow[1] and jest[2] doesn't support
16450
- * CSS modules natively, a separate entry point is used and it is not flowtyped.
16796
+ * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
16797
+ * doesn't support CSS modules natively, a separate entry point is used and
16798
+ * it is not flowtyped.
16451
16799
  *
16452
16800
  * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
16453
16801
  * [2] https://facebook.github.io/jest/docs/en/webpack.html