PgBiel / typst-tablex

More powerful and customizable tables in Typst
MIT License
370 stars 12 forks source link

Overflowing cells #75

Closed deffi closed 8 months ago

deffi commented 9 months ago

Input:

#import "tablex.typ": tablex

#tablex(columns: (auto, auto, auto, auto),
  [lorem_ipsum_dolor_sit_amet], [lorem], [lorem_ipsum_dolor_sit_amet_consectetur_adipisici], [lorem],
)

#lorem(20)  // Just to show the page width

Result: Result

Observations:

The second observation can be demonstrated by shortening the first cell to lorem_ipsum_dolor_sit_am; now, the table renders correctly. Note that the third cell is no longer overflowing and the first cell contains more text than in the example above: Result

Typst 0.9, tablex 0.0.6

PgBiel commented 9 months ago

Related: #48

Thanks for the detailed report. This seems to be related to our usage of measure to determine the width of "auto" columns. Additionally, Typst currently considers words_joined_by_underlines as a thing, and doesn't linebreak at the underlines, generating some unexpected behavior at times. So these are things to consider.

In the meantime, I'd suggest trying to manually set the column sizes to some fixed value. Additionally, to allow line breaks at underlines, you may have to resort to a workaround such as

#show "_": [#sym.zws;\_#sym.zws]

Which adds zero-width spaces before and after underlines. The downside is that those invisible characters are copiable in the PDF by the end user.

Anyway, if I find something out, I'll keep you posted. Thanks again for opening the issue.

PgBiel commented 8 months ago

Hello, sorry for the delay. The issue is now fixed for the next release (0.0.8). Thanks for reporting!

The table should now make good use of all available page width.

In the meantime, you can use tablex.typ from the 0.0.x branch - just download the file, place it in your project and import it.