Set the `translate` attribute for MathJax HTML nodes to `no`, except <mtext>
@dpvc is already working on this.
Since Aug 13, 2025.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
MathJax-rendered content is inadvertently translated during page localization. This can lead to incorrect translations of mathematical expressions or symbols, which are typically not meant to be translated. However, text within <mtext> (TeX: \text{...}) is often intended to be translatable.
Describe the solution you'd like
I suggest that MathJax nodes should have the HTML translate attribute set to no by default (or inherited from ancestor nodes). This would ensure that mathematical content is not translated during localization. However, for <mtext> the translate attribute should be set to yes or unset, allowing their content to be translated as intended.
Describe alternatives you've considered
Use SVG renderer.
Additional context
This suggestion is based on the HTML translate attribute described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate. It specifies whether an element's translatable attribute values and its Text node children should be translated when the page is localized.
I am unsure whether this issue has been raised before, as it seems like a common concern when dealing with localization of mathematical content.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.