mathjax / mathjax/MathJax

Directionality of text is not respected in MathML output

Open
#3,594 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request v4
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Issue Summary

dir attribute can be used to change the text direction even on individual MathML elements. MathJax does not respect this in rendering.

MathJax 4 output:
Equation that should be read from right to left is rendered right to left.

Expected output (Firefox's native):
Equation correctly read from right to left.

OS: Windows 11
Browser: Mozilla Firefox 153.0

Steps to Reproduce:

Render the code:

<math xmlns="http://www.w3.org/1998/Math/MathML" dir="rtl">
  <mi>n</mi>
  <mo>=</mo>
  <mfrac>
    <mrow>
      <mn>1</mn>
      <mo>+</mo>
      <msqrt>
        <mn>5</mn>
      </msqrt>
    </mrow>
    <mn>2</mn>
  </mfrac>
</math>

Attribute dir="rtl" should make so that the text direction changes.

Technical details:
  • MathJax Version: 4
  • OS: Windows 11
  • Browser: Mozilla Firefox 153.0

I am using the default following MathJax configuration and and loading MathJax via

<script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js" defer></script>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the provided MathML example through tex-mml-chtml.js and compare the MathJax output with Firefox's native rendering. Trace how the MathML dir attribute is handled during output generation, then verify that dir="rtl" on an individual MathML element changes the rendered direction and add regression coverage for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.