Skip to content

compiler: add \textbullet, \textperiodcentered, \textregistered, \texttrademark (GH-TEXT-SYMBOLS-1) - #604

Closed
d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead/text-symbols-1
Closed

d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead/text-symbols-1

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Scope

Adds the four missing kernel text symbols (GH-TEXT-SYMBOLS-1): \textbullet (U+2022), \textperiodcentered (U+00B7), \textregistered (U+00AE), \texttrademark (U+2122). Each is a new TEXT_SYMBOLS row in crates/compiler/src/text_builtins.rs, following the exact existing \textcopyright pattern — same OT1/T1 encoding resolution, same dispatch arm family in parser.rs. \textperiodcentered reuses the same U+00B7 font-resource path math.rs already uses for \cdot — no second resource added. No crates/render-pipeline/ change needed.

Glyph availability confirmed directly against the export path rather than assumed: U+2022 and U+2122 hit export.rs's WINANSI_HIGH table (0x95/0x99); U+00B7/U+00AE go through the plain Latin-1 passthrough. All four are representable, so no graceful-degradation path was needed.

Overlap check

coord.py claims — no other claim on these four symbols. No other in-flight branch/PR.

Test results

Focused (crates/compiler):

test text_builtins::tests::text_symbol_family_resolves_in_ot1_and_t1 ... ok
test text_builtins::tests::text_symbol_arms_match_the_builtin_table ... ok
test text_builtins::tests::every_text_symbol_resolves_in_t1 ... ok
test parser::tests::textbullet_typesets_a_bullet ... ok
test parser::tests::textperiodcentered_typesets_a_middle_dot ... ok
test parser::tests::textregistered_typesets_a_registered_sign ... ok
test parser::tests::texttrademark_typesets_a_trademark_sign ... ok
test result: ok. 7 passed; 0 failed

Independent mutation check (supervisor-run, fresh CARGO_TARGET_DIR): removed all four TEXT_SYMBOLS rows → 6 tests FAILED (4 parser tests plus the two text_builtins table-consistency tests), each with the original \text... is not supported by this compiler version message; restored → all 7 pass again.

Full cargo test in crates/compiler: every suite ok, 0 failures.

Entry-point repro (flashtex_compiler::protocol::handle_line, temporary test file, deleted before commit): A\textbullet B\textperiodcentered C\textregistered D\texttrademark E → "status":"ok", all four glyphs (•, ·, ®, ™) placed as text items at the correct x-positions, only a pre-existing unrelated amssymb fidelity warning (no errors).

Not done

Out of scope, noted for whoever owns list labels: parser/lists.rs level-4 itemize labels currently use U+22C5 DOT OPERATOR under the internal name textperiodcentered, while the real \textperiodcentered command (now implemented here) is U+00B7 — a pre-existing naming collision, not a defect introduced by this PR. Oracle fixtures for the four new symbols in tests/oracle/text_builtins/expected.json would need a separate TeX Live recording pass.

🤖 Generated with Claude Code

…, texttrademark

Same rendering path as textcopyright: four TEXT_SYMBOLS rows, parser
BUILT_INS + dispatch arms, vocabulary unlists textbullet/textperiodcentered.
OT1 reaches each through its kernel default (OMS, textcircled,
textsuperscript{TM}); T1 resolves directly. All four glyphs are
representable in the base-14 export path (WinAnsi 0x95/0x99, Latin-1
0xB7/0xAE); U+00B7 reuses the existing cdot font-resource path.

Implementation-Agent: muse-spark-1.3-contributor
GoKubar added a commit that referenced this pull request Sep 15, 2026
* GH-TEXT-SYMBOLS-1: add textbullet, textperiodcentered, textregistered, texttrademark

Same rendering path as textcopyright: four TEXT_SYMBOLS rows, parser
BUILT_INS + dispatch arms, vocabulary unlists textbullet/textperiodcentered.
OT1 reaches each through its kernel default (OMS, textcircled,
textsuperscript{TM}); T1 resolves directly. All four glyphs are
representable in the base-14 export path (WinAnsi 0x95/0x99, Latin-1
0xB7/0xAE); U+00B7 reuses the existing cdot font-resource path.

Implementation-Agent: muse-spark-1.3-contributor

* compiler: split hyphens out of math-alphabet runs as math minuses

$\mathrm{a-b}$ fused into one Text run, setting a text hyphen (-- an
en dash) instead of TeX's mathcode"2200 Bin cmsy minus. Split hyphen
runs out into one Symbol("-") atom per hyphen between the alphabet's
own runs (mathrm/mathit/mathsf/mathtt/mathbf/textbf/mathfrak),
mirroring plain $a-b$ exactly. Letter/digit runs are untouched.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

* compiler: classify frac as an ordinary math atom

What changed:
- Mark parsed \\frac as Ord while keeping infix \\over Inner.
- Correct the fraction-class documentation and add a native-spacing regression test.

What was run:
- /Library/TeX/texbin/pdflatex spacing probe (TeX Live 2026).
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-cleanups CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/compiler/Cargo.toml --lib spacing_tests

Next step:
- Align the conditional and group nesting guards.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* tex-expansion: make nesting limits exact

What changed:
- Reject the next conditional when the configured depth is already N.
- Add off-by-one tests proving exactly N conditionals and groups are allowed.
- Keep both default limits at 10,000.

What was run:
- /Library/TeX/texbin/pdftex native nested conditional/group probe.
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-cleanups CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/tex-expansion/Cargo.toml --test expand_tests depth_limit

Next step:
- Audit compiler and tex-expansion TeX behavior comments and diagnostics.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* tex-expansion: correct invalid-character recovery comment

What changed:
- Document that the recovery lexer drops invalid characters without a diagnostic.
- Keep the native TeX invalid-character behavior documented separately.

What was run:
- /Library/TeX/texbin/pdftex invalid-character probe (TeX Live 2026).
- git diff --check.

Next step:
- Run the required full compiler and tex-expansion test suites.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* compiler: accept length registers as enumitem key values

TeX-engine errors for \setlist[itemize]{leftmargin=\mylen}: a bare
\newlength register in the options reached the stomach as a register
assignment, whose dimension scan reported 'Missing number, treated as
zero.' + 'Illegal unit of measure (pt inserted).' on the following
token (real enumitem stores keyval text unexecuted, where the bare
register is a complete <internal dimen> needing no unit).

\setlist now routes through flashtexsetlist, which absorbs the star,
[<names>] and {<options>} with one expansion pass but no execution and
splices dimen/skip register references to their current \the text, so
leftmargin=\mylen behaves exactly like leftmargin=\the\mylen. A
<factor> before the register (2\mylen) is left for the main loop, which
reports it as before. Shared by every dimension key (leftmargin,
itemsep, topsep, ...).

Tests: setlist_register_lengths (exact repro with zero diagnostics;
register vs literal vs \the equivalence for leftmargin/itemsep/topsep).

Implementation-Agent: muse-spark-1.3-contributor

---------

Co-authored-by: d-q222 <[email protected]>
Co-authored-by: muse-spark-1.3-contributor <[email protected]>
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Closing: this landed on main via integration PR #648 (commit da1d151, "integration: compiler queue (#602, #604, #629, #630)"). Verified by feature content: the test textbullet_typesets_a_bullet from this PR is present on main in crates/compiler/src/parser.rs. The branch tip is not an ancestor of main only because the integration branch was squash-merged.

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.

2 participants