As noted in Touying’s tutorial, its utils.semi-transparent-cover
cover function doesn’t always preserve page structure. This is especially obvious when using math and alignment tabs. Example:
#import "@preview/touying:0.6.1": *
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
= Hello
== Page with text
#lorem(25) #pause
#lorem(25)
== Page with math
$
f(x) pause &= 3x \
f(x) pause &= 5x + 6
$
#pause
$ g(x) = 1 $
Given this limitation, I would like to use use.semi-transparent-cover
for text but not for math. I assumed this would be a common issue but cannot find anything that achieves this. I tried the following to achieve this:
Attempt 1
#let has-equation(body) = body.func() == math.equation or (body.has("children") and body.children.any(i => i.func() == math.equation))
#show: simple-theme.with(
aspect-ratio: "16-9",
config-methods(cover:
(self:none, body) => if has-equation(body) {
hide(body)
} else {
utils.semi-transparent-cover(self:self, alpha: 85%, body)
}
)
)
This works for full equations but not when pause
is used within math mode.
Attempt 2
#show math.equation: it => {
show: simple-theme.with(
aspect-ratio: "16-9",
config-methods(cover: utils.semi-transparent-cover.with(alpha: 85%))
)
it
}
This gives the error maximum show rule depth exceeded. Hint: check whether the show rule matches its own output
. Not sure where the recursion is occurring, this error doesn’t make sense to me.
Attempt 3
If I try to put this before the math:
#show: simple-theme.with(
aspect-ratio: "16-9",
config-methods(cover: (self:none, body) => hide(body))
)
…and this after:
#show: simple-theme.with(
aspect-ratio: "16-9",
config-methods(cover: utils.semi-transparent-cover.with(alpha: 85%))
)
It causes a lot of issues downstream, adding extra pages inexplicably throughout.
Is the only way to handle this through the callback approach?