Skip to content

Default show-set align rule prevents inlining figure with box show rule #7001

@Andrew15-5

Description

@Andrew15-5

Description

As shown in https://forum.typst.app/t/why-does-showing-a-figure-in-a-box-not-put-the-figure-inline/6140, you can't use show figure: box to inline figure, as default show figure: set align(center) interrupts the grouping of inline-level elements.

Being able to wrap a block-level element in a box to automatically inline it, yet in some cases it doesn't work, is unexpected behavior. Since forever, I thought that show-set rules don't create a wrapper, but since this show-set rule also interrupts the grouping, it means that it does create something like

#show figure: it => {
  set align(center)
  it
}

but with ability to override the setting.

Apparently, the show figure: box is applied after the implicit paragraph break (after set align(center)?).

This behavior either needs to be changed, or docs (I guess the new tutorial) need to explicitly describe this behavior, and a way to revoke this default show-set rule needs to exist. I don't know if cancelling it with show figure: set align(auto) can work.

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstylingAbout set and show rules or style properties

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions