-
In Quarto's default rendering, HTML and PDF use different math fonts:
will render in HTML/MathJax (and almost identically in KaTeX) as: and in PDF/LaTeX with XeLaTeX engine as: I'm trying to write a Quarto book with consistent presentation between HTML and PDF version. I have been trying around with several (Ideally, it would just be the same glyphs in PDF as in KaTeX; and for other compatibility reasons, I cannot fallback to Reproducible Document---
title: "Reproducible Quarto Document"
format: pdf # html
pdf-engine: xelatex
html-math-method: katex
---
$$\mathcal P (\mathbb N) ≠ \varnothing$$ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
HTML fonts have fallbacks if the font does not exist on the computer displaying the page, especially if the font is not provided with the page. So you can check the library and/or use your favourite browser to look for the font being used and use the same. For example, the MathJax documentation: https://docs.mathjax.org/en/latest/output/fonts.html |
Beta Was this translation helpful? Give feedback.
-
I've now found out through which hoops to jump in order to make the XeLaTeX/PDF-output look akin to LaTeX's original PDF style / MathJax: This is generated from: ---
title: "Reproducible Quarto Document"
pdf-engine: xelatex
html-math-method: katex
format:
pdf:
mathfont: NewCMMath-Regular.otf
include-in-header:
text: |
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\setmathfont{Linux Libertine O}[range={\varnothing}]
---
$$\mathcal P (\mathbb N) ≠ \varnothing$$ Tricks:
(The workaround can be shortened a bit by using |
Beta Was this translation helpful? Give feedback.
I've now found out through which hoops to jump in order to make the XeLaTeX/PDF-output look akin to LaTeX's original PDF style / MathJax:
This is generated from:
Tricks:
\…