touying-typ / touying

Touying is a powerful package for creating presentation slides in Typst.
https://touying-typ.github.io/
MIT License
595 stars 15 forks source link

Slide with fletcher diagram and subsection generates different heading numbers #83

Open Pamplemousse opened 3 days ago

Pamplemousse commented 3 days ago

In a slide containing a fletcher diagram, I wanted to add a subsection title. However, the same subsection will take different heading number accross the slides.

The following source file:

// mwe.typ
#import "@preview/fletcher:0.5.1" as fletcher: edge, node
#import "@preview/touying:0.5.2": pause, slide, themes, touying-reducer
#import themes.metropolis: *

#show: metropolis-theme
#set heading(numbering: "1.1")

#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)

= foo

#slide[
  == bar

  #fletcher-diagram(
    node-stroke: .1em,
    spacing: 3em,

    node((0, 1), `user`),
    pause,
    node((1, 1), `application`),
    edge((0, 1), (1, 1), `uses`, "->"),
  )
]

compiled with the following command:

typst watch --format png mwe.typ mwe{n}.png

then we get the following three slides:

mwe1 mwe2 mwe3

I expected the heading for bar not to change as the rest of the diagram is revealed (the more pause are added, the more the heading gets incremented). Note that this example also highlights #84 which I separated because it doesn't seem related to fletcher.

OrangeX4 commented 3 days ago

Duplicated with #38. We need to wait for frozen state to do this.

OrangeX4 commented 2 days ago

And you can also consider:

#import "@preview/fletcher:0.5.1" as fletcher: edge, node
#import "@preview/touying:0.5.2": pause, slide, themes, touying-reducer
#import themes.metropolis: *

#show: metropolis-theme.with(
  header: utils.display-current-heading(level: 1),
  config-common(
    subslide-preamble: text(weight: "bold", utils.display-current-heading(level: 2)) + parbreak(),
  )
)
#set heading(numbering: "1.1")

#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)

= foo

== bar

#fletcher-diagram(
  node-stroke: .1em,
  spacing: 3em,

  node((0, 1), `user`),
  pause,
  node((1, 1), `application`),
  edge((0, 1), (1, 1), `uses`, "->"),
)

image

I think it's a more elegant method.

Pamplemousse commented 2 days ago

I think it's a more elegant method.

But it breaks anything more complicated than the minimum example: