Add LaTeX array environment (PR 3/3): renderer — rules + shared column offsets#254
Add LaTeX array environment (PR 3/3): renderer — rules + shared column offsets#254kostub wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for rendering horizontal and vertical rules in math arrays (such as \hline and | column separators) by implementing a new MTRuleDisplay class. It updates the typesetter to calculate column offsets with padding/rules and position these rules correctly within tables. Unit tests are also added to verify rule metrics, offsets, and layout regression. The review feedback suggests adding a safety check for the outWidth pointer in columnOffsetsForTable:... to prevent potential null pointer dereferences.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| x += columnWidths[i]; | ||
| } | ||
| } | ||
| *outWidth = x; |
7570801 to
843a1c8
Compare
ca36098 to
9320825
Compare
843a1c8 to
7972159
Compare
9320825 to
cded87a
Compare
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5hd85BBs6ExZVyqevdpqu
cded87a to
c573116
Compare
Code Review — PR 3/3: Array environment renderer (rules + shared column offsets)Assessment: Ready to merge with fixes (minor). The non-regression running-sum algebra was verified by hand, the matrix fast path confirmed inert, and fold-into-bounds delimiter sizing is sound. Full suite: 406/406 green. Strengths
IssuesImportant (Should Fix)
Minor (Nice to Have — defer to the snapshot-tuning pass)
VerdictCore is correct — no Critical issues. Recommend landing the 🤖 Generated with Claude Code |
Goal
Render array vertical/horizontal rules. Adds a lightweight
MTRuleDisplayleaf; factors cell x-advance into one-columnOffsetsForTable:helper so cells and vertical rules cannot drift; emits rule displays spanning a shared frame and folds them into table bounds so\left…\rightsizes correctly around the rule-inclusive table. The matrix / every-existing-env path is byte-for-byte unchanged (emptyverticalLines/horizontalLines⇒ identical running sum, empty rule set).Commits
[item 9]Add MTRuleDisplay leaf for array rules[item 10]Factor shared column offsets; keep matrix path identical[item 11]Emit array rule displays; fold into table bounds[item 12]Integration: array in delimiters + matrix non-regressionVerification
swift test→ 402/402.testMathTable,testMatrixColumnGapTracksCellStyle,testMatrixRowSpacingTracksCellStyle,testSmallMatrixColumnGap,testSmallMatrixCompactVsMatrix,testGatheredMatchesGather,testAlignedatLayout) unchanged after the item-10 offsets refactor.testMatrixLayoutUnchangedByArraySupportasserts a plain matrix emits noMTRuleDisplayand exactly two row displays.Stack
master)feature/array-environment-pr1)feature/array-environment-pr2)References
docs/plans/2026-07-03-array-environment.md(PR 3, items 9-12)docs/lld/2026-06-29-array-environment.md🤖 Generated with Claude Code