fix: correct \underleftarrow macro and map math italic h in equation conversion - #2293
Open
Guillermo Dols (gdols) wants to merge 1 commit into
Open
fix: correct \underleftarrow macro and map math italic h in equation conversion#2293Guillermo Dols (gdols) wants to merge 1 commit into
Guillermo Dols (gdols) wants to merge 1 commit into
Conversation
…conversion U+20EE COMBINING LEFT ARROW BELOW mapped to \underledtarrow, which is not a LaTeX macro -- the name is a scrambled \underleftarrow. The two neighbouring entries in the same table show the intent: U+20D6 -> \overleftarrow and U+20EF -> \underrightarrow. The template still formats, so nothing raises; the equation just ends up with an undefined control sequence. T normalizes the Mathematical Alphanumeric Symbols back to ASCII, but skipped math italic small h. That letter has no codepoint of its own: U+1D455 is permanently reserved because Unicode unifies it with U+210E PLANCK CONSTANT. Following the contiguous block left h as the only Latin letter to survive untranslated, so an equation reading h(x)=g(x) converted to "ℎ(x)=g(x)".
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small fixes in the OMML → LaTeX tables used to convert equations out of
.docx. I ran into both while auditing the symbol tables after #2228 and #2257; neither is covered by an open PR as far as I can tell.1.
U+20EEemits a macro that does not existCHRmapsU+20EE COMBINING LEFT ARROW BELOWto\underledtarrow. That is not a LaTeX macro — the name is a scrambled\underleftarrow. The two neighbouring entries in the same table make the intent clear:and
U+20D6, the "above" counterpart, is already\overleftarrow.The template is still well formed, so nothing raises and the conversion looks like it succeeded — the equation just carries an undefined control sequence that no renderer can typeset. The entry dates back to the original
dwmltable this module was adapted from.2. Math italic
his the only Latin letter left untranslatedTnormalizes the Mathematical Alphanumeric Symbols back to ASCII so equations come out as readable LaTeX. It walksU+1D434–U+1D44DforA–ZandU+1D44E–U+1D467fora–z, but math italic small h has no codepoint inside that block:U+1D455is permanently reserved, because Unicode unifies that letter withU+210E PLANCK CONSTANT. Following the contiguous range therefore skippedh, and it is the single letter of the alphabet that survives into the output.An expression written with math italic codepoints:
ℎ(x)=g(x)h(x)=g(x)Tests
Added
packages/markitdown/tests/test_docx_math_symbols.py. All five tests fail onmainand pass with this change. One of them walks the entire math italic alphabet and asserts every letter round-trips to ASCII, so a future gap in that range cannot slip back in unnoticed.The rest of the suite is unaffected, and
blackreports no changes.