Skip to content

Commit e2a920f

Browse files
committed
Slightly improved treatment of mathchoice.
1 parent 328b1ce commit e2a920f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

mathjax3-ts/input/tex/ParseMethods.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
// import * as sitem from './StackItem.js';
2626
import * as sitem from './StackItem.js';
27+
import {NewTex} from './Translate.js';
2728
import {Symbol} from './Symbol.js';
2829
import {CharacterMap} from './SymbolMap.js';
2930
import {TreeHelper} from './TreeHelper.js';
@@ -1511,7 +1512,7 @@ export namespace ParseMethods {
15111512
let T = parser.ParseArg(name);
15121513
let S = parser.ParseArg(name);
15131514
let SS = parser.ParseArg(name);
1514-
parser.Push(D);
1515+
parser.Push(NewTex.display ? D : T);
15151516
// parser.Push(MML.TeXmathchoice(D,T,S,SS));
15161517
}
15171518

mathjax3-ts/input/tex/ParserUtil.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ import {OldParser} from './OldParser.js';
3434

3535
export namespace ParserUtil {
3636

37-
// export let OldParser = (x:any, {}) => x;
38-
3937
const emPerInch = 7.2;
4038
const pxPerInch = 72;
4139
const UNIT_CASES: {[key: string]: ((m: number) => number)} = {

mathjax3-ts/input/tex/Translate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export namespace NewTex {
3737

3838
export type Script = {type: string, innerText: string, MathJax: any};
3939

40+
export let display: boolean = false;
41+
4042
export function Compile(tex: string, display: boolean): MmlNode {
4143
let script = {
4244
type:"math/tex"+(display?"; mode=display":""),
@@ -60,7 +62,7 @@ export namespace NewTex {
6062
let mml: MmlNode;
6163
let isError = false;
6264
let math = script.innerText;
63-
let display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
65+
display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
6466
try {
6567
mml = new OldParser(math, null, ParseMethods as any).mml();
6668
TreeHelper.printSimple(mml.toString());

0 commit comments

Comments
 (0)