Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pamplemousse opened this issue Sep 25, 2024 · 3 comments
Labels
bug Something isn't working upstream

Comments

@Pamplemousse
Copy link

Pamplemousse commented Sep 25, 2024

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: *

#showmetropolis-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.

@Pamplemousse Pamplemousse changed the title Slide with fletcher diagram and subsection messes heading numbers Slide with fletcher diagram and subsection generates different heading numbers Sep 25, 2024
@OrangeX4 OrangeX4 added the duplicate This issue or pull request already exists label Sep 25, 2024
@OrangeX4 OrangeX4 reopened this Sep 25, 2024
@OrangeX4 OrangeX4 added bug Something isn't working upstream and removed duplicate This issue or pull request already exists labels Sep 25, 2024
@OrangeX4
Copy link
Member

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

@OrangeX4
Copy link
Member

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
Copy link
Author

I think it's a more elegant method.

But it breaks anything more complicated than the minimum example:

  • Slides that have content (like a little introduction) before a subsection. You get
== heading
little intro
== heading
content

instead of the expected

little intro
== heading
content
  • It doesn't handle multiple levels throughout the presentation, for example a slide with a diagram under a subsection, and another slide with a diagram under a subsubsection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

2 participants