How to fix incorrect heading numbering after a #pause in presentation slides?

When using the following imports for writing theorems in a presentation, I noticed that after a #pause in a slide, the heading numbering increments unexpectedly.

#import "@preview/polylux:0.3.1": *
#import "@preview/ctheorems:1.1.2": *
#set heading(numbering: "1.")
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "4-3")
#slide[
== Introduction
bar

#pause
foo
]

On the second page, the heading changes to 1.2 Introduction, which causes incorrect numbering for subsequent theorems. How can I prevent the heading from incrementing after a #pause?

Hello! Unfortunately, I do not think that’s possible without modifying the package’s code.

I generally avoid recommending other packages, especially because it’s a polylux question, but in this case the alternative is much easier. (Sorry Polylux…). You may try Touying instead:

#import "@preview/touying:0.5.2": *
#import "@preview/ctheorems:1.1.2": *
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
#let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee"))
#set heading(numbering: "1.")

== Introduction

#theorem[foo]

#pause

#theorem[bar]
Output

If someone manages to deal with the repeated content issue with polylux without heavy modifications, I’ll be glad to read that! Please mention me.

P.S.: please make sure your code is reproducible! Your code errors because #slide is not defined, it should probably be #polylux-slide.

1 Like

That’s a great point. I talked about the importance of MRE and what it involves here: Image sizes parent container wrongly? - #2 by Andrew.

Thank you, it works. I made my code reproducible, but I don’t know how to make it runnable.

It is not possible to run Typst code on Discourse! I just pasted the image using

[details="Summary"]
This text will be hidden
[/details]

See Formatting posts using markdown, BBCode, and HTML - Using Discourse - Discourse Meta

2 Likes

Hey Petr,

I hope the replies in this topic have been useful for you so far!

The topic is a question, so I have moved it into the questions category for you. The next time you post a question on Typst, please choose questions in the category dropdown in the composer.

Now that the topic is in the question category, you can use the checkbox icon under each post to mark which one solved your question. That post will be highlighted so others with the same problem can find the solution more quickly.

1 Like