Skip to content

Fix invalid LaTeX macros for mu, nu, tau, and down-arrow in equation conversion - #2228

Merged
afourney merged 3 commits into
microsoft:mainfrom
ksprajapatii:fix/latex-dict-typos
Jul 21, 2026
Merged

Fix invalid LaTeX macros for mu, nu, tau, and down-arrow in equation conversion#2228
afourney merged 3 commits into
microsoft:mainfrom
ksprajapatii:fix/latex-dict-typos

Conversation

@ksprajapatii

Copy link
Copy Markdown
Contributor

What

Fixes typo'd LaTeX macros in converter_utils/docx/math/latex_dict.py
that produced invalid LaTeX output when converting Word equations
containing certain symbols.

Bugs fixed

  • \m\mu (U+1D707, mathematical italic mu)
  • \n\nu (U+1D708, mathematical italic nu)
  • \ta\tau (U+1D70F, mathematical italic tau)
  • \downright\downarrow (U+2193, downwards arrow)

\m, \n, \ta, and \downright are not valid LaTeX commands. Any
.docx file with an equation containing μ, ν, τ, or ↓ would produce
broken/invalid LaTeX in the converted markdown output.

How I found it

Ran ruff static analysis over the codebase, which flagged a
duplicate dict key warning near these entries. Manual review of the
surrounding Unicode-to-LaTeX mappings revealed the typos.

Testing

  • Verified the corrected dict values directly:
    T['\U0001d707'] == '\\mu ', etc.
  • Existing test_docx_equations test in test_module_misc.py still
    passes.
  • Added a small regression test to catch these mappings from
    regressing in future.

@ksprajapatii

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@afourney
afourney merged commit db144c4 into microsoft:main Jul 21, 2026
3 checks passed
@afourney

Copy link
Copy Markdown
Member

Merged! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants