Closed lumpiluk closed 10 months ago
Set is scoped to the end of the containing block, in this case the surrounding [
. You can write #set page(width: 594mm, height: 167mm) if true
though to conditionally set. Alternatively, you can do more arbitrary things with a show rule:
#show: it => {
if true {
set page(width: 594mm, height: 167mm)
it
} else {
set page(paper: "presentation-16-9")
it
}
}
Everything here will be bound to `it`.
The latter is obviously not particular comfortable to write, which is the reason why set .. if ..
exists. But that one is quite limited, so this is all not yet ideal. That said, it is working as expected.
Ah, sorry, that makes sense. I completely forgot about the scoping. Thank you!
Description
Trying to set the page size conditionally based on a template parameter (here simply tested with
true
) does not work with if-else statements. The following code is ignored and A4 pages are used instead:Using either of the
set
commands on their own works as expected.Workaround:
Reproduction URL
https://typst.app/project/r7y4QAHQO0oqSgoeI1pHCV
Operating system
Web app, Linux
Typst version