temml 0.12.2 → 0.13.2

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/src/parseTree.js CHANGED
@@ -8,11 +8,27 @@ const parseTree = function(toParse, settings) {
8
8
  if (!(typeof toParse === "string" || toParse instanceof String)) {
9
9
  throw new TypeError("Temml can only parse string typed expression")
10
10
  }
11
- const parser = new Parser(toParse, settings)
12
- // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
13
- delete parser.gullet.macros.current["\\df@tag"]
11
+ let tree;
12
+ let parser;
13
+ try {
14
+ parser = new Parser(toParse, settings)
15
+ // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
16
+ delete parser.gullet.macros.current["\\df@tag"]
14
17
 
15
- let tree = parser.parse()
18
+ tree = parser.parse()
19
+ } catch (error) {
20
+ if (error.toString() === "ParseError: Unmatched delimiter") {
21
+ // Abandon the attempt to wrap delimiter pairs in an <mrow>.
22
+ // Try again, and put each delimiter into an <mo> element.
23
+ settings.wrapDelimiterPairs = false;
24
+ parser = new Parser(toParse, settings)
25
+ // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
26
+ delete parser.gullet.macros.current["\\df@tag"]
27
+ tree = parser.parse()
28
+ } else {
29
+ throw error;
30
+ }
31
+ }
16
32
 
17
33
  // LaTeX ignores a \tag placed outside an AMS environment.
18
34
  if (!(tree.length > 0 && tree[0].type && tree[0].type === "array" && tree[0].addEqnNum)) {
@@ -5,7 +5,7 @@
5
5
  * https://mit-license.org/
6
6
  */
7
7
 
8
- export const version = "0.12.02";
8
+ export const version = "0.13.02";
9
9
 
10
10
  export function postProcess(block) {
11
11
  const labelMap = {}
package/src/symbols.js CHANGED
@@ -128,8 +128,7 @@ defineSymbol(math, textord, "\u2135", "\\aleph", true);
128
128
  defineSymbol(math, textord, "\u2200", "\\forall", true);
129
129
  defineSymbol(math, textord, "\u210f", "\\hbar", true);
130
130
  defineSymbol(math, textord, "\u2203", "\\exists", true);
131
- // is actually a unary operator, not binary. But this works.
132
- defineSymbol(math, bin, "\u2207", "\\nabla", true);
131
+ defineSymbol(math, open, "\u2207", "\\nabla", true);
133
132
  defineSymbol(math, textord, "\u266d", "\\flat", true);
134
133
  defineSymbol(math, textord, "\u2113", "\\ell", true);
135
134
  defineSymbol(math, textord, "\u266e", "\\natural", true);
@@ -222,7 +221,7 @@ defineSymbol(math, mathord, "\u2295", "\\Earth");
222
221
 
223
222
  // AMS Negated Binary Relations
224
223
  defineSymbol(math, rel, "\u226e", "\\nless", true);
225
- // Symbol names preceeded by "@" each have a corresponding macro.
224
+ // Symbol names preceded by "@" each have a corresponding macro.
226
225
  defineSymbol(math, rel, "\u2a87", "\\lneq", true);
227
226
  defineSymbol(math, rel, "\u2268", "\\lneqq", true);
228
227
  defineSymbol(math, rel, "\u2268\ufe00", "\\lvertneqq");