I notice that, in math mode (i.e., in quarto, $$...$$
or $...
), letters and numbers are being set in a default font irrespective of the mainfont
or mathfont
. Thus, variable names and numbers are being typeset in a different font.
mathfont
does have effect on math operators, e.g. \log
will be typeset using the mathfont
. However, letters and numbers are not. Is this expected behavior?
I know a workaround. That is to use \mathit{}
for the entire equation, then use \mathrm{}
for numbers that need to be upright. Then it looks right, but it makes the coding so much more heavy (than it already may be).
Compile the following document to see the issue:
---
documentclass: article
mainfont: Lato
mathfont: Lato
---
$$ y = 123\cdot\log{x} $$
$$ \mathit{y = \mathrm{123}\cdot\log{x}} $$
(Eventually substitute your own font). The second equation looks how it ought to be. In the irst equation, only operators (log
) use the mathfont
. Other items use a default "latex" font (the same you have when not specifying a mainfont
).