PgBiel/typst-tablex

Overflowing cells

deffi opened this issue · 2 comments

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 first and third cells are overflowing.
  • There is unused (horizontal) space (enough to accomodate the contents of one of the overflowing cells and most of the other)

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

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.

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.