这是indexloc提供的服务,不要输入任何密码
Skip to content

Rotating cell contents seems to calculate dimensions wrong #59

@ja-he

Description

@ja-he

What I originally wanted to do (not being a huge typst expert) was something like rowspanx(7)rotate(-90deg)[*Components*] but that does not compile; fair enough.

My quick solution so far was to use cellx directly: cellx(rotate(-90deg)[*Component*], rowspan:7).
That does compile, and work mostly as expected except for the fact that it hyphenates the word when there is not enough left-right space for it, even though it has been rotated to be written bottom-to-top, where there is plenty of space.

Heres a small yet more complete example that showcases my issue:

slightly broken example / example to showcase broken cell-content rotation
  #tablex(
    columns: (2em, auto, auto),
    inset: 10pt,
    align: center + horizon,
    auto-vlines: true,
    header-rows: 1,
    [],
    [*NTIA*]                       , [*BSI*],
    cellx(rotate(-90deg)[*SBOM*], rowspan:2),
    [Author of SBOM Data]          , [_Creator of SBOM_],
    [Timestamp]                    , [_Timestamp_],
    cellx(rotate(-90deg)[*Component*], rowspan:7),
    [Supplier Name]                , [_Creator of the Component_],
    [Component Name]               , [_Component Name_],
    [Version of the Component]     , [_Version of the Component_],
    [Other Unique Identifiers]     , [],
    [Dependenciy Relationships]    , [_Dependencies from other Components_],
    []                             , [_License_],
    []                             , [_Hash-value of Executable Component_],
  )

that turns into this, where you can clearly see the word broken up when it has enough space.
2023-09-02_142703

I would guess that "SBOM" simply cannot be hyphenated by however typst does hyphenation.

  • the issue seems pretty clear (width seems to be calculated regardless of rotation)
  • I don't know if this is an issue with this package
  • I don't know if my use of the package is still within the intended uses
  • (but) I would say this is a fairly common thing to do in tables to maximize space efficiency

(As an aside, I discovered this package 20 minutes before my issue and it works wonderfully and is explained well, so thank you for the good work on it)


Further details:

  • It seems 0.0.5 fixes something with rotation, but my import line looks like this: #import "@preview/tablex:0.0.5": tablex, rowspanx, colspanx, cellx so I think this is not fixed in 0.0.5
  • I am on typst 0.7: typst 0.7.0 (da8367e1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions