touying-typ / touying

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

Is it possible to assign several sildes with the same section numbers? #51

Closed metorm closed 4 weeks ago

metorm commented 1 month ago

I usually orginze my speech like below:

[1 section text A]

[1.1 subsection title a [subtitle a.i, or no subtitle] ]

[1.1 subsection title a [subtitle a.ii, or no subtitle] ]

[1.2 subsection title b [subtitle b.i, or no subtitle] ]

[1.2 subsection title b [subtitle b.ii, or no subtitle] ]

[1.2 subsection title b [subtitle b.iii, or no subtitle] ]

[1.3 subsection title c]

[2 section text B]

[...]

i.e., some of the subsections require more than 1 slide.

However, in the current version, it seems every slide makes the states.current-subsection-number() to increase, regardeless of wether we started a new sub-section or not.

= A

== A.a

#slide[ this is entitled 1.1 ]

#slide[ this is entitled 1.2, but I want it to keep 1.1 ]

== A.b

#slide[ this is entitled 1.3, but I want it to keep 1.2 ]
OrangeX4 commented 1 month ago

Can you provide a minimally reproducible example?

metorm commented 1 month ago

Well, I find the answer while trying to establish a minimally reproducible example. @OrangeX4

The trick is, that you have to set #show: slides.with(slide-level: 2), and use the sub-subsection before any slide call:

= A

== A.a

=== A.a.i

#slide[
You do not want to use any subtitle since you already get two titles: A.a & A.a.i
]

With the above input and slide-level: 2, A is used as the section name as usual, use states.current-subsection-number() + h(0.5em) + states.current-subsection-title to build text content like 1.2 A.a, and A.a.i is passed as title parameter to the slide funtion.