Skip to content

Refactor Mathlisttostring #199

Merged
kostub merged 11 commits intomasterfrom
mathlisttostring-refactor
May 3, 2026
Merged

Refactor Mathlisttostring #199
kostub merged 11 commits intomasterfrom
mathlisttostring-refactor

Conversation

@kostub
Copy link
Copy Markdown
Owner

@kostub kostub commented May 3, 2026

No description provided.

kostub and others added 11 commits April 19, 2026 13:19
Introduces the model layer for TeX's fixed-size delimiter commands
(\big, \Big, \bigg, \Bigg and their l/r/m classed variants). The atom
is a single-atom subclass of MTMathAtom — it does not pair — and reuses
the inherited type field to carry the correct math class (Ord/Open/
Close/Rel) so the existing inter-element spacing machinery applies
unchanged. An empty nucleus is permitted to represent the null
delimiter (`.`).

No parser, typesetter, or serializer wiring yet — those follow in
subsequent commits.
Adds a table-driven dispatch in MTMathListBuilder for the 16 fixed-size
delimiter commands (\big/\Big/\bigg/\Bigg × ∅/l/r/m). The existing
getBoundaryAtom: helper is reused to read the delimiter token, validate
it against MTMathAtomFactory.delimiters, and surface
MTParseErrorMissingDelimiter / MTParseErrorInvalidDelimiter with the
command name embedded in the message.

Also guards MTTypesetter's Rule 14 Ordinary fusion against collapsing
an MTLargeDelimiter into an adjacent plain-Ordinary atom. Without this,
a subsequent typesetter dispatch branch on isKindOfClass: would never
see the delimiter atom.

Renderer-level behaviour is unchanged — large delimiters still fall
through the generic Ord/Open/Close/Rel path; dedicated rendering
arrives in a follow-up commit.
Serialization is intrinsic to an atom and symmetric with the already-public
+[MTMathListBuilder mathListToString:]. Declaring the selector once on the
base class gives subclasses a canonical override point and lets the compiler
type-check call sites.

Removes the duplicate `MTMathAtom (MTMathListBuilderSerialization)` category
declarations from MTMathList.m and MTMathListBuilder.m.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Resolved conflict in MTMathListBuilder.m's mathListToString: by keeping
the polymorphic appendLaTeXToString: dispatch from this branch and
adding an MTMathStack appendLaTeXToString: implementation that mirrors
the inline stack handling added on master.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kostub kostub merged commit d252267 into master May 3, 2026
1 check passed
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