Skip to content

Canonicalize combining arrow accents to the spacing arrows - #1067

Draft
antocreadev wants to merge 1 commit into
daisy:mainfrom
antocreadev:fix/combining-arrow-accent
Draft

antocreadev wants to merge 1 commit into
daisy:mainfrom
antocreadev:fix/combining-arrow-accent

Conversation

@antocreadev

Copy link
Copy Markdown

Fixes #1065

AI summary (this description and the change were written with Claude Code)

Problem. KaTeX and math-core write \vec{F} with U+20D7 (COMBINING RIGHT ARROW ABOVE) as the accent:
<mover accent="true"><mi>F</mi><mo stretchy="false">&#x20D7;</mo></mover>. MathCAT did not see it as a vector:
en/ClearSpeak said "cap f with right arrow above embellishment above", fr said "f majuscule avec U diacritique flèche vers la droite en chef au-dessus", and Nemeth, UEB and French braille spelled out the character code. The same MathML with U+2192 (what MathJax generates) gives "vector cap f".

Cause. canonicalize_mo_text already maps combining diacriticals used as mover/munder/munderover scripts to their spacing forms (U+0302 → ^, U+0304 → ¯, U+0307 → U+02D9, U+0308 → ¨), but not the combining arrows, so the vector intent rule (.='→' or .='⇀') never matched.

Fix. Five more arms in that same match (one line each, no new code path):

combining becomes
U+20D7 ⃗ U+2192 →
U+20D6 ⃖ U+2190 ←
U+20E1 ⃡ U+2194 ↔
U+20D1 ⃑ U+21C0 ⇀ (also read as a vector)
U+20D0 ⃐ U+21BC ↼

Every language and braille code then uses its existing rules for the spacing arrows. LaTeX/ASCIIMath braille output also improves (\overset{\vec}{F} → \vec{F}).

Tests added (all failed before the fix):

  • canonicalize::combining_arrows_1065 (mover and munder)
  • en ClearSpeak vector_combining_arrow, combining_arrows_over; en SimpleSpeak vector_combining_arrow
  • fr ClearSpeak and SimpleSpeak vector_combining_arrow
  • braille Nemeth, UEB and French vector_combining_arrow
  • non-regression: en ClearSpeak vector_right_arrow (U+2192, already passing)

Changed expected outputs (zh-cn). tests/Languages/zh/cn/unicode/unicode_full.rs tested the old readings of U+20D0, U+20D1, U+20D6, U+20D7 and U+20E1 over v (e.g. "v 上加向右箭头"). They now expect the readings zh-cn already gives the spacing arrows, e.g. "向量 v" for U+20D7 and U+20D1, "v 上方有 向左箭头" for U+20D6. A zh-cn reviewer may want to check these.

Not changed: U+0303 (combining tilde) has the same problem in en/fr/braille ("cap f with tilde embellishment above"), but zh-cn has a dedicated tilde-modified-variable rule and a test for it ("z 上加波浪线"), so I left it for a separate issue. U+0306, U+030C, U+20DB and U+20DC are matched directly by the modified-var intent rule and are left alone.

How to verify: cargo test (default and --features no-unsafe) and cargo clippy (both feature sets, RUSTFLAGS=-Dwarnings) pass locally on macOS. The fuzz smoke run was not run locally.

🤖 Generated with Claude Code

KaTeX and math-core write \vec{F} as
<mover accent="true"><mi>F</mi><mo>&#x20D7;</mo></mover>, with U+20D7
COMBINING RIGHT ARROW ABOVE as the accent. canonicalize_mo_text already
maps combining diacriticals in mover/munder/munderover scripts to their
spacing forms (U+0302 -> ^, U+0304 -> ¯, ...), but not the combining
arrows, so the vector rule (which looks for U+2192 or U+21C0) did not
match: en read "cap f with right arrow above embellishment above" and
Nemeth, UEB and French braille spelled out the character code.

U+20D0, U+20D1, U+20D6, U+20D7 and U+20E1 now become U+21BC, U+21C0,
U+2190, U+2192 and U+2194, so every language and braille code reads them
like the spacing arrows that MathJax generates (en: "vector cap f").

zh-cn had tests for the old readings of these five characters in a
mover; they now expect the readings zh-cn already gives the spacing
arrows (U+20D7 and U+20D1 over v: "向量 v").

Fixes daisy#1065

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

U+20D7 (combining right arrow) as accent is not read as a vector arrow (KaTeX / math-core \vec output)

1 participant