Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions components/mjs/input/tex/extensions/fontsizev3/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"build": {
"id": "[tex]/fontsizev3",
"component": "input/tex/extensions/fontsizev3",
"targets": ["input/tex/fontsizev3"]
},
"webpack": {
"name": "input/tex/extensions/fontsizev3",
"libs": [
"components/src/input/tex-base/lib",
"components/src/core/lib"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './lib/fontsizev3.js';
1 change: 1 addition & 0 deletions components/mjs/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const source = {
'[tex]/empheq': `${src}/input/tex/extensions/empheq/empheq.js`,
'[tex]/enclose': `${src}/input/tex/extensions/enclose/enclose.js`,
'[tex]/extpfeil': `${src}/input/tex/extensions/extpfeil/extpfeil.js`,
'[tex]/fontsizev3': `${src}/input/tex/extensions/fontsizev3/fontsizev3.js`,
'[tex]/gensymb': `${src}/input/tex/extensions/gensymb/gensymb.js`,
'[tex]/html': `${src}/input/tex/extensions/html/html.js`,
'[tex]/mathtools': `${src}/input/tex/extensions/mathtools/mathtools.js`,
Expand Down
18 changes: 9 additions & 9 deletions testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7657,53 +7657,53 @@ exports[`Roots Tweaked Root 1`] = `

exports[`Setting sizes Empty 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\Huge" display="block">
<mstyle mathsize="2.49em" data-latex="\\Huge"></mstyle>
<mstyle mathsize="2.074em" data-latex="\\Huge"></mstyle>
</math>"
`;

exports[`Setting sizes Huge 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\Huge a" display="block">
<mstyle mathsize="2.49em" data-latex="\\Huge a">
<mstyle mathsize="2.074em" data-latex="\\Huge a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes LARGE 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\LARGE a" display="block">
<mstyle mathsize="1.73em" data-latex="\\LARGE a">
<mstyle mathsize="1.44em" data-latex="\\LARGE a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes Large 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\Large a" display="block">
<mstyle mathsize="1.44em" data-latex="\\Large a">
<mstyle mathsize="1.2em" data-latex="\\Large a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes Tiny 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\Tiny a" display="block">
<mstyle mathsize="0.6em" data-latex="\\Tiny a">
<mstyle mathsize="0.5em" data-latex="\\Tiny a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes huge 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\huge a" display="block">
<mstyle mathsize="2.07em" data-latex="\\huge a">
<mstyle mathsize="1.728em" data-latex="\\huge a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes large 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\large a" display="block">
<mstyle mathsize="1.2em" data-latex="\\large a">
<mstyle mathsize="1.095em" data-latex="\\large a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
Expand All @@ -7727,15 +7727,15 @@ exports[`Setting sizes scriptsize 1`] = `

exports[`Setting sizes small 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\small a" display="block">
<mstyle mathsize="0.85em" data-latex="\\small a">
<mstyle mathsize="0.9em" data-latex="\\small a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
`;

exports[`Setting sizes tiny 1`] = `
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\tiny a" display="block">
<mstyle mathsize="0.5em" data-latex="\\tiny a">
<mstyle mathsize="0.6em" data-latex="\\tiny a">
<mi data-latex="a">a</mi>
</mstyle>
</math>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3901,7 +3901,7 @@ exports[`Mathtools Symbols Other 1`] = `
</mrow>
<munder data-latex="\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}_n">
<mrow data-mjx-texclass="OP" data-latex="\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}">
<mstyle mathsize="1.44em" data-latex="\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em">
<mstyle mathsize="1.2em" data-latex="\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em">
<mspace width="-.1em" linebreak="nobreak" data-latex="\\kern-.1em"></mspace>
<mo data-latex="\\boldsymbol{\\times}" mathvariant="bold">&#xD7;</mo>
<mspace width="-.1em" linebreak="nobreak" data-latex="\\kern-.1em"></mspace>
Expand Down
20 changes: 12 additions & 8 deletions ts/input/tex/base/BaseMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,16 +452,20 @@ new sm.CommandMap('macros', {
textsf: [BaseMethods.HBox, null, VARIANT.SANSSERIF],
texttt: [BaseMethods.HBox, null, VARIANT.MONOSPACE],

tiny: [BaseMethods.SetSize, 0.5],
Tiny: [BaseMethods.SetSize, 0.6], // non-standard
Tiny: [BaseMethods.SetSize, 0.5],
tiny: [BaseMethods.SetSize, 0.6],
scriptsize: [BaseMethods.SetSize, 0.7],
small: [BaseMethods.SetSize, 0.85],
SMALL: [BaseMethods.SetSize, 0.7],
Small: [BaseMethods.SetSize, 0.8],
footnotesize: [BaseMethods.SetSize, 0.8],
small: [BaseMethods.SetSize, 0.9],
normalsize: [BaseMethods.SetSize, 1.0],
large: [BaseMethods.SetSize, 1.2],
Large: [BaseMethods.SetSize, 1.44],
LARGE: [BaseMethods.SetSize, 1.73],
huge: [BaseMethods.SetSize, 2.07],
Huge: [BaseMethods.SetSize, 2.49],
large: [BaseMethods.SetSize, 1.095],
Large: [BaseMethods.SetSize, 1.2],
LARGE: [BaseMethods.SetSize, 1.44],
huge: [BaseMethods.SetSize, 1.728],
Huge: [BaseMethods.SetSize, 2.074],
HUGE: [BaseMethods.SetSize, 2.49],

arcsin: BaseMethods.NamedFn,
arccos: BaseMethods.NamedFn,
Expand Down
44 changes: 44 additions & 0 deletions ts/input/tex/fontsizev3/FontSizeV3Configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*************************************************************
*
* Copyright (c) 2026 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file Configuration file for the v3-compatible font size macros (\large, etc.)
*
* @author dpvc@mathjax.org (Davide P. Cervone)
*/

import { HandlerType, ConfigurationType } from '../HandlerTypes.js';
import { CommandMap } from '../TokenMap.js';
import { Configuration } from '../Configuration.js';
import BaseMethods from '../base/BaseMethods.js';

new CommandMap('fontsizev3-macros', {
tiny: [BaseMethods.SetSize, 0.5], // // should have been .6
Tiny: [BaseMethods.SetSize, 0.6], // // should have been .5
scriptsize: [BaseMethods.SetSize, 0.7],
small: [BaseMethods.SetSize, 0.85], // // should have been .9
normalsize: [BaseMethods.SetSize, 1.0],
large: [BaseMethods.SetSize, 1.2], // // should have been 1.095
Large: [BaseMethods.SetSize, 1.44], // // should have been 1.2
LARGE: [BaseMethods.SetSize, 1.73], // // should have been 1.44
huge: [BaseMethods.SetSize, 2.07], // // should have been 1.728
Huge: [BaseMethods.SetSize, 2.49], // // should have been 2.074
});

export const FontSizeV3Configuration = Configuration.create('fontsizev3', {
[ConfigurationType.HANDLER]: { [HandlerType.MACRO]: ['fontsizev3-macros'] },
});
Loading