A second blog post of the “Quarto Q&A” series.
This time, I will show how to activate additional MathJax packages in a Quarto document.
1 The Question/Problem
Sometimes you want to use additional MathJax packages in a Quarto document, such as being able to use \qty
from physics
or upper/lower case Greek letters from upgreek
.
2 The Answer/Solution
The solution is to load the additional packages in the include-in-header
key of the YAML header, using JavaScript as documented on MathJax documentation.
You can load several packages at once, as shown in the example below.
---
title: "Quarto MathJax"
format:
html:
html-math-method: mathjax
include-in-header:
- text: |
<script>
window.MathJax = {
loader: {
load: ['[tex]/upgreek', '[tex]/boldsymbol', '[tex]/physics']
},
tex: {
packages: {
'[+]': ['upgreek', 'boldsymbol', 'physics']
}
}
};
</script>
---
$$
\rank(\boldsymbol{\Upsigma}) $$
3 More on MathJax Extensions/Macros
See https://docs.mathjax.org/en/latest/input/tex/extensions/index.html for more information on MathJax LaTex extensions. See https://docs.mathjax.org/en/latest/input/tex/macros/index.html for more information on MathJax LaTeX macros.