Click to show MRE
#import "@preview/touying:0.7.3": *
#import themes.university: *
#import "@preview/numbly:0.1.0": numbly
#import "@preview/theorion:0.6.0": * // <--- importing 0.3.3 works, 0.4.0 does not
#import cosmos.clouds: *
#show: show-theorion
#show: university-theme.with(
aspect-ratio: "16-9",
config-common(frozen-counters: (theorem-counter,)), // freeze theorem counter for animation
)
= test
#proposition[
The formula:
#pause
]
Since release 0.4.0, touying animations seem to be broken (see MRE) with all the themes clouds, default, fancy, simple, and rainbow. (with some variation, like touying's #pause working inside theorems with simple theme in version 0.4.0 but not version 0.6.0)
The error message when trying to use #pause is:
error: panicked with: "Unsupported mark `touying-jump/pause/meanwhile` at page 2. You can't use it inside some functions like `context`. You may want to use the callback-style `uncover` function instead."
┌─ @preview/touying:0.7.3/src/configs.typ:66:8
│
66 │ ╭ panic(
67 │ │ "Unsupported mark `"
68 │ │ + kind
69 │ │ + "` at page "
70 │ │ + str(page-num)
71 │ │ + ". You can't use it inside some functions like `context`. You may want to use the callback-style `uncover` function instead.",
72 │ │ )
│ ╰─────────^
See also the discussion on the forum where the bug was originally discovered: https://forum.typst.app/t/how-to-incrementally-reveal-theorem-content-in-touying-and-theorion/8932
Possible causes:
It seems the render-fn of each theme is wrapped in a context block, due to the use of the function indent-repairer requiring it. I don't have concrete suggestions on how to fix the function, but reading the current implementation seems slightly hacky and I'm hopeful that there's a better way of doing things. (in fact it suffices to avoid putting the content of indent-repairer inside the contextual parts of the function)
If indent-repairer can be made non-contextual, the render-fn:s can then be re-written to only make if target() == "html" contextual and returning the html element early, for example the clouds theme is currently implemented by
|
// Main rendering |
|
let rendered = block( |
|
inset: 1em, |
|
fill: fill, |
|
radius: .4em, |
|
width: 100%, |
|
..args, |
|
indent-repairer[ |
|
#if full-title != "" { |
|
strong(full-title) + sym.space |
|
} |
|
#body |
|
], |
|
) |
|
if "html" in dictionary(std) { |
|
// HTML rendering |
|
if target() == "html" { |
|
html.elem("div", attrs: ( |
|
style: "background: " |
|
+ fill.to-hex() |
|
+ "; border-radius: .4em; padding: 1em; width: 100%; box-sizing: border-box; margin-bottom: .5em;", |
|
))[ |
|
#if full-title != "" { |
|
strong(full-title) + sym.space.nobreak + sym.space.nobreak |
|
} |
|
#body |
|
] |
|
} else { |
|
rendered |
|
} |
|
} else { |
|
rendered |
|
} |
and with the proposed rewrite it would look something like this:
// Main rendering
let rendered = block(
inset: 1em,
fill: fill,
radius: .4em,
width: 100%,
..args,
indent-repairer[ // updated non-contextual version
#if full-title != "" {
strong(full-title) + sym.space
}
#body
],
)
if "html" in dictionary(std) {
// HTML rendering
context if target() == "html" {
return html.elem("div", attrs: ( // return html element early
style: "background: "
+ fill.to-hex()
+ "; border-radius: .4em; padding: 1em; width: 100%; box-sizing: border-box; margin-bottom: .5em;",
))[
#if full-title != "" {
strong(full-title) + sym.space.nobreak + sym.space.nobreak
}
#body
]
}
// else
rendered // note that this isn't inside a context block anymore
} else {
rendered
}
Also for the time being, if these bugs cannot be fixed the claim "Touying animation support" in the README should be updated to accurately reflect the current status
Click to show MRE
Since release 0.4.0, touying animations seem to be broken (see MRE) with all the themes
clouds,default,fancy,simple, andrainbow. (with some variation, like touying's#pauseworking inside theorems with simple theme in version 0.4.0 but not version 0.6.0)The error message when trying to use
#pauseis:See also the discussion on the forum where the bug was originally discovered: https://forum.typst.app/t/how-to-incrementally-reveal-theorem-content-in-touying-and-theorion/8932
Possible causes:
It seems the
render-fnof each theme is wrapped in a context block, due to the use of the functionindent-repairerrequiring it. I don't have concrete suggestions on how to fix the function, but reading the current implementation seems slightly hacky and I'm hopeful that there's a better way of doing things. (in fact it suffices to avoid putting the content ofindent-repairerinside the contextual parts of the function)If
indent-repairercan be made non-contextual, therender-fn:s can then be re-written to only makeif target() == "html"contextual and returning the html element early, for example the clouds theme is currently implemented bytypst-theorion/cosmos/clouds.typ
Lines 12 to 44 in 4038d9b
and with the proposed rewrite it would look something like this:
Also for the time being, if these bugs cannot be fixed the claim "Touying animation support" in the README should be updated to accurately reflect the current status