<mi>cos</mi> treated as a multi-character identifier<mi> are treated as identifiers. The TeX input jax places multi-letter sequences into a single <mi> element within macros such as \mathrm, \mathbf, and related commands. This behavior is configurable, but by default it applies to letter sequences.<mi>cos</mi> renders the text in italics as a variable name rather than as a function operator.<mi>cos</mi> with <mo>cos</mo> throughout the XML.


<mi>cos</mi> with <mo>cos</mo>, the rendering in version 4.1.1 appears correct 

In the existing code, <mo>cos</mo> is immediately followed by <mrow> without the invisible function-application operator ⁡. MathJax 4 appears to be stricter regarding this spacing.
To address this, we added <mo>⁡</mo> (invisible function apply) after each cos.




Issue 1 —<mi>cos</mi>treated as a multi-character identifierIn MathJax 4, multi-letter sequences inside<mi>are treated as identifiers. The TeX input jax places multi-letter sequences into a single<mi>element within macros such as\mathrm,\mathbf, and related commands. This behavior is configurable, but by default it applies to letter sequences.Because of this change, using<mi>cos</mi>renders the text in italics as a variable name rather than as a function operator.

To correct the rendering, we replaced<mi>cos</mi>with<mo>cos</mo>throughout the XML.
Issue 2 — Missing <mo> function-apply separator (invisible character)In the existing code, <mo>cos</mo> is immediately followed by <mrow> without the invisible function-application operator ⁡. MathJax 4 appears to be stricter regarding this spacing.
<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>cos</mo><mrow><mi>ω</mi><mi>t</mi></mrow></math>
Issue 3 — Underscore symbol alignment
In MathJax 3.1.2, the underscore/underline renders correctly and is properly aligned under the character. ... However, in MathJax 4.1.1, the underscore appears slightly left-aligned compared to the base character.
Could you please confirm:
Whether these changes are expected behavior in MathJax 4.1.1.
Hi Davide,
Thanks for your feedback.
Please check the attached implementation screenshot for MathJax 4.x.
Also, we are not injecting any CSS from MathJax in our implementation.
We are comparing the results using the https://www.mathjax.org/#demo link. We copied the original MathML code from the equation rendered in OnProof and pasted the same code into the MathJax demo site.The same issue/error appears there as well.
Test link: Please check below. (Only the equations for which issues were reported via email are included in the link below.)
https://qaops2editor.pubmate.co.in/#/?templateID=5fd5e790c0274a93b6b9cd413887e64e071609633
Environment details:
OS: Windows 11
Browser used for rendering: Google Chrome Version 145.0.7632.160 (Official Build) (64-bit)
Please let us know if you need any additional information.
Best regards,
Akhil Joshi
mjx-c.mjx-c332.NCM-SO {margin-left: 0;}
we are not injecting any CSS from MathJax in our implementation.
We copied the original MathML code from the equation rendered in OnProof and pasted the same code into the MathJax demo site
On Mar 13, 2026, at 3:23 AM, akhil joshi <akkijo...@gmail.com> wrote:
Hi Davide,
Thanks for your feedback.
Please check the attached implementation screenshot for MathJax 4.x.
Also, we are not injecting any CSS from MathJax in our implementation.
We are comparing the results using the https://www.mathjax.org/#demo link. We copied the original MathML code from the equation rendered in OnProof and pasted the same code into the MathJax demo site.The same issue/error appears there as well.
Test link: Please check below. (Only the equations for which issues were reported via email are included in the link below.)
https://qaops2editor.pubmate.co.in/#/?templateID=5fd5e790c0274a93b6b9cd413887e64e071609633Environment details:
OS: Windows 11
Browser used for rendering: Google Chrome Version 145.0.7632.160 (Official Build) (64-bit)
Please let us know if you need any additional information.
Best regards,
Akhil Joshi
On Thursday, March 12, 2026 at 9:02:18 PM UTC+5:30 Davide Cervone wrote:
Issue 1 — <mi>cos</mi> treated as a multi-character identifierIn MathJax 4, multi-letter sequences inside <mi> are treated as identifiers. The TeX input jax places multi-letter sequences into a single <mi> element within macros such as \mathrm, \mathbf, and related commands. This behavior is configurable, but by default it applies to letter sequences.Because of this change, using <mi>cos</mi> renders the text in italics as a variable name rather than as a function operator.
Your observation is incorrect. In MathML, multi-letter identifiers are rendered in the upright font, not italics. E.g.renders as
<PastedGraphic-1.png>in v4.1.1. This has not changed in v4. Even your 4.1.1 rendering shows the cosine in an upright font:
<PastedGraphic-2.png>I'm wondering if the CSS on your page may be interfering with MathJax's output. You don't give the MathJax configuration you are using or the MathJax component you are loading (e.g., mml-chtml.js), so it is hard to test without making assumptions.The issue you don't discuss is the red "mfrac", which indicates a problem with that fraction's MathML structure. Often that means the number of children is incorrect. Using the MathJax contextual menu to Show Math As the MathML Code should an attribute on on <merror> element for the mfrac that shows the actual error message. It would help to see what that is.The equation you provided in the first image in your summary section renders properly for me in v4.1.1:
<mjx-4.1.1.png>so I'm wondering if the MathML is actually the same as the MathML in your v4.1.1 test. (Perhaps it was actually the result of your trying to replace the cosines with <mo> elements, but something has gone wrong?) Can you provide a link to a page that actually exhibits the problem?
To correct the rendering, we replaced <mi>cos</mi> with <mo>cos</mo> throughout the XML.That should not be necessary, as shown in my image above. If this is making a difference for you, then again I wonder about CSS that might be affecting the result.Issue 2 — Missing <mo> function-apply separator (invisible character)In the existing code, <mo>cos</mo> is immediately followed by <mrow> without the invisible function-application operator ⁡. MathJax 4 appears to be stricter regarding this spacing.
This is not true. For example,<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>cos</mo><mrow><mi>ω</mi><mi>t</mi></mrow></math>produces
<PastedGraphic-3.png>which has the proper spacing after the "cos". Here is your equation with the <mo>cos</mi> replaced by <mo>cos</mo> without additional invisible function-apply:
<PastedGraphic-4.png>The spacing of the cosines is correct without the U+2061 characters.
Issue 3 — Underscore symbol alignment
In MathJax 3.1.2, the underscore/underline renders correctly and is properly aligned under the character. ... However, in MathJax 4.1.1, the underscore appears slightly left-aligned compared to the base character.I am not able to reproduce the issue you are seeing. Here is the expression rendered in v4.1.1 for me:
<PastedGraphic-5.png>Again, without more information about your setup,. it is hard to diagnose the problem. What OS and browser (and versions) are you using? If you remove (or disable) the CSS from your page, does that make a difference?
Could you please confirm:
Whether these changes are expected behavior in MathJax 4.1.1.No they are not, and I am not able to produce any of the issues you are seeing.If you can provide a test page that illustrates the problems, I can investigate further.Davide
--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/f8d306ad-26fa-4a26-baff-95ff86c0ecc2n%40googlegroups.com.
<sc2.png><sc3.png><sc4.png><sc1.png><PastedGraphic-1.png><PastedGraphic-2.png><mjx-4.1.1.png><PastedGraphic-3.png><PastedGraphic-4.png><PastedGraphic-5.png>
Impact on our workflow
When a user clicks on an equation, it opens in our editor (iMathEQ).
The editor expects a clean structure and displays editable placeholders (blank boxes).
Due to the additional invisible operator nodes, extra placeholders/boxes are appearing inside the equation.
This behavior was not present in MathJax 3.1.2.
Clarification needed
We would like your guidance on the following:
Is the insertion of the invisible multiplication operator (⁢) part of semantic enrichment?
Is there a way to prevent these additional nodes from being inserted during rendering?
Would disabling semantic enrichment fully prevent such modifications to the DOM structure?
Is there a recommended approach for integrating MathJax-rendered output with equation editors, without introducing extra structural elements?
Issue 1: Multi-character identifiers (e.g., <mi>cos</mi>) and Issue 2: Semantic enrichment breaking <mfrac>In MathJax 4, expressions like <mi>cos</mi> are treated as multi-character identifiers and rendered in italics (as variables), rather than as function operators.
We also encountered an issue where semantic enrichment inserts an invisible multiplication operator (<mo>⁢</mo>) inside an <mfrac>, resulting in an invalid structure and a rendering error.
Is it expected that developers should preprocess MathML (e.g., converting <mi>cos</mi> to <mo>cos</mo>) when using MathJax 4?
Is there a recommended configuration to automatically treat common function names (sin, cos, log, etc.) as operators instead of identifiers?
Regarding the <mfrac> issue:
Is this a known limitation/bug in semantic enrichment?
Are there plans for MathJax to handle correct placement of invisible operators automatically?
Is there a way to safely enable accessibility features without risking structural issues in MathML?
Overall, what is the recommended approach to avoid manual intervention for these cases?
MathJax = {loader: {'a11y/semantic-enrich': {ready() {for (const item of MathJax.startup.extensions.items) {if (item.item.toString().match(/allowHtmlInTokenNodes/)) {const {MathML} = MathJax._.input.mathml_ts;const {EnrichHandler} = MathJax._.a11y['semantic-enrich'];const Mml = new MathML({allowHtmlInTokenNodes: true});item.item = (handler) => EnrichHandler(handler, Mml);Mml.mmlFilters.add(({data}) => {const nodes = data.querySelectorAll('mfrac > mo[data-semantic-added]');for (const node of nodes) {const mfrac = node.parentNode;mfrac.parentNode.insertBefore(node, mfrac);}});break;}}}}}};
2) undersscore aligmnet issue :Additionally, regarding the underline alignment issue (U+0332), we are currently using the suggested CSS workaround:mjx-c.mjx-c332.NCM-SO {
margin-left: 0;
}We would like to confirm:
Is this considered a safe and recommended workaround for production use?
Are the class names (e.g., .mjx-c332, .NCM-SO) stable across versions?
Is there a plan to address this issue within MathJax itself to avoid the need for custom CSS?
3) Extra invisible operator nodes affecting equation editing in MathJax v4
for e.g. <mjx-mo data-semantic-type="operator" data-semantic-role="multiplication" data-semantic-annotation="depth:9" data-semantic-id="77" data-semantic-parent="78" data-semantic-added="true" data-semantic-operator="infixop," data-semantic-level-number="8" data-speech-node="true"><mjx-c class="mjx-c2062"></mjx-c></mjx-mo>
(resonse from your side for third issue) I'm not sure what issue the third equation in your test page is intended to show. It seems to work as expected for me.
Check the attached images for the 3.1.2 which no boxes while editing and second one is for boxes showing inside equations
when user makes any changes the extra entity is added in out xml which not present in first time i have attached those screenshot also.
Impact on our workflow
When a user clicks on an equation, it opens in our editor (iMathEQ).
The editor expects a clean structure and displays editable placeholders (blank boxes).
Due to the additional invisible operator nodes, extra placeholders/boxes are appearing inside the equation.
This behavior was not present in MathJax 3.1.2.
Clarification needed
We would like your guidance on the following:
Is the insertion of the invisible multiplication operator (⁢) part of semantic enrichment?
Is there a way to prevent these additional nodes from being inserted during rendering?
Would disabling semantic enrichment fully prevent such modifications to the DOM structure?
Is there a recommended approach for integrating MathJax-rendered output with equation editors, without introducing extra structural elements?
Our concern is avoiding fragile fixes that may break with future updates.
Hi Davide,
Thanks for the suggestion — using an mmlFilter to move the extra nodes works well.
Initially, the provided configuration didn’t work in my setup, but after making a few adjustments on my side, I was able to get it working.
I’m sharing the updated code along with links where the earlier <mfrac> issue was occurring. With the current implementation, the issue no longer appears.
Could you please take a look and confirm whether this approach is safe for production use?
Updated Code :
Test Link : https://qaops2editor.pubmate.co.in/#/?templateID=0abf977f959d4a49a63bf97a29c8f8fe124051050
Thanks again for your help!
Could you please take a look and confirm whether this approach is safe for production use?