Repository navigation
Typst: measure indent and spanning cells in note-table column widths (#695) - #696
Merged
Merged
Conversation
…695) With notes, Typst column widths are measured from a plain grid of each column's cells. That measurement ignored style_tt(indent = ), so indented cells overflowed into the next column, and it counted full-width group_tt(i = ) labels as content of every column, inflating all columns. - Measure each cell with its resolved indent (from @style_other). - Skip cells that span several columns, and cells hidden under a span. - Measure spanning cells separately and widen the covered columns proportionally only when a span does not fit. - Matrix-inserted group rows keep per-column measurement. Closes #695 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #695.
Problem
In Typst tables with
notes,typst_widths()measures each column's natural width from a plaingridof its cells, then converts the widths tofrunits. That measurement had two bugs:gridbypasses theshow table.cellrule that appliespad(left: indent), so indented cells overflowed into the next column (the overlap with short group labels).@data_bodyalready contains thegroup_tt(i =)rows, so each label was measured as content of every column. Long labels inflated all columns and pushed the table to the page-width cap, which made headings wrap. This also hid bug 1.Fix
typst_measure_cells():@style_other, so column-wide settings and last-write-wins are respected).group_tt(i =, j = <matrix>)are still measured per column.style_tt(colspan =)) are measured separately. The columns they cover grow in proportion only when a span does not fit, so long labels don't wrap.autoor explicit widths are unaffected.Tests
inst/tinytest/test-typst.R: spans excluded, indent measured (cell-level and column-wide),indent = 0override, matrix-inserted rows, and empty theme with notes.Known limitation
When the natural width exceeds the page width, all columns shrink proportionally, so headers may wrap slightly. Bold and font size are still not counted in the measurement.
🤖 Generated with Claude Code