diff --git a/components/mjs/input/tex/extensions/fontsizev3/config.json b/components/mjs/input/tex/extensions/fontsizev3/config.json new file mode 100644 index 000000000..9018bcc52 --- /dev/null +++ b/components/mjs/input/tex/extensions/fontsizev3/config.json @@ -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" + ] + } +} diff --git a/components/mjs/input/tex/extensions/fontsizev3/fontsizev3.js b/components/mjs/input/tex/extensions/fontsizev3/fontsizev3.js new file mode 100644 index 000000000..df1c1e582 --- /dev/null +++ b/components/mjs/input/tex/extensions/fontsizev3/fontsizev3.js @@ -0,0 +1 @@ +import './lib/fontsizev3.js'; diff --git a/components/mjs/source.js b/components/mjs/source.js index b6596c3c3..966413b69 100644 --- a/components/mjs/source.js +++ b/components/mjs/source.js @@ -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`, diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index f884f9f5f..38f44cf04 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -7657,13 +7657,13 @@ exports[`Roots Tweaked Root 1`] = ` exports[`Setting sizes Empty 1`] = ` " - + " `; exports[`Setting sizes Huge 1`] = ` " - + a " @@ -7671,7 +7671,7 @@ exports[`Setting sizes Huge 1`] = ` exports[`Setting sizes LARGE 1`] = ` " - + a " @@ -7679,7 +7679,7 @@ exports[`Setting sizes LARGE 1`] = ` exports[`Setting sizes Large 1`] = ` " - + a " @@ -7687,7 +7687,7 @@ exports[`Setting sizes Large 1`] = ` exports[`Setting sizes Tiny 1`] = ` " - + a " @@ -7695,7 +7695,7 @@ exports[`Setting sizes Tiny 1`] = ` exports[`Setting sizes huge 1`] = ` " - + a " @@ -7703,7 +7703,7 @@ exports[`Setting sizes huge 1`] = ` exports[`Setting sizes large 1`] = ` " - + a " @@ -7727,7 +7727,7 @@ exports[`Setting sizes scriptsize 1`] = ` exports[`Setting sizes small 1`] = ` " - + a " @@ -7735,7 +7735,7 @@ exports[`Setting sizes small 1`] = ` exports[`Setting sizes tiny 1`] = ` " - + a " diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index cd5d5956b..10111347d 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -3901,7 +3901,7 @@ exports[`Mathtools Symbols Other 1`] = ` - + × diff --git a/ts/input/tex/base/BaseMappings.ts b/ts/input/tex/base/BaseMappings.ts index e5bc0bb78..9ca684f77 100644 --- a/ts/input/tex/base/BaseMappings.ts +++ b/ts/input/tex/base/BaseMappings.ts @@ -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, diff --git a/ts/input/tex/fontsizev3/FontSizeV3Configuration.ts b/ts/input/tex/fontsizev3/FontSizeV3Configuration.ts new file mode 100644 index 000000000..969f54161 --- /dev/null +++ b/ts/input/tex/fontsizev3/FontSizeV3Configuration.ts @@ -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'] }, +});