[bug] List or enum starting with eqution, causing equation offset after line break or a block level element

Description

Since cjk-latin-spacing not working with inline eqution, I used show set to make it work. However, as title said, typst version 0.14 ~ 0.15-testing will result in equation offset after line break or a block level element.

Minimum working example:

normal

#list([$1/2$

])

#show math.equation.where(block:false): it => h(1em,weak: true) + it + h(1em,weak: true)

set left space

#list([$1/2$

])

#list([$1/2$
#block[]
])

version 0.14 ~ 0.15 Testing

version 0.10 ~ 0.13.1

Operating system

MacOS

Typst version

  • I am using the latest version of typst

I donโ€™t know why I canโ€™t submit an issue or star typst on GitHub, so I posted it here

1 Like

I can reproduce your description, and I notice that the following weak spaces are collapsed correctly.

#list(
  {
    h(1em, weak: true)
    $1/2$
  },
  $1/2$,
  {
    show math.equation.where(block: false): it => h(1em, weak: true) + it
    $1/2$
  },
)

More tests:

#list(
  {
    h(1em, weak: true)
    $1/2$ // good
    parbreak()
  },
  {
    show math.equation.where(block: false): it => h(1em, weak: true) + it
    $1/2$ // bad
    parbreak()
  },
  {
    show math.equation.where(block: false): it => h(1em, weak: true) + it
    $1/2$ // good
  },
  {
    block({
      h(1em, weak: true)
      $1/2$ // good
    })
    parbreak()
  },
  {
    h(0.000000000001em)
    h(1em, weak: true)
    $1/2$ // bad, but expected
    parbreak()
  },
)

(Tested with typst v0.15.0-rc.1, v0.14.2, v0.14.0)

Search | DeepWiki

EDIT:
Oh, you should link to Why h function make list or enum so weird? - #2 by gezepi, which already explained many things!