Repository navigation
fix: \text keeps its interword spaces - #69
Merged
Merged
Conversation
The tokenizer discarded every blank, so \text{gene }i \text{ is ...} set
as "geneiis...". amstext.sty typesets the argument in an \hbox in text
mode, where a blank is interword glue. Inside the braces after \text,
\mbox, \hbox, \textrm and \textnormal a run of blanks is now one control
space (6mu, cmr10's interword space); a blank after a control word is
still swallowed, and $...$ inside the span is maths again.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… gate
The 100% coverage gate failed on the two \bgroup/\egroup branches: the text
group start read pendingText AFTER the control-word scan had cleared it, so
\text\bgroup could never open a text span (dead code). Read it before the
clear, and skip the blanks after \bgroup/\egroup as TeX does after any control
word. Test: \text\bgroup a b\egroup is \text{a b}.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 26, 2026
tannevaled
added a commit
to go-tex/docs
that referenced
this pull request
Nov 26, 2026
…, corpus (v0.299.0-v0.300.0) (#30) Adds four bullets to "What it does": font sizes and classes; pages and geometry; mathematics (align tags, \text spaces); the corpus A/B measured on v0.299.0. Source: engine #936-#950, go-tex/math#69. Co-authored-by: Claude Sonnet 5.5 <[email protected]>
tannevaled
added a commit
to go-tex/engine
that referenced
this pull request
Nov 26, 2026
Documents font sizes in any TeX unit, a class's restated \normalsize as the body size, \PassOptionsToClass option expansion, authblk, the elsarticle star marks, LMSans bold and oblique, the page folio, geometry options and heightrounded, eso-pic on even pages, align \tag placement and relation spacing, \text spaces (go-tex/math v0.51.0), and the corpus A/B measured on v0.299.0. Source: engine #936-#950, go-tex/math#69. Co-authored-by: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
\text{gene }i \text{ is conditionally independent from gene } jprinted as "geneiisconditionallyindependentfromgenej" (go-tex/engine, corpus paper 2407.19892, page 2). Not specific to any class: it reproduces with article + amsmath.Cause: the tokenizer discards every blank and
\textis read as an alphabet switch (\mathrm). amstext.sty typesets the argument in an\hboxin text mode, so inter-word glue is kept, leading and trailing included.Fix: inside the braces following
\text,\mbox,\hbox,\textrm,\textnormal, a run of blanks becomes one control space (6mu = cmr10's interword space). A blank after a control word is still swallowed (TeXbook ch. 8), and$...$inside the span is maths again. Maths mode outside the span and\mathrmare unchanged.Not done: the current text font (e.g.
\textitcontext) is not inherited by\text; the alphabet is still upright.Test:
TestTextKeepsItsInterwordSpacespins widths (fails before:\text{a b}and\text{ab}are both 36.00). Full suite passes.🤖 Generated with Claude Code