Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9176d63
Merge branch 'v4.1.2-update' into develop
dpvc May 15, 2026
969ada9
Fix problem with \limits and \nolimits when used after a script. (mat…
dpvc Jun 9, 2026
a65456c
Merge pull request #1497 from mathjax/issue3569
dpvc Jun 11, 2026
e72921f
Add symmetric="true" to \middle results. (mathjax/MathJax#3560)
dpvc May 16, 2026
139fe60
Don't rerender the output during menu initialization.
dpvc Jun 9, 2026
7e7fa55
Make sure the parsers array is cleared for tex and text parsers. (#1…
dpvc Jun 11, 2026
e69ef94
Fix `\bbox` problem with padding values that are decimals. (mathjax/…
dpvc Jun 11, 2026
68caffc
Make sure multi-byte UTF8 characters are handled properly in data-lat…
dpvc Jun 13, 2026
a88c6e7
Set box-sizing in dialogs to avoid CSS bleed through that affects clo…
dpvc Jun 13, 2026
ecfb01b
Fix label ids for expressions with forward refs. (mathjax/MathJax#3562)
dpvc Jun 14, 2026
f8a3f94
Update tests
dpvc Jun 14, 2026
6ee75da
Work around issue with Safari 26 not processing math inside otherwise…
dpvc Jun 18, 2026
db00d9b
Merge pull request #1499 from mathjax/issue3560
dpvc Jun 18, 2026
1c82395
Merge pull request #1501 from mathjax/fix/menu-init
dpvc Jun 18, 2026
4b007b3
Merge pull request #1502 from mathjax/issue1474
dpvc Jun 18, 2026
c9acda9
Merge pull request #1503 from mathjax/issue3568
dpvc Jun 18, 2026
13c0ad4
Merge pull request #1505 from mathjax/issue3575
dpvc Jun 18, 2026
ab879a2
Merge pull request #1506 from mathjax/fix/dialog-box-sizing
dpvc Jun 18, 2026
e72e718
Merge pull request #1507 from mathjax/issue3562
dpvc Jun 18, 2026
4284d5b
Merge pull request #1511 from mathjax/issue3579
dpvc Jun 18, 2026
935412a
Expose UEB in the braille menu
autodots-AHassan Jun 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3552,7 +3552,7 @@ exports[`Fenced Fenced Arrows 3 1`] = `
<mi data-latex="b">b</mi>
</mfrac>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo data-latex="\\middle\\downarrow ">&#x2193;</mo>
<mo symmetric="true" data-latex="\\middle\\downarrow ">&#x2193;</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle\\downarrow"></mrow>
<mi data-latex="c">c</mi>
<mo data-mjx-texclass="CLOSE" fence="true" symmetric="true" data-latex="\\right\\uparrow">&#x2191;</mo>
Expand Down Expand Up @@ -3660,7 +3660,7 @@ exports[`Fenced Middle 1`] = `
<mo data-mjx-texclass="OPEN" data-latex="\\left(">(</mo>
<mi data-latex="a">a</mi>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo stretchy="true" data-latex="\\middle|">|</mo>
<mo stretchy="true" symmetric="true" data-latex="\\middle|">|</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle|"></mrow>
<mi data-latex="b">b</mi>
<mo data-mjx-texclass="CLOSE" data-latex="\\right)">)</mo>
Expand Down Expand Up @@ -7931,7 +7931,7 @@ exports[`Spacing Nonscript scriptlevel 1`] = `
<mo data-mjx-texclass="OPEN" fence="true" stretchy="true" symmetric="true" data-latex="\\left."></mo>
<mi data-latex="a">a</mi>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo stretchy="true" data-latex="\\middle|">|</mo>
<mo stretchy="true" symmetric="true" data-latex="\\middle|">|</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle|"></mrow>
<mi data-latex="b">b</mi>
<mo data-mjx-texclass="CLOSE" fence="true" stretchy="true" symmetric="true" data-latex="\\right."></mo>
Expand All @@ -7948,7 +7948,7 @@ exports[`Spacing Nonscript toplevel 1`] = `
<mi data-latex="a">a</mi>
<mspace width="0.278em"></mspace>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo stretchy="true" data-latex="\\middle|">|</mo>
<mo stretchy="true" symmetric="true" data-latex="\\middle|">|</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle|"></mrow>
<mspace width="0.278em"></mspace>
<mi data-latex="b">b</mi>
Expand Down Expand Up @@ -9156,7 +9156,7 @@ exports[`User Defined Macros Middle Color 1`] = `
<mi data-latex="A">A</mi>
<mstyle mathcolor="red"></mstyle>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo stretchy="true" mathcolor="red" data-latex="\\middle|">|</mo>
<mo stretchy="true" symmetric="true" mathcolor="red" data-latex="\\middle|">|</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle|"></mrow>
<mi data-latex="B">B</mi>
<mo data-mjx-texclass="CLOSE" data-latex="\\right)">)</mo>
Expand All @@ -9170,7 +9170,7 @@ exports[`User Defined Macros Right Color 1`] = `
<mo data-mjx-texclass="OPEN" data-latex="\\left(">(</mo>
<mi data-latex="A">A</mi>
<mrow data-mjx-texclass="CLOSE"></mrow>
<mo stretchy="true" data-latex="\\middle|">|</mo>
<mo stretchy="true" symmetric="true" data-latex="\\middle|">|</mo>
<mrow data-mjx-texclass="OPEN" data-latex="\\middle|"></mrow>
<mi data-latex="B">B</mi>
<mstyle mathcolor="red"></mstyle>
Expand Down
88 changes: 44 additions & 44 deletions testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ts/input/tex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class TeX<N, T, D> extends AbstractInputJax<N, T, D> {
* @override
*/
public reset(tag: number = 0) {
this.parseOptions.clear();
this.parseOptions.tags.reset(tag);
}

Expand Down
2 changes: 1 addition & 1 deletion ts/input/tex/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class Configuration {
}

/**
* Creates an unnamed, ephemeral package configuration. It will not added to
* Creates an unnamed, ephemeral package configuration. It is not added to
* the configuration handler.
*
* @param {object} config See `create` method.
Expand Down
4 changes: 2 additions & 2 deletions ts/input/tex/TexParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default class TexParser {
//
// Back up one to pick up the parsed character (this.i is past it at this point).
//
this.saveI = this.i - (kind === 'character' && input[1] !== '&' ? 1 : 0);
this.saveI = this.i - (kind === 'character' && input[1] !== '&' ? input[1].length : 0);
const result = this.configuration.handlers.get(kind).parse(input);
//
// The macro gets processed by the \\ character later
Expand Down Expand Up @@ -248,11 +248,11 @@ export default class TexParser {
* @returns {MmlNode} The internal Mathml structure.
*/
public mml(): MmlNode {
this.configuration.popParser();
if (!this.stack.Top().isKind('mml')) {
return null;
}
const node = this.stack.Top().First;
this.configuration.popParser();
const latex = this.trimTex(this.string);
if (latex) {
node.attributes.set(TexConstant.Attr.LATEX, latex);
Expand Down
2 changes: 1 addition & 1 deletion ts/input/tex/base/BaseItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class LeftItem extends BaseItem {
//
// Add the middle delimiter, with empty open and close elements around it for spacing
//
const def = { stretchy: true } as any;
const def = { stretchy: true, symmetric: true } as any;
if (item.getProperty('color')) {
def.mathcolor = item.getProperty('color');
}
Expand Down
16 changes: 8 additions & 8 deletions ts/input/tex/base/BaseMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,14 +645,14 @@ const BaseMethods: { [key: string]: ParseMethod } = {
// @test Limits UnderOver
node = parser.create('node', 'msubsup');
NodeUtil.copyChildren(op, node);
op = top.Last = node;
op = top.First = node;
} else if (NodeUtil.isType(op, 'msubsup') && limits) {
// @test Limits SubSup
// node = parser.create('node', 'munderover', NodeUtil.getChildren(op), {});
// Needs to be copied, otherwise we get an error in MmlNode.appendChild!
node = parser.create('node', 'munderover');
NodeUtil.copyChildren(op, node);
op = top.Last = node;
op = top.First = node;
}
NodeUtil.setProperty(op, 'movesupsub', limits ? true : false);
NodeUtil.setProperties(NodeUtil.getCoreMO(op), { movablelimits: false });
Expand Down Expand Up @@ -2177,13 +2177,13 @@ const BaseMethods: { [key: string]: ParseMethod } = {
// @test Label Empty
return;
}
// @test Label, Ref, Ref Unknown
if (parser.tags.label) {
// @test Double Label Error
throw new TexError('MultipleCommand', 'Multiple %1', parser.currentCS);
}
parser.tags.label = label;
if (!parser.tags.refUpdate) {
// @test Label, Ref, Ref Unknown
if (parser.tags.label) {
// @test Double Label Error
throw new TexError('MultipleCommand', 'Multiple %1', parser.currentCS);
}
parser.tags.label = label;
if (
(parser.tags.allLabels[label] || parser.tags.labels[label]) &&
!parser.options['ignoreDuplicateLabels']
Expand Down
2 changes: 1 addition & 1 deletion ts/input/tex/bbox/BboxConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const BboxMethods: { [key: string]: ParseMethod } = {
height: '+' + pad,
depth: '+' + pad,
lspace: pad,
width: '+' + 2 * parseInt(match[1], 10) + match[3],
width: '+' + 2 * parseFloat(match[1]) + match[3],
};
}
} else if (part.match(/^([a-z0-9]+|#[0-9a-f]{6}|#[0-9a-f]{3})$/i)) {
Expand Down
1 change: 1 addition & 0 deletions ts/input/tex/textmacros/TextMacrosConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const TextMacrosConfiguration = Configuration.create('textmacros', {
//
const config = data.data.packageData.get('textmacros');
config.parseOptions.nodeFactory.setMmlFactory(config.jax.mmlFactory);
config.parseOptions.clear();
},
],
[ConfigurationType.OPTIONS]: {
Expand Down
3 changes: 3 additions & 0 deletions ts/ui/dialog/DraggableDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ export class DraggableDialog {
position: 'fixed',
top: '-4%',
},
'.mjx-dialog *': {
'box-sizing': 'content-box',
},
'.mjx-dialog.mjx-moving': {
cursor: 'grabbing',
},
Expand Down
15 changes: 15 additions & 0 deletions ts/ui/lazy/LazyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { HTMLHandler } from '../../handlers/html/HTMLHandler.js';
import { SpeechMathItem } from '../../a11y/speech.js';
import { handleRetriesFor } from '../../util/Retries.js';
import { OptionList } from '../../util/Options.js';
import { StyleJson } from '../../util/StyleJson.js';

/**
* Add the needed function to the window object.
Expand Down Expand Up @@ -388,6 +389,19 @@ export function LazyMathDocumentMixin<
*/
protected lazySet: LazySet = new Set();

/**
* Extra styles for lazy nodes.
*/
public static lazyStyles: StyleJson = {
'mjx-lazy': {
//
// Needed for Safari 26 when the math appears inside an othewise empty
// node with overflow: auto. See issue #3579.
//
display: 'inline-block',
},
};

/**
* Augment the MathItem class used for this MathDocument,
* then create the intersection observer and lazy list,
Expand All @@ -400,6 +414,7 @@ export function LazyMathDocumentMixin<
*/
constructor(...args: any[]) {
super(...args);
this.addStyles((this.constructor as typeof BaseClass).lazyStyles);
//
// Use the LazyMathItem for math items
//
Expand Down
16 changes: 11 additions & 5 deletions ts/ui/menu/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ export class Menu {
*/
protected document: MenuMathDocument;

protected initialized: boolean = false;

/**
* Instances of the various output jax that we can switch to
*/
Expand Down Expand Up @@ -566,6 +568,7 @@ export class Menu {
this.mergeUserSettings();
this.initMenu();
this.applySettings();
this.initialized = true;
}

/**
Expand All @@ -584,6 +587,8 @@ export class Menu {
jax.options.displayOverflow.substring(1).toLowerCase();
}
this.settings.breakInline = jax.options.linebreaks?.inline;
this.settings.brailleCode =
this.document.options.sre?.braille || this.settings.brailleCode;
this.defaultSettings = Object.assign(
{},
this.document.options.a11y,
Expand Down Expand Up @@ -936,7 +941,6 @@ export class Menu {
const menu = this.menu;
menu.settings = this.settings;
menu.findID('Settings', 'Overflow', 'Elide').disable();
menu.findID('Braille', 'ueb').hide();
menu.setJax(this.jax);
this.checkLoadableItems();
const cache: [string, string][] = [];
Expand Down Expand Up @@ -1084,6 +1088,8 @@ export class Menu {
protected applySettings() {
this.setTabOrder(this.settings.inTabOrder);
const options = this.document.options;
options.sre ||= {};
options.sre.braille = this.settings.brailleCode;
options.enableAssistiveMml = this.settings.assistiveMml;
this.enableAccessibilityItems('Speech', this.settings.speech);
this.enableAccessibilityItems('Braille', this.settings.braille);
Expand All @@ -1108,7 +1114,7 @@ export class Menu {
*/
protected setOverflow(overflow: string) {
this.document.outputJax.options.displayOverflow = overflow.toLowerCase();
if (!Menu.loading) {
if (!Menu.loading && this.initialized) {
this.document.rerenderPromise();
}
}
Expand All @@ -1118,7 +1124,7 @@ export class Menu {
*/
protected setInlineBreaks(breaks: boolean) {
this.document.outputJax.options.linebreaks.inline = breaks;
if (!Menu.loading) {
if (!Menu.loading && this.initialized) {
this.document.rerenderPromise();
}
}
Expand All @@ -1128,7 +1134,7 @@ export class Menu {
*/
protected setScale(scale: string) {
this.document.outputJax.options.scale = parseFloat(scale);
if (!Menu.loading) {
if (!Menu.loading && this.initialized) {
this.document.rerenderPromise();
}
}
Expand Down Expand Up @@ -1322,7 +1328,7 @@ export class Menu {
}

/**
* @param {string} code The Braille code format (nemeth or euro)
* @param {string} code The Braille code format (nemeth, ueb, or euro)
*/
protected setBrailleCode(code: string) {
this.document.options.sre.braille = code;
Expand Down