temml 0.10.21 → 0.10.22
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Temml-Asana.css +0 -4
- package/dist/Temml-STIX2.css +0 -4
- package/dist/temml.cjs +123 -79
- package/dist/temml.d.ts +1 -1
- package/dist/temml.js +123 -79
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +123 -79
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +8 -1
- package/src/functions/color.js +1 -1
- package/src/functions/delimsizing.js +22 -7
- package/src/functions/font.js +1 -1
- package/src/functions/mclass.js +3 -0
- package/src/functions/reflect.js +24 -0
- package/src/functions/sizing.js +1 -1
- package/src/functions/styling.js +1 -1
- package/src/functions/symbolsOrd.js +0 -2
- package/src/functions.js +1 -0
- package/src/linebreaking.js +3 -2
- package/src/macros.js +49 -53
- package/src/postProcess.js +1 -1
- package/src/replace.js +8 -8
- package/src/symbols.js +4 -1
package/src/macros.js
CHANGED
@@ -184,6 +184,24 @@ defineMacro("\\char", function(context) {
|
|
184
184
|
return `\\@char{${number}}`;
|
185
185
|
});
|
186
186
|
|
187
|
+
function recreateArgStr(context) {
|
188
|
+
// Recreate the macro's original argument string from the array of parse tokens.
|
189
|
+
const tokens = context.consumeArgs(1)[0];
|
190
|
+
let str = ""
|
191
|
+
let expectedLoc = tokens[tokens.length - 1].loc.start
|
192
|
+
for (let i = tokens.length - 1; i >= 0; i--) {
|
193
|
+
const actualLoc = tokens[i].loc.start
|
194
|
+
if (actualLoc > expectedLoc) {
|
195
|
+
// context.consumeArgs has eaten a space.
|
196
|
+
str += " "
|
197
|
+
expectedLoc = actualLoc;
|
198
|
+
}
|
199
|
+
str += tokens[i].text
|
200
|
+
expectedLoc += tokens[i].text.length
|
201
|
+
}
|
202
|
+
return str
|
203
|
+
}
|
204
|
+
|
187
205
|
// The Latin Modern font renders <mi>√</mi> at the wrong vertical alignment.
|
188
206
|
// This macro provides a better rendering.
|
189
207
|
defineMacro("\\surd", '\\sqrt{\\vphantom{|}}')
|
@@ -191,10 +209,6 @@ defineMacro("\\surd", '\\sqrt{\\vphantom{|}}')
|
|
191
209
|
// See comment for \oplus in symbols.js.
|
192
210
|
defineMacro("\u2295", "\\oplus")
|
193
211
|
|
194
|
-
// Per TeXbook p.122, "/" gets zero operator spacing.
|
195
|
-
// And MDN recommends using U+2044 instead of / for inline
|
196
|
-
defineMacro("/", "{\u2044}")
|
197
|
-
|
198
212
|
// Since Temml has no \par, ignore \long.
|
199
213
|
defineMacro("\\long", "")
|
200
214
|
|
@@ -572,6 +586,11 @@ defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
|
|
572
586
|
defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
|
573
587
|
defineMacro("\\plim", "\\DOTSB\\operatorname*{plim}");
|
574
588
|
|
589
|
+
//////////////////////////////////////////////////////////////////////
|
590
|
+
// MnSymbol.sty
|
591
|
+
|
592
|
+
defineMacro("\\leftmodels", "\\mathop{\\reflectbox{$\\models$}}")
|
593
|
+
|
575
594
|
//////////////////////////////////////////////////////////////////////
|
576
595
|
// braket.sty
|
577
596
|
// http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf
|
@@ -581,56 +600,33 @@ defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
|
|
581
600
|
defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
|
582
601
|
defineMacro("\\Bra", "\\left\\langle#1\\right|");
|
583
602
|
defineMacro("\\Ket", "\\left|#1\\right\\rangle");
|
584
|
-
|
585
|
-
|
586
|
-
const
|
587
|
-
const
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
context
|
592
|
-
const
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
if (middleDouble.length) {
|
597
|
-
context.macros.set("\\|", oldMiddleDouble);
|
598
|
-
}
|
599
|
-
}
|
600
|
-
let doubled = double;
|
601
|
-
if (!double && middleDouble.length) {
|
602
|
-
// Mimic \@ifnextchar
|
603
|
-
const nextToken = context.future();
|
604
|
-
if (nextToken.text === "|") {
|
605
|
-
context.popToken();
|
606
|
-
doubled = true;
|
607
|
-
}
|
608
|
-
}
|
609
|
-
return {
|
610
|
-
tokens: doubled ? middleDouble : middle,
|
611
|
-
numArgs: 0
|
612
|
-
};
|
613
|
-
};
|
614
|
-
context.macros.set("|", midMacro(false));
|
615
|
-
if (middleDouble.length) {
|
616
|
-
context.macros.set("\\|", midMacro(true));
|
603
|
+
// A helper for \Braket and \Set
|
604
|
+
const replaceVert = (argStr, match) => {
|
605
|
+
const ch = match[0] === "|" ? "\\vert" : "\\Vert"
|
606
|
+
const replaceStr = `}\\,\\middle${ch}\\,{`
|
607
|
+
return argStr.slice(0, match.index) + replaceStr + argStr.slice(match.index + match[0].length)
|
608
|
+
}
|
609
|
+
defineMacro("\\Braket", function(context) {
|
610
|
+
let argStr = recreateArgStr(context)
|
611
|
+
const regEx = /\|\||\||\\\|/g
|
612
|
+
let match
|
613
|
+
while ((match = regEx.exec(argStr)) !== null) {
|
614
|
+
argStr = replaceVert(argStr, match)
|
617
615
|
}
|
618
|
-
|
619
|
-
|
620
|
-
context
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
}
|
626
|
-
|
627
|
-
|
628
|
-
defineMacro("\\
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
|
633
|
-
// has no support for special || or \|
|
616
|
+
return "\\left\\langle{" + argStr + "}\\right\\rangle"
|
617
|
+
});
|
618
|
+
defineMacro("\\Set", function(context) {
|
619
|
+
let argStr = recreateArgStr(context)
|
620
|
+
const match = /\|\||\||\\\|/.exec(argStr)
|
621
|
+
if (match) {
|
622
|
+
argStr = replaceVert(argStr, match)
|
623
|
+
}
|
624
|
+
return "\\left\\{\\:{" + argStr + "}\\:\\right\\}"
|
625
|
+
});
|
626
|
+
defineMacro("\\set", function(context) {
|
627
|
+
const argStr = recreateArgStr(context)
|
628
|
+
return "\\{{" + argStr.replace(/\|/, "}\\mid{") + "}\\}"
|
629
|
+
});
|
634
630
|
|
635
631
|
//////////////////////////////////////////////////////////////////////
|
636
632
|
// actuarialangle.dtx
|
package/src/postProcess.js
CHANGED
package/src/replace.js
CHANGED
@@ -106,22 +106,22 @@ const offset = Object.freeze({
|
|
106
106
|
"sans-serif-bold-italic": ch => { return 0x1D5F5 },
|
107
107
|
"monospace": ch => { return 0x1D629 }
|
108
108
|
},
|
109
|
-
upperCaseGreek: { // A-Ω
|
109
|
+
upperCaseGreek: { // A-Ω
|
110
110
|
"normal": ch => { return 0 },
|
111
|
-
"bold": ch => { return
|
112
|
-
"italic": ch => { return
|
111
|
+
"bold": ch => { return 0x1D317 },
|
112
|
+
"italic": ch => { return 0x1D351 },
|
113
113
|
// \boldsymbol actually returns upright bold for upperCaseGreek
|
114
|
-
"bold-italic": ch => { return
|
114
|
+
"bold-italic": ch => { return 0x1D317 },
|
115
115
|
"script": ch => { return 0 },
|
116
116
|
"script-bold": ch => { return 0 },
|
117
117
|
"fraktur": ch => { return 0 },
|
118
118
|
"fraktur-bold": ch => { return 0 },
|
119
119
|
"double-struck": ch => { return 0 },
|
120
120
|
// Unicode has no code points for regular-weight san-serif Greek. Use bold.
|
121
|
-
"sans-serif": ch => { return
|
122
|
-
"sans-serif-bold": ch => { return
|
121
|
+
"sans-serif": ch => { return 0x1D3C5 },
|
122
|
+
"sans-serif-bold": ch => { return 0x1D3C5 },
|
123
123
|
"sans-serif-italic": ch => { return 0 },
|
124
|
-
"sans-serif-bold-italic": ch => { return
|
124
|
+
"sans-serif-bold-italic": ch => { return 0x1D3FF },
|
125
125
|
"monospace": ch => { return 0 }
|
126
126
|
},
|
127
127
|
lowerCaseGreek: { // α-ω
|
@@ -181,7 +181,7 @@ export const variantChar = (ch, variant) => {
|
|
181
181
|
? "upperCaseLatin"
|
182
182
|
: 0x60 < codePoint && codePoint < 0x7b
|
183
183
|
? "lowerCaseLatin"
|
184
|
-
: (0x390 < codePoint && codePoint < 0x3AA)
|
184
|
+
: (0x390 < codePoint && codePoint < 0x3AA)
|
185
185
|
? "upperCaseGreek"
|
186
186
|
: 0x3B0 < codePoint && codePoint < 0x3CA || ch === "\u03d5"
|
187
187
|
? "lowerCaseGreek"
|
package/src/symbols.js
CHANGED
@@ -128,7 +128,8 @@ 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
|
-
|
131
|
+
// ∇ is actually a unary operator, not binary. But this works.
|
132
|
+
defineSymbol(math, bin, "\u2207", "\\nabla", true);
|
132
133
|
defineSymbol(math, textord, "\u266d", "\\flat", true);
|
133
134
|
defineSymbol(math, textord, "\u2113", "\\ell", true);
|
134
135
|
defineSymbol(math, textord, "\u266e", "\\natural", true);
|
@@ -182,6 +183,7 @@ defineSymbol(math, bin, "\u2021", "\\ddagger");
|
|
182
183
|
defineSymbol(math, bin, "\u2240", "\\wr", true);
|
183
184
|
defineSymbol(math, bin, "\u2a3f", "\\amalg");
|
184
185
|
defineSymbol(math, bin, "\u0026", "\\And"); // from amsmath
|
186
|
+
defineSymbol(math, bin, "\u2AFD", "\\sslash", true); // from stmaryrd
|
185
187
|
|
186
188
|
// Arrow Symbols
|
187
189
|
defineSymbol(math, rel, "\u27f5", "\\longleftarrow", true);
|
@@ -600,6 +602,7 @@ defineSymbol(math, mathord, "\u2aeb", "\\Bot");
|
|
600
602
|
defineSymbol(math, bin, "\u2217", "\u2217", true);
|
601
603
|
defineSymbol(math, bin, "+", "+");
|
602
604
|
defineSymbol(math, bin, "*", "*");
|
605
|
+
defineSymbol(math, bin, "\u2044", "/", true);
|
603
606
|
defineSymbol(math, bin, "\u2044", "\u2044");
|
604
607
|
defineSymbol(math, bin, "\u2212", "-", true);
|
605
608
|
defineSymbol(math, bin, "\u22c5", "\\cdot", true);
|