Skip to content

fix: \longrightarrow, \longleftarrow and \longleftrightarrow take no argument - #3116

Open
shupphar wants to merge 1 commit into
arnog:masterfrom
shupphar:fix-long-arrows-symbols
Open

shupphar wants to merge 1 commit into
arnog:masterfrom
shupphar:fix-long-arrows-symbols

Conversation

@shupphar

Copy link
Copy Markdown

In LaTeX, \longrightarrow, \longleftarrow and \longleftrightarrow are symbols, ⟶ ⟵ ⟷, that take no argument. MathLive defined them alongside the mhchem-style extensible arrows (\xrightarrow and friends), whose label is a required argument. As a result:

  • a\longrightarrow b draws b as a label over the arrow, not after it;
  • a lone \longrightarrow is written back as \longrightarrow{}.

Fix. Remove the three from the extensible-arrow list in src/latex-commands/extensible-symbols.ts. The symbols already defined in symbols.ts (U+27F6, U+27F5, U+27F7) then apply. mhchem writes these arrows alone, as \mathrel{\longrightarrow}, so \ce reactions still render. The mhchem-only arrows (\longrightleftharpoons, \longleftrightarrows, …) keep their definitions.

Tests. A LONG ARROWS block in test/latex.test.ts checks that a\longrightarrow b serializes as written and draws ⟶ followed by b, and that \ce{A -> B} and \ce{A <=> B} still parse without errors.

Suggested changelog line: \longrightarrow, \longleftarrow and \longleftrightarrow are symbols, as in LaTeX: in a\longrightarrow b the b follows the arrow.

🤖 Generated with Claude Code

…argument

In LaTeX these are symbols. They were defined with the mhchem-style arrows
(`\xrightarrow` and friends), whose label is a required argument, so in
`a\longrightarrow b` the `b` became a label drawn over the arrow, and a lone
`\longrightarrow` was written back as `\longrightarrow{}`. Without them in that
list, the symbols already defined in symbols.ts (U+27F6, U+27F5, U+27F7) apply.
mhchem writes these arrows alone, as `\mathrel{\longrightarrow}`, so `\ce`
reactions are unaffected; the mhchem-only arrows (`\longrightleftharpoons`...)
keep their definitions.

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant