Skip to content

Add an Explicit Type for Figures in Typst #9574

@thekief

Description

@thekief

Describe your proposed improvement and the problem it solves.

Typst tries to parse the figure type based on the content, noteably raw, table, and image. When, e.g., overwriting the default table implementation, Typst cannot do the proper association anymore.

A fix for this issue would be to explicitly set a figure's kind property during the write of Typst files. So instead of generating

#figure(align(center)[#table(
    columns: 2,
    align: (col, row) => (auto, auto,).at(col),
    inset: 6pt,
    [Req],
    [Title],
    [Req-1234],
    [Do Some Stuff],
  )])

generating

#figure(
    align(center)[#table(
    columns: 2,
    align: (col, row) => (auto, auto,).at(col),
    inset: 6pt,
    [Req],
    [Title],
    [Req-1234],
    [Do Some Stuff],
  )],
  // identify the figure as a table
  kind: table
)

would allow Typst to properly identify figures again.

Describe alternatives you've considered.

Typst's scripting allows to overwrite several properties but everyone that changes default implementations would need to script.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions