#Counter display problem in headings
12 messages · Page 1 of 1 (latest)
If it can help I use some function defined like this ```typst
#let calculateAnnexeTitle(title, count) = {
"Annexe " +count + ": " + title
}
And I use it like this :
```typst
== #calculateAnnexeTitle("Capture d'écran de la vue principale de l'application", context annexes.display("1"))
try this:
#context [== #calculateAnnexeTitle("Capture d'écran de la vue principale de l'application", annexes.display("1"))]```
that is, using the context around the heading, not using the context where the information is displayed
otherwise it tries to display the counter value at the outline, before you update the counter at all, which is zero
Ok it works well, thank you
For this kind of things, I create a function appendix and use a show rule to activate the environment.
#let appendix = {
counter(heading).update(0)
set heading(numbering: "A")
}
Ok I'll try this too, thank you for the advice
could share an example of show rule?
Of course. Once you define your function. You can put the following code in your main file, when you want to activate the appendix environment.
#show: appendix
And so you set the appropriate text below this show rule like this ?
#show: appendix
Example of appendix
Yes, it is what I did for a book template. You also have this example in elsearticle template I shared on Typst Universe