Skip to content

LaTeX reader: the operator names of amsmath (\lg, \liminf, \varinjlim, \operatorname*) - #27

Merged
simonebortolin merged 3 commits into
mainfrom
claude/latex-op-names
Nov 9, 2026
Merged

simonebortolin merged 3 commits into
mainfrom
claude/latex-op-names

Conversation

@simonebortolin

Copy link
Copy Markdown
Owner

Reads the last ids of NotReadYet in Latex2MathMLCorpusTests (lg, liminf, limsup, injlim, projlim, varinjlim, operatornamewithlimits, operatorname-star). NotReadYet is now empty.

Note: #22 covers the same ids with different choices (U+2006, \varinjlim as inj lim, msub in display, no snapshot corrections). Only one of the two can land without conflicts.

  • \lg is a function name like \log.
  • A name UnicodeMath does not know, with the function apply sign and scripts but nothing to apply it to (argmax⁡_𝑥, argmax⁡┬𝑥), reads as the name with its scripts, not as its letters. This is two added alternatives in UnicodeMathGrammar.parlot.cs.
    • A lone lg⁡ or lim inf⁡ reads as main reads NaN⁡: one name, with the sign after it.
    • The UnicodeMath writer writes the sign after such a name when nothing follows it, so it reads back.
    • Names UnicodeMath knows (lim⁡, lim⁡_(a→∞)) keep the reading of UnicodeMathML; the 738 examples still pass.
  • \liminf, \limsup, \injlim, \projlim read as one name with the thin space of TeX (lim inf). UnicodeMath reads it like lim, and the LaTeX writer writes it back as \liminf…
  • \varinjlim and \varprojlim are lim with an arrow under it, as amsmath draws them, and are written back as such. \varliminf and \varlimsup are lim underlined and overlined.
  • In a display equation, the limits go under the name for \operatorname*, \operatornamewithlimits, the names above and \lim, also with nothing after it.
    • Side effect: \lim^2_x f puts the 2 over lim and the x under it, as TeX does. The MathML then has no ⁡ before f; it still reads back the same.
  • Seven latex2mathml snapshots are corrected, with a sentence in tests/data/README.md: liminf, limsup, injlim, projlim, varinjlim, operatorname-star, operatornamewithlimits.
  • The unknown-command tests use \tr and \Var instead of \lg and \liminf.

Tests: new ReadsOperatorNamesOfAmsmath (17 cases, inline and display). It checks the MathML and that the LaTeX and the UnicodeMath written for each case read back to the same equation. Full suite: 6792/6792 on net10.0 and net481. VersionPrefix is unchanged.

Not covered: \varinjlim_{i} A_i reads correctly, but the UnicodeMath writer still cannot write that nested munder, as before this change.

🤖 Generated with Claude Code

simonebortolin and others added 3 commits November 9, 2026 19:29
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, \operatorname*)

- \lg is a function name like \log
- a name that UnicodeMath does not know, with the function apply sign and
  scripts but nothing to apply it to (argmax⁡_𝑥, argmax⁡┬𝑥), is the name
  with its scripts, not its letters; so is a lone lg⁡ or lim inf⁡, as main
  reads NaN⁡; the UnicodeMath writer writes the sign after such a name
  when nothing follows it, so that it reads back
- \liminf, \limsup, \injlim, \projlim: one name with the thin space of TeX
  (lim inf), which UnicodeMath reads like lim and the LaTeX writer writes
  back as \liminf...
- \varinjlim and \varprojlim: lim with an arrow under it, written back as
  such; \varliminf and \varlimsup: lim underlined and overlined
- the limits of \operatorname*, \operatornamewithlimits, the names above
  and \lim go under them in a display equation, also with nothing after
- seven latex2mathml snapshots corrected (tests/data/README.md), the ids
  out of NotReadYet, regression cases in ReadsOperatorNamesOfAmsmath; the
  ids b6eeafc reads out of the lists main kept them in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
\lg and \liminf are known now: the tests of unknown control words use \tr
and \Var instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonebortolin
simonebortolin merged commit 1740603 into main Nov 9, 2026
10 checks passed
@simonebortolin
simonebortolin deleted the claude/latex-op-names branch November 9, 2026 23:05
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Pre-release 1.0.5-pr.27.67 is ready: https://github.com/simonebortolin/SharpEquations/releases/tag/pr-27-67-1

NuGet package of 8136a02. Updated on every push, deleted when this PR is closed.

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