Question on mfenced to mrow conversion in MathJax v4

20 views
Skip to first unread message

akhil joshi

unread,
Mar 18, 2026, 12:44:21 AMMar 18
to mathja...@googlegroups.com

Hi MathJax Team,

We are migrating from MathJax 3.1.2 to 4.1.1 and observed that <mfenced> elements in our input MathML are rendered differently.

In MathJax 3.x, <mfenced> resulted in <mjx-mfenced> in the output. However, in MathJax 4.1.1, the same input is converted into <mjx-mrow> with data-semantic-type="fenced".

This change affects our pipeline, as we currently rely on the rendered structure for downstream processing and comparison.

Screenshot for more information:

version 3.x

image.png

version 4.x

image.png

 

Input xml received :

image.png

 

out xml received :

image.png

We would like to clarify the following:

  1. Is there any way to prevent <mfenced> from being converted to <mrow> in MathJax v4?
  1. Is this transformation related to semantic enrichment, or is it part of the core rendering process?
  1. What is the recommended approach for maintaining structural consistency when migrating from v3 to v4?

We understand that MathJax output is primarily intended for rendering, but we would appreciate guidance on handling this use case.

Thank you for your support.

Thanks & Regards,

Akhil Joshi



Davide Cervone

unread,
Mar 18, 2026, 5:46:55 PM (13 days ago) Mar 18
to mathja...@googlegroups.com
We are migrating from MathJax 3.1.2 to 4.1.1 and observed that <mfenced> elements in our input MathML are rendered differently.
In MathJax 3.x, <mfenced> resulted in <mjx-mfenced> in the output. However, in MathJax 4.1.1, the same input is converted into <mjx-mrow> with data-semantic-type="fenced".

The semantic enrichment converts the <mfenced> element into an equivalent <mrow> with <mo> elements for the delimiters and separators.  That is necessary in order for the expression explorer to work properly.  In v4, the semantic enrichment is on by default, but in v3, semantic enrichment is not on by default, otherwise you would have seen the same thing there.

We would like to clarify the following:
  1. Is there any way to prevent <mfenced> from being converted to <mrow> in MathJax v4?

Only by turning off the semantic enrichment, which will disable MathJax's speech/Braille generation and expression explorer.

  1. Is this transformation related to semantic enrichment, or is it part of the core rendering process?

It is from the semantic enrichment.

  1. What is the recommended approach for maintaining structural consistency when migrating from v3 to v4?

Only turning off enrichment will do that for you.

Note, however, that <mfenced> is deprecated; for example, it is not part of MathML-Core, and you may get warnings in the browser console if you use it in some browser.

I don't see any reasonable way to retain <mfenced> elements when semantic enrichment is used in MathJax.

Davide

Reply all
Reply to author
Forward
0 new messages