How to use different fonts for math mode and math.cal?

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