katex 0.15.2 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/katex.mjs CHANGED
@@ -4465,7 +4465,7 @@ defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
4465
4465
  defineSymbol(math, main, bin, "\u2217", "\\ast");
4466
4466
  defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
4467
4467
  defineSymbol(math, main, bin, "\u25ef", "\\bigcirc", true);
4468
- defineSymbol(math, main, bin, "\u2219", "\\bullet");
4468
+ defineSymbol(math, main, bin, "\u2219", "\\bullet", true);
4469
4469
  defineSymbol(math, main, bin, "\u2021", "\\ddagger");
4470
4470
  defineSymbol(math, main, bin, "\u2240", "\\wr", true);
4471
4471
  defineSymbol(math, main, bin, "\u2a3f", "\\amalg");
@@ -4824,13 +4824,13 @@ defineSymbol(math, main, bin, "\u2217", "*", true);
4824
4824
  defineSymbol(math, main, bin, "+", "+");
4825
4825
  defineSymbol(math, main, bin, "\u2212", "-", true);
4826
4826
  defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
4827
- defineSymbol(math, main, bin, "\u2218", "\\circ");
4827
+ defineSymbol(math, main, bin, "\u2218", "\\circ", true);
4828
4828
  defineSymbol(math, main, bin, "\u00f7", "\\div", true);
4829
4829
  defineSymbol(math, main, bin, "\u00b1", "\\pm", true);
4830
4830
  defineSymbol(math, main, bin, "\u00d7", "\\times", true);
4831
4831
  defineSymbol(math, main, bin, "\u2229", "\\cap", true);
4832
4832
  defineSymbol(math, main, bin, "\u222a", "\\cup", true);
4833
- defineSymbol(math, main, bin, "\u2216", "\\setminus");
4833
+ defineSymbol(math, main, bin, "\u2216", "\\setminus", true);
4834
4834
  defineSymbol(math, main, bin, "\u2227", "\\land");
4835
4835
  defineSymbol(math, main, bin, "\u2228", "\\lor");
4836
4836
  defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
@@ -16366,6 +16366,113 @@ class MacroExpander {
16366
16366
 
16367
16367
  }
16368
16368
 
16369
+ // Helpers for Parser.js handling of Unicode (sub|super)script characters.
16370
+ var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
16371
+ var uSubsAndSups = Object.freeze({
16372
+ '₊': '+',
16373
+ '₋': '-',
16374
+ '₌': '=',
16375
+ '₍': '(',
16376
+ '₎': ')',
16377
+ '₀': '0',
16378
+ '₁': '1',
16379
+ '₂': '2',
16380
+ '₃': '3',
16381
+ '₄': '4',
16382
+ '₅': '5',
16383
+ '₆': '6',
16384
+ '₇': '7',
16385
+ '₈': '8',
16386
+ '₉': '9',
16387
+ '\u2090': 'a',
16388
+ '\u2091': 'e',
16389
+ '\u2095': 'h',
16390
+ '\u1D62': 'i',
16391
+ '\u2C7C': 'j',
16392
+ '\u2096': 'k',
16393
+ '\u2097': 'l',
16394
+ '\u2098': 'm',
16395
+ '\u2099': 'n',
16396
+ '\u2092': 'o',
16397
+ '\u209A': 'p',
16398
+ '\u1D63': 'r',
16399
+ '\u209B': 's',
16400
+ '\u209C': 't',
16401
+ '\u1D64': 'u',
16402
+ '\u1D65': 'v',
16403
+ '\u2093': 'x',
16404
+ '\u1D66': 'β',
16405
+ '\u1D67': 'γ',
16406
+ '\u1D68': 'ρ',
16407
+ '\u1D69': '\u03d5',
16408
+ '\u1D6A': 'χ',
16409
+ '⁺': '+',
16410
+ '⁻': '-',
16411
+ '⁼': '=',
16412
+ '⁽': '(',
16413
+ '⁾': ')',
16414
+ '⁰': '0',
16415
+ '¹': '1',
16416
+ '²': '2',
16417
+ '³': '3',
16418
+ '⁴': '4',
16419
+ '⁵': '5',
16420
+ '⁶': '6',
16421
+ '⁷': '7',
16422
+ '⁸': '8',
16423
+ '⁹': '9',
16424
+ '\u1D2C': 'A',
16425
+ '\u1D2E': 'B',
16426
+ '\u1D30': 'D',
16427
+ '\u1D31': 'E',
16428
+ '\u1D33': 'G',
16429
+ '\u1D34': 'H',
16430
+ '\u1D35': 'I',
16431
+ '\u1D36': 'J',
16432
+ '\u1D37': 'K',
16433
+ '\u1D38': 'L',
16434
+ '\u1D39': 'M',
16435
+ '\u1D3A': 'N',
16436
+ '\u1D3C': 'O',
16437
+ '\u1D3E': 'P',
16438
+ '\u1D3F': 'R',
16439
+ '\u1D40': 'T',
16440
+ '\u1D41': 'U',
16441
+ '\u2C7D': 'V',
16442
+ '\u1D42': 'W',
16443
+ '\u1D43': 'a',
16444
+ '\u1D47': 'b',
16445
+ '\u1D9C': 'c',
16446
+ '\u1D48': 'd',
16447
+ '\u1D49': 'e',
16448
+ '\u1DA0': 'f',
16449
+ '\u1D4D': 'g',
16450
+ '\u02B0': 'h',
16451
+ '\u2071': 'i',
16452
+ '\u02B2': 'j',
16453
+ '\u1D4F': 'k',
16454
+ '\u02E1': 'l',
16455
+ '\u1D50': 'm',
16456
+ '\u207F': 'n',
16457
+ '\u1D52': 'o',
16458
+ '\u1D56': 'p',
16459
+ '\u02B3': 'r',
16460
+ '\u02E2': 's',
16461
+ '\u1D57': 't',
16462
+ '\u1D58': 'u',
16463
+ '\u1D5B': 'v',
16464
+ '\u02B7': 'w',
16465
+ '\u02E3': 'x',
16466
+ '\u02B8': 'y',
16467
+ '\u1DBB': 'z',
16468
+ '\u1D5D': 'β',
16469
+ '\u1D5E': 'γ',
16470
+ '\u1D5F': 'δ',
16471
+ '\u1D60': '\u03d5',
16472
+ '\u1D61': 'χ',
16473
+ '\u1DBF': 'θ'
16474
+ });
16475
+
16369
16476
  /* eslint no-constant-condition:0 */
16370
16477
 
16371
16478
  var unicodeAccents = {
@@ -17164,6 +17271,46 @@ class Parser {
17164
17271
  mode: this.mode,
17165
17272
  body: primes
17166
17273
  };
17274
+ } else if (uSubsAndSups[lex.text]) {
17275
+ // A Unicode subscript or superscript character.
17276
+ // We treat these similarly to the unicode-math package.
17277
+ // So we render a string of Unicode (sub|super)scripts the
17278
+ // same as a (sub|super)script of regular characters.
17279
+ var str = uSubsAndSups[lex.text];
17280
+ var isSub = unicodeSubRegEx.test(lex.text);
17281
+ this.consume(); // Continue fetching tokens to fill out the string.
17282
+
17283
+ while (true) {
17284
+ var token = this.fetch().text;
17285
+
17286
+ if (!uSubsAndSups[token]) {
17287
+ break;
17288
+ }
17289
+
17290
+ if (unicodeSubRegEx.test(token) !== isSub) {
17291
+ break;
17292
+ }
17293
+
17294
+ this.consume();
17295
+ str += uSubsAndSups[token];
17296
+ } // Now create a (sub|super)script.
17297
+
17298
+
17299
+ var body = new Parser(str, this.settings).parse();
17300
+
17301
+ if (isSub) {
17302
+ subscript = {
17303
+ type: "ordgroup",
17304
+ mode: "math",
17305
+ body
17306
+ };
17307
+ } else {
17308
+ superscript = {
17309
+ type: "ordgroup",
17310
+ mode: "math",
17311
+ body
17312
+ };
17313
+ }
17167
17314
  } else {
17168
17315
  // If it wasn't ^, _, or ', stop parsing super/subscripts
17169
17316
  break;
@@ -17959,7 +18106,7 @@ var katex = {
17959
18106
  /**
17960
18107
  * Current KaTeX version
17961
18108
  */
17962
- version: "0.15.2",
18109
+ version: "0.15.5",
17963
18110
 
17964
18111
  /**
17965
18112
  * Renders the given LaTeX into an HTML+MathML combination, and adds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.15.2",
3
+ "version": "0.15.5",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "exports": {
@@ -47,7 +47,7 @@
47
47
  "dist/"
48
48
  ],
49
49
  "license": "MIT",
50
- "packageManager": "yarn@3.1.1",
50
+ "packageManager": "yarn@3.2.0",
51
51
  "devDependencies": {
52
52
  "@babel/core": "^7.10.4",
53
53
  "@babel/eslint-parser": "^7.15.0",
@@ -103,9 +103,9 @@
103
103
  "p-retry": "^4.6.1",
104
104
  "pako": "^2.0.0",
105
105
  "postcss": "^8.0.0",
106
- "postcss-less": "^5.0.0",
106
+ "postcss-less": "^6.0.0",
107
107
  "postcss-loader": "^6.0.0",
108
- "postcss-preset-env": "^6.7.0",
108
+ "postcss-preset-env": "^7.0.0",
109
109
  "prettier": "^2.0.5",
110
110
  "query-string": "^7.0.0",
111
111
  "rimraf": "^3.0.2",
package/src/Parser.js CHANGED
@@ -9,6 +9,7 @@ import ParseError from "./ParseError";
9
9
  import {combiningDiacriticalMarksEndRegex} from "./Lexer";
10
10
  import Settings from "./Settings";
11
11
  import SourceLocation from "./SourceLocation";
12
+ import {uSubsAndSups, unicodeSubRegEx} from "./unicodeSupOrSub";
12
13
  import {Token} from "./Token";
13
14
 
14
15
  // Pre-evaluate both modules as unicodeSymbols require String.normalize()
@@ -399,6 +400,29 @@ export default class Parser {
399
400
  }
400
401
  // Put everything into an ordgroup as the superscript
401
402
  superscript = {type: "ordgroup", mode: this.mode, body: primes};
403
+ } else if (uSubsAndSups[lex.text]) {
404
+ // A Unicode subscript or superscript character.
405
+ // We treat these similarly to the unicode-math package.
406
+ // So we render a string of Unicode (sub|super)scripts the
407
+ // same as a (sub|super)script of regular characters.
408
+ let str = uSubsAndSups[lex.text];
409
+ const isSub = unicodeSubRegEx.test(lex.text);
410
+ this.consume();
411
+ // Continue fetching tokens to fill out the string.
412
+ while (true) {
413
+ const token = this.fetch().text;
414
+ if (!(uSubsAndSups[token])) { break; }
415
+ if (unicodeSubRegEx.test(token) !== isSub) { break; }
416
+ this.consume();
417
+ str += uSubsAndSups[token];
418
+ }
419
+ // Now create a (sub|super)script.
420
+ const body = (new Parser(str, this.settings)).parse();
421
+ if (isSub) {
422
+ subscript = {type: "ordgroup", mode: "math", body};
423
+ } else {
424
+ superscript = {type: "ordgroup", mode: "math", body};
425
+ }
402
426
  } else {
403
427
  // If it wasn't ^, _, or ', stop parsing super/subscripts
404
428
  break;
package/src/symbols.js CHANGED
@@ -171,7 +171,7 @@ defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
171
171
  defineSymbol(math, main, bin, "\u2217", "\\ast");
172
172
  defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
173
173
  defineSymbol(math, main, bin, "\u25ef", "\\bigcirc", true);
174
- defineSymbol(math, main, bin, "\u2219", "\\bullet");
174
+ defineSymbol(math, main, bin, "\u2219", "\\bullet", true);
175
175
  defineSymbol(math, main, bin, "\u2021", "\\ddagger");
176
176
  defineSymbol(math, main, bin, "\u2240", "\\wr", true);
177
177
  defineSymbol(math, main, bin, "\u2a3f", "\\amalg");
@@ -538,13 +538,13 @@ defineSymbol(math, main, bin, "\u2217", "*", true);
538
538
  defineSymbol(math, main, bin, "+", "+");
539
539
  defineSymbol(math, main, bin, "\u2212", "-", true);
540
540
  defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
541
- defineSymbol(math, main, bin, "\u2218", "\\circ");
541
+ defineSymbol(math, main, bin, "\u2218", "\\circ", true);
542
542
  defineSymbol(math, main, bin, "\u00f7", "\\div", true);
543
543
  defineSymbol(math, main, bin, "\u00b1", "\\pm", true);
544
544
  defineSymbol(math, main, bin, "\u00d7", "\\times", true);
545
545
  defineSymbol(math, main, bin, "\u2229", "\\cap", true);
546
546
  defineSymbol(math, main, bin, "\u222a", "\\cup", true);
547
- defineSymbol(math, main, bin, "\u2216", "\\setminus");
547
+ defineSymbol(math, main, bin, "\u2216", "\\setminus", true);
548
548
  defineSymbol(math, main, bin, "\u2227", "\\land");
549
549
  defineSymbol(math, main, bin, "\u2228", "\\lor");
550
550
  defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
@@ -0,0 +1,108 @@
1
+ // Helpers for Parser.js handling of Unicode (sub|super)script characters.
2
+
3
+ export const unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
4
+
5
+ export const uSubsAndSups = Object.freeze({
6
+ '₊': '+',
7
+ '₋': '-',
8
+ '₌': '=',
9
+ '₍': '(',
10
+ '₎': ')',
11
+ '₀': '0',
12
+ '₁': '1',
13
+ '₂': '2',
14
+ '₃': '3',
15
+ '₄': '4',
16
+ '₅': '5',
17
+ '₆': '6',
18
+ '₇': '7',
19
+ '₈': '8',
20
+ '₉': '9',
21
+ '\u2090': 'a',
22
+ '\u2091': 'e',
23
+ '\u2095': 'h',
24
+ '\u1D62': 'i',
25
+ '\u2C7C': 'j',
26
+ '\u2096': 'k',
27
+ '\u2097': 'l',
28
+ '\u2098': 'm',
29
+ '\u2099': 'n',
30
+ '\u2092': 'o',
31
+ '\u209A': 'p',
32
+ '\u1D63': 'r',
33
+ '\u209B': 's',
34
+ '\u209C': 't',
35
+ '\u1D64': 'u',
36
+ '\u1D65': 'v',
37
+ '\u2093': 'x',
38
+ '\u1D66': 'β',
39
+ '\u1D67': 'γ',
40
+ '\u1D68': 'ρ',
41
+ '\u1D69': '\u03d5',
42
+ '\u1D6A': 'χ',
43
+ '⁺': '+',
44
+ '⁻': '-',
45
+ '⁼': '=',
46
+ '⁽': '(',
47
+ '⁾': ')',
48
+ '⁰': '0',
49
+ '¹': '1',
50
+ '²': '2',
51
+ '³': '3',
52
+ '⁴': '4',
53
+ '⁵': '5',
54
+ '⁶': '6',
55
+ '⁷': '7',
56
+ '⁸': '8',
57
+ '⁹': '9',
58
+ '\u1D2C': 'A',
59
+ '\u1D2E': 'B',
60
+ '\u1D30': 'D',
61
+ '\u1D31': 'E',
62
+ '\u1D33': 'G',
63
+ '\u1D34': 'H',
64
+ '\u1D35': 'I',
65
+ '\u1D36': 'J',
66
+ '\u1D37': 'K',
67
+ '\u1D38': 'L',
68
+ '\u1D39': 'M',
69
+ '\u1D3A': 'N',
70
+ '\u1D3C': 'O',
71
+ '\u1D3E': 'P',
72
+ '\u1D3F': 'R',
73
+ '\u1D40': 'T',
74
+ '\u1D41': 'U',
75
+ '\u2C7D': 'V',
76
+ '\u1D42': 'W',
77
+ '\u1D43': 'a',
78
+ '\u1D47': 'b',
79
+ '\u1D9C': 'c',
80
+ '\u1D48': 'd',
81
+ '\u1D49': 'e',
82
+ '\u1DA0': 'f',
83
+ '\u1D4D': 'g',
84
+ '\u02B0': 'h',
85
+ '\u2071': 'i',
86
+ '\u02B2': 'j',
87
+ '\u1D4F': 'k',
88
+ '\u02E1': 'l',
89
+ '\u1D50': 'm',
90
+ '\u207F': 'n',
91
+ '\u1D52': 'o',
92
+ '\u1D56': 'p',
93
+ '\u02B3': 'r',
94
+ '\u02E2': 's',
95
+ '\u1D57': 't',
96
+ '\u1D58': 'u',
97
+ '\u1D5B': 'v',
98
+ '\u02B7': 'w',
99
+ '\u02E3': 'x',
100
+ '\u02B8': 'y',
101
+ '\u1DBB': 'z',
102
+ '\u1D5D': 'β',
103
+ '\u1D5E': 'γ',
104
+ '\u1D5F': 'δ',
105
+ '\u1D60': '\u03d5',
106
+ '\u1D61': 'χ',
107
+ '\u1DBF': 'θ',
108
+ });
@@ -1,235 +0,0 @@
1
- 0a1
2
- > /* eslint-disable */
3
- 5a7,22
4
- > * KaTeX mhchem.js
5
- > *
6
- > * This file implements a KaTeX version of mhchem version 3.3.0.
7
- > * It is adapted from MathJax/extensions/TeX/mhchem.js
8
- > * It differs from the MathJax version as follows:
9
- > * 1. The interface is changed so that it can be called from KaTeX, not MathJax.
10
- > * 2. \rlap and \llap are replaced with \mathrlap and \mathllap.
11
- > * 3. Four lines of code are edited in order to use \raisebox instead of \raise.
12
- > * 4. The reaction arrow code is simplified. All reaction arrows are rendered
13
- > * using KaTeX extensible arrows instead of building non-extensible arrows.
14
- > * 5. \tripledash vertical alignment is slightly adjusted.
15
- > *
16
- > * This code, as other KaTeX code, is released under the MIT license.
17
- > *
18
- > * /*************************************************************
19
- > *
20
- 33a51
21
- > // version: "3.3.0" for MathJax and KaTeX
22
- 35,37d52
23
- < MathJax.Extension["TeX/mhchem"] = {
24
- < version: "3.3.0"
25
- < };
26
- 39c54
27
- < MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
28
- ---
29
- > // Add \ce, \pu, and \tripledash to the KaTeX macros.
30
- 41c56,58
31
- < var TEX = MathJax.InputJax.TeX;
32
- ---
33
- > katex.__defineMacro("\\ce", function(context) {
34
- > return chemParse(context.consumeArgs(1)[0], "ce")
35
- > });
36
- 43,47c60,62
37
- < //
38
- < // This is the main class for handing the \ce and related commands.
39
- < // Its main method is Parse() which takes the argument to \ce and
40
- < // returns the corresponding TeX string.
41
- < //
42
- ---
43
- > katex.__defineMacro("\\pu", function(context) {
44
- > return chemParse(context.consumeArgs(1)[0], "pu");
45
- > });
46
- 49,50c64,68
47
- < var CE = MathJax.Object.Subclass({
48
- < string: "", // the \ce string being parsed
49
- ---
50
- > // Needed for \bond for the ~ forms
51
- > // Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not
52
- > // a mathematical minus, U+2212. So we need that extra 0.56.
53
- > katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu"
54
- > + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
55
- 52,55c70
56
- < //
57
- < // Store the string when a CE object is created
58
- < //
59
- < Init: function (string) { this.string = string; },
60
- ---
61
- > import katex from "katex";
62
- 57,64c72,85
63
- < //
64
- < // This converts the CE string to a TeX string.
65
- < //
66
- < Parse: function (stateMachine) {
67
- < try {
68
- < return texify.go(mhchemParser.go(this.string, stateMachine));
69
- < } catch (ex) {
70
- < TEX.Error(ex);
71
- ---
72
- > //
73
- > // This is the main function for handing the \ce and \pu commands.
74
- > // It takes the argument to \ce or \pu and returns the corresponding TeX string.
75
- > //
76
- >
77
- > var chemParse = function (tokens, stateMachine) {
78
- > // Recreate the argument string from KaTeX's array of tokens.
79
- > var str = "";
80
- > var expectedLoc = tokens[tokens.length - 1].loc.start
81
- > for (var i = tokens.length - 1; i >= 0; i--) {
82
- > if(tokens[i].loc.start > expectedLoc) {
83
- > // context.consumeArgs has eaten a space.
84
- > str += " ";
85
- > expectedLoc = tokens[i].loc.start;
86
- 65a87,88
87
- > str += tokens[i].text;
88
- > expectedLoc += tokens[i].text.length;
89
- 67c90,92
90
- < });
91
- ---
92
- > var tex = texify.go(mhchemParser.go(str, stateMachine));
93
- > return tex;
94
- > };
95
- 1405,1406c1430,1431
96
- < res += "^{\\smash[t]{\\vphantom{2}}\\llap{"+(b5.b||"")+"}}";
97
- < res += "_{\\vphantom{2}\\llap{\\smash[t]{"+(b5.p||"")+"}}}";
98
- ---
99
- > res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{"+(b5.b||"")+"}}";
100
- > res += "_{\\vphantom{2}\\mathllap{\\smash[t]{"+(b5.p||"")+"}}}";
101
- 1508,1520c1533,1536
102
- < var arrow = texify._getArrow(buf.r);
103
- < if (b6.rd || b6.rq) {
104
- < if (buf.r === "<=>" || buf.r === "<=>>" || buf.r === "<<=>" || buf.r === "<-->") {
105
- < // arrows that cannot stretch correctly yet, https://github.com/mathjax/MathJax/issues/1491
106
- < arrow = "\\long"+arrow;
107
- < if (b6.rd) { arrow = "\\overset{"+b6.rd+"}{"+arrow+"}"; }
108
- < if (b6.rq) { arrow = "\\underset{\\lower7mu{"+b6.rq+"}}{"+arrow+"}"; }
109
- < arrow = " {}\\mathrel{"+arrow+"}{} ";
110
- < } else {
111
- < if (b6.rq) { arrow += "[{"+b6.rq+"}]"; }
112
- < arrow += "{"+b6.rd+"}";
113
- < arrow = " {}\\mathrel{\\x"+arrow+"}{} ";
114
- < }
115
- ---
116
- > var arrow = "\\x" + texify._getArrow(buf.r);
117
- > if (b6.rq) { arrow += "[{" + b6.rq + "}]"; }
118
- > if (b6.rd) {
119
- > arrow += "{" + b6.rd + "}";
120
- 1522c1538
121
- < arrow = " {}\\mathrel{\\long"+arrow+"}{} ";
122
- ---
123
- > arrow += "{}";
124
- 1615c1631
125
- < case "<-->": return "leftrightarrows";
126
- ---
127
- > case "<-->": return "rightleftarrows";
128
- 1618,1619c1634,1635
129
- < case "<=>>": return "Rightleftharpoons";
130
- < case "<<=>": return "Leftrightharpoons";
131
- ---
132
- > case "<=>>": return "rightequilibrium";
133
- > case "<<=>": return "leftequilibrium";
134
- 1634,1637c1650,1653
135
- < case "~-": return "{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";
136
- < case "~=": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
137
- < case "~--": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
138
- < case "-~-": return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";
139
- ---
140
- > case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
141
- > case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
142
- > case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
143
- > case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
144
- 1680,1770d1695
145
- <
146
- < //
147
- < // MathJax definitions
148
- < //
149
- < MathJax.Extension["TeX/mhchem"].CE = CE;
150
- <
151
- < /***************************************************************************/
152
- <
153
- < TEX.Definitions.Add({
154
- < macros: {
155
- < //
156
- < // Set up the macros for chemistry
157
- < //
158
- < ce: "CE",
159
- < pu: "PU",
160
- <
161
- < //
162
- < // Make these load AMSmath package (redefined below when loaded)
163
- < //
164
- < xleftrightarrow: ["Extension", "AMSmath"],
165
- < xrightleftharpoons: ["Extension", "AMSmath"],
166
- < xRightleftharpoons: ["Extension", "AMSmath"],
167
- < xLeftrightharpoons: ["Extension", "AMSmath"],
168
- <
169
- < // FIXME: These don't work well in FF NativeMML mode
170
- < longrightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],
171
- < longRightleftharpoons: ["Macro", "\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],
172
- < longLeftrightharpoons: ["Macro", "\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],
173
- < longleftrightarrows: ["Macro", "\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}"],
174
- <
175
- < //
176
- < // Needed for \bond for the ~ forms
177
- < // Not perfectly aligned when zoomed in, but on 100%
178
- < //
179
- < tripledash: ["Macro", "\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"]
180
- < },
181
- < }, null, true);
182
- <
183
- < if (!MathJax.Extension["TeX/AMSmath"]) {
184
- < TEX.Definitions.Add({
185
- < macros: {
186
- < xrightarrow: ["Extension", "AMSmath"],
187
- < xleftarrow: ["Extension", "AMSmath"]
188
- < }
189
- < }, null, true);
190
- < }
191
- <
192
- < //
193
- < // These arrows need to wait until AMSmath is loaded
194
- < //
195
- < MathJax.Hub.Register.StartupHook("TeX AMSmath Ready", function () {
196
- < TEX.Definitions.Add({
197
- < macros: {
198
- < //
199
- < // Some of these are hacks for now
200
- < //
201
- < xleftrightarrow: ["xArrow", 0x2194, 6, 6],
202
- < xrightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: doesn't stretch in HTML-CSS output
203
- < xRightleftharpoons: ["xArrow", 0x21CC, 5, 7], // FIXME: how should this be handled?
204
- < xLeftrightharpoons: ["xArrow", 0x21CC, 5, 7]
205
- < }
206
- < }, null, true);
207
- < });
208
- <
209
- < TEX.Parse.Augment({
210
- <
211
- < //
212
- < // Implements \ce and friends
213
- < //
214
- < CE: function (name) {
215
- < var arg = this.GetArgument(name);
216
- < var tex = CE(arg).Parse();
217
- < this.string = tex + this.string.substr(this.i); this.i = 0;
218
- < },
219
- <
220
- < PU: function (name) {
221
- < var arg = this.GetArgument(name);
222
- < var tex = CE(arg).Parse('pu');
223
- < this.string = tex + this.string.substr(this.i); this.i = 0;
224
- < }
225
- <
226
- < });
227
- <
228
- < //
229
- < // Indicate that the extension is ready
230
- < //
231
- < MathJax.Hub.Startup.signal.Post("TeX mhchem Ready");
232
- <
233
- < });
234
- <
235
- < MathJax.Ajax.loadComplete("[mhchem]/unpacked/mhchem.js");