Skip to content

LaTeX writer: menclose notations, letterlike symbols and MTEF angle brackets - #28

Open
simonebortolin wants to merge 1 commit into
mainfrom
claude/elastic-swanson-a662e4
Open

simonebortolin wants to merge 1 commit into
mainfrom
claude/elastic-swanson-a662e4

Conversation

@simonebortolin

Copy link
Copy Markdown
Owner

Fixes the standard LaTeX written for equations that come from MathType (MTEF) objects, found through NPOI's equations-ole-all.doc.

Old → new (standard LaTeX)

Case Old New
menclose notation="horizontalstrike" \boxed{a} \sout{a} (ulem, KaTeX)
longdiv \boxed{a} \enclose{longdiv}{a} (MathJax)
radical \boxed{x} \sqrt{x}
circle, roundedbox, actuarial, left, right, verticalstrike, madruwb, combinations \boxed{…} \enclose{<notations, comma-separated>}{…}
box, no notation, the four sides \boxed unchanged
ℓ from MTEF \mathcal{l} \ell
℘ from MTEF \mathcal{P} \wp
ℑ / ℜ \mathfrak{I} / \mathfrak{R} \Im / \Re
function names Re / Im \Re / \Im \operatorname{Re} / \operatorname{Im}
〈 〉 (U+2329/U+232A, U+3008/U+3009) around tall content \langle\frac{a}{b}\rangle \left\langle\frac{a}{b}\right\rangle

Notes

  • The reader reads \sout, \hcancel and \enclose{notation}[attributes]{body} back, and \Re/\Im as the symbols ℜ/ℑ (their LaTeX meaning) instead of function names.
  • ℓ and ℘ were wrong in mtef2mml.xsl: 0x2113 was mapped to a script l, and a duplicate 0x2118 template produced 𝒫.
  • Word's LaTeX flavor keeps the mapping of UnicodeMathML's TeX.js (its corpus expects \boxed for these notations).
  • Test data: seven "Equation Native" streams of NPOI's equations-ole-all.doc in tests/data/mtef/npoi/ (provenance in tests/data/README.md).
  • Known gap, pre-existing: the LaTeX of the nested-fences paragraph (\langle around \left|…\right|) does not read back; its test checks only the output.
  • VersionPrefix 1.0.6, the same as Bump version prefix to 1.0.6 #26.

All 6848 tests pass (net10.0 and net481), also on a trial merge with the current main.

🤖 Generated with Claude Code

…rackets

- menclose in standard LaTeX: horizontalstrike as \sout (ulem, KaTeX), radical as \sqrt,
  the notations without a command (longdiv, roundedbox, circle, actuarial, left, right,
  verticalstrike, madruwb, combinations) as \enclose of MathJax instead of \boxed;
  no notation and the four sides stay \boxed. Word's LaTeX keeps TeX.js's mapping.
- The reader reads \sout, \hcancel and \enclose{notation}[attributes]{body} back.
- Letterlike symbols with a command win over the math alphanumerics: ℑ \Im, ℜ \Re;
  the reader reads \Re and \Im as ℜ and ℑ, and the function names Re and Im are
  written as \operatorname{Re} and \operatorname{Im}.
- 〈 〉 (U+2329/U+232A, as MTEF writes them) and U+3008/U+3009 grow with \left and \right
  around tall content, as ⟨ ⟩ do.
- mtef2mml.xsl: MTEF ℓ (0x2113) is ℓ, not a script l, and a duplicate template no longer
  turns ℘ (0x2118) into 𝒫.
- Tests from MathML, LaTeX and the MathType objects of NPOI's equations-ole-all.doc.

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

Copy link
Copy Markdown

Pre-release 1.0.6-pr.28.69 is ready: https://github.com/simonebortolin/SharpEquations/releases/tag/pr-28-69-1

NuGet package of 727a2ad. Updated on every push, deleted when this PR is closed.

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