Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create fit-spans option #111

Merged
merged 9 commits into from
Jan 8, 2024
Merged

Create fit-spans option #111

merged 9 commits into from
Jan 8, 2024

Conversation

PgBiel
Copy link
Owner

@PgBiel PgBiel commented Jan 4, 2024

Helps with (potentially closes) #56 and #78.

The idea is to be able to specify #tablex(fit-spans: (y: true)) in order to have colspans not affect auto columns' sizes.
That way, fractional columns won't be "squashed".

Consider the table below, from #78:

#tablex(
    columns: (1fr, 1fr, auto, auto, auto),
    [a], [b], [c], [d], [e],
    cellx(colspan: 5)[#lorem(5)],
    [a], [b], [c], [d], [e],
    cellx(colspan: 2)[#lorem(10)], none, none, none,
    [a], [b], [c], [d], [e],
    cellx(colspan: 3)[#lorem(15)], none, none,
)

The last row has a colspan which spans not only the two fractional columns, but also one auto column, causing the latter to expand more than it should (since auto columns are measured before fractional columns), leading to zero-width fractional columns:

The first, second and third columns are overlapping

Adding fit-spans: (x: true) causes the auto column to ignore the colspan's size, fixing the problem:

The three first columns are not overlapping anymore

@PgBiel PgBiel added enhancement New feature or request auto track sizing Related to calculation of the size of an auto column/row. labels Jan 4, 2024
@PgBiel PgBiel added this to the v0.0.8 milestone Jan 4, 2024
@PgBiel PgBiel self-assigned this Jan 4, 2024
@PgBiel PgBiel marked this pull request as ready for review January 8, 2024 15:27
@PgBiel PgBiel merged commit a2acb63 into 0.1.0-dev Jan 8, 2024
3 checks passed
@PgBiel PgBiel deleted the fit-spans branch January 8, 2024 15:39
@PgBiel PgBiel mentioned this pull request Jan 8, 2024
6 tasks
PgBiel added a commit that referenced this pull request Jan 11, 2024
Create `fit-spans` option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto track sizing Related to calculation of the size of an auto column/row. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant