quarto-thesis
quarto-thesis copied to clipboard
Math not rendering correctly in pdf
Description
Hi @eeholmes, I inserted a basic equation into the template Chapter 1. It renders fine on quarto equation preview in VSCode, but it does not render in the pdf. If I change the output to html, the equation renders as expected.
Steps to Reproduce
$$
\int_{A_i}{\lambda (\mathbf{x})}
$$
Does quarto not natively support math such as \int
?
From html output:
From pdf:
I'll check this out. It should definitely render fine in the pdf.
Ok, this is very strange. Something in the cls file, which I didn't write, is causing a problem with the xelatex engine and causing it not to recognize that amsmath package is loaded.
In _quarto.yml
, I can change the engine to pdflatex
and it works. See last line here:
format:
quarto-thesis-pdf:
urlcolor: red
toclinkcolor: black
toc-depth: 2
pdf-engine: pdflatex
However I am not sure you have pdflatex. I am not sure that it comes by default with tinytex. I will try to figure out what in the (huge) cls file is causing xelatex to do this.
Found the problem! I should have found it sooner since I have actually fixed a similar problem before for another Quarto extension.
The fontenc
package causes xelatex not to render math correctly. So this line in _extension/partials/in-header.tex
caused the problem:
\usepackage[T1]{fontenc}
I have commented that out and pushed the fix to GitHub. You can update the extension or just go into that file and delete or comment out that line. It is used for international letters, but Quarto should take care of that with its tex headers.
Thanks for giving this a look. This bug is really strange. I found
$$
\int_{A_i}{\lambda (\pmb{\mu})}
$$ {#eq-ctl}
$$
\int_{A_i}{\lambda (\mathbf{\mu})}
$$ {#eq-ctl}
$$
\int_{A_i}{\lambda (\mathbf{x})}
$$ {#eq-ctl}
incorrectly gives for pdf
I don't know if it's worth reopening the issue because the use of \pmb
is probably fine in most cases, I'm just used to using \mathbf
from using LaTeX in the past. Interestingly, the html renders all 3 as expected

Those should render fine in pdf so I am reopening.
I tried running in just a default Quarto doc, so no cls file. The \mathbf{\mu}
issue seems to be a xelatex problem. But the \mathbf{x}
issue, is specific to quarto-thesis, so something in the header file is changing the behavior of \mathbf
With xelatex
With pdflatex
So for quarto-thesis, the issue is the \mathbf{x}
not rendering. The problem was this line in the header
\usepackage{mathpazo}
xelatex is more picky than pdflatex about font conflicts and it didn't like this. Using Palatino in math is weird anyhow, to I deleted that. Now \mathbf{x}
appears as intended. Note \mathbf{\mu}
does not appear with xelatex but that's a xelatex problem.
\pmb
has more consistent and expected behaviour than \mathbf
it seems. It's a strange error. I'll let you know if I find any more issues while I'm writing