Skip to content

Parse inline math spans inside text commands - #294

Open
Happypig375 wants to merge 1 commit into
masterfrom
fix/issue-205-text-inline-math
Open

Parse inline math spans inside text commands#294
Happypig375 wants to merge 1 commit into
masterfrom
fix/issue-205-text-inline-math

Conversation

@Happypig375

Copy link
Copy Markdown
Collaborator

Summary

  • let math-mode \text{...} temporarily re-enter normal inline math for balanced $...$ spans
  • preserve Roman text around the span, keep \$ literal, and restore parser mode/font state on every success and failure path
  • reject display-style $$/$$$ inside \text with an exact outer-source position instead of silently accepting an empty span
  • serialize literal dollar atoms safely without changing raw-dollar behavior outside text mode

This is intentionally a focused fix independent of the broader parser-unification work in #58.

Coverage

  • exact Collatz cases reproduction from the issue, including both \text{if $n$ ...} branches
  • semantic parse → serialize → parse equality with commands, braces, scripts, and escaped dollars
  • exact unmatched/display-delimiter source indices and parser-state restoration after failure
  • committed Skia golden showing Roman words around math-italic nested variables

Validation

  • Core and Rendering Release builds: passed (0 warnings/errors)
  • complete LaTeXParserTest: 295/295 passed
  • complete SkiaSharp MathDisplay: 93/93 passed
  • scoped formatting verification: passed
  • git diff --check: passed
  • senior review: approved
  • no public API changes

Fixes #205

@Happypig375 Happypig375 added Type/Bug A reproducible defect in CSharpMath. Area/Parsing LaTeX tokenization, parsing, commands, and serialization. labels Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area/Parsing LaTeX tokenization, parsing, commands, and serialization. Type/Bug A reproducible defect in CSharpMath.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse inline math spans inside \text{...}

1 participant