Update: I think the problem is related to these two bookdown-bug reports: Cannot load mathtools MathJax extension in bookdown and Custom MathJax URL not working. The problem is that the upgreek extension requires MathJax V3, but bookdown/Rstudio uses the outdated V2.7. According to those bugs it is at present not possible to use V3 in bookdown.
Writing a text with Bookdown I would like to use upright Greek letters in maths. MathJax provides the upgreek extension for this, but I do not manage to load it or make it work in Bookdown. This is what I tried:
Following the Bookdown manual, I created an html file called "mathjax.html", containing the following script:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
loader: {load: ['[tex]/upgreek']},
TeX: { TagSide: "right" }
});
</script>
then I include:
d it in the "_output.yml" configuration file:
bookdown::gitbook:
includes:
in_header: mathjax.html
[...]
But upgreek letters are still not rendered (for example, an $\uppi$
outputs a red \uppi
, signaling an unknown macro).
I don't understand where the problem is. The MathJax config script above tries to follow both the instruction in the Bookdown manual, which uses MathJax.Hub.Config({});
, and the instruction in the MathJax manual, which instead uses window.MathJax = {};
. I tried also using the latter, but upgreek letters are still not rendered. I'm quite ignorant about the syntax of these kinds of script.
My general question is: how can I make Bookdown load particular MathJax packages?