AMBVT
February 3, 2025, 3:59pm
1
I want to use the TeX Gyre Pagella Math font for math mode, so I use the code
show math.equation: it => {
set text(font: "TeX Gyre Pagella Math")
set block(breakable: true)
if it.block == false {
box(it)
} else {
it
}
}
Sometimes, I also want to use the New Computer Modern Math font for script letters in math mode, so I use the code
let scr(it) = math.class("normal", box({
show math.equation: set text(font: "New Computer Modern Math", stylistic-set: 1)
$#math.cal(it)$
}) + h(0pt))
(taken from here ). But this command does not work, e.g.
scr(P)
displays TeX Gyre Pagella Math’s calligraphic font. What am I doing wrong?
Eric
February 3, 2025, 4:27pm
2
For this, you need to know that there is a difference between using a show-set rule
#show math.equation: set text(font: "TeX Gyre Pagella Math")
and using a set rule inside a show rule
#show math.equation: it => {
set text(font: "TeX Gyre Pagella Math")
it
}
Only in the first case (the show-set rule), the font can be overridden by another rule. I have expanded a bit on that difference in How to change figure caption justification? - #5 by Eric .
To get your code working, you thus only need to rewrite your first show rule, such that the set rules are separated out into show-set rules. There, you could then also simplify the boxing of inline equations:
#show math.equation: set text(font: "TeX Gyre Pagella Math")
#show math.equation: set block(breakable: true)
#show math.equation.where(block: false): box
2 Likes
AMBVT
February 3, 2025, 4:30pm
3
Perfect, thank you. I am deeply grateful.