I am trying to create some slides with touying
and mannot
to annotate equations. I would like the annotations to appear dynamically (i.e. to appear upon a click).
Here is a MWE that clumsily achieves what I want:
#import "@preview/mannot:0.3.0": *
#import "@preview/touying:0.6.1": *
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
#slide(repeat: 3, self => [
#let (uncover, only, alternatives) = utils.methods(self)
#let delayedmark(content, tag: none, color: red, start: 2) = {
let entries = (mark(content, tag: tag, color: black),)*start + (mark(content, tag: tag, color: color),)
alternatives(repeat-last: true, ..entries)
}
#let delayedmarkhl(content, tag: none, color: orange, start: 2) = {
let entries = (markhl(content, tag: tag, color: white),)*start + (markhl(content, tag: tag, color: color),)
alternatives(repeat-last: true, ..entries)
}
$
markul(p_i, tag: #<p>) = markrect(
exp(- delayedmark(beta, tag: #<beta>, color: #red, start: #1) mark(E_i, tag: #<E>, color: #green)),
tag: #<Boltzmann>, color: #blue,
) / delayedmarkhl(sum_j exp(- beta E_j), tag: #<Z>)
#annot(<p>, pos: bottom + left)[Probability of \ state $i$]
#annot(<E>, pos: top + right, dy: -1em)[Energy]
#annot(<Boltzmann>, pos: top + left)[Boltzmann factor]
#pause
#annot(<beta>, pos: top + left, dy: -1.5em, leader-connect: "elbow")[Inverse temperature]
#pause
#annot(<Z>)[Partition function]
$
])
mwe.pdf (16.2 KB)
This achieves the desired effect but is very clunky. For example, I must redefine delayedmark
on each slide I want to use it for because it is local to that slide.
Is there a cleaner way of doing this?