I'm trying to use the \mathclap command in gitbook / bookdown, which needs the mathtools MathJax package. I have tried including the following LaTeX code in e.g. a fresh "Book project using bookdown":
$$
\require{mathtools}
\sum_{\mathclap{\substack{I \subseteq \{1, \dots, n\}, \\ I \ne \emptyset}}} a_I = b
$$
When loading the rendered html, Firefox console indicates that the mathtools extension is not loaded:
Loading failed for the <script> with source “https://mathjax.rstudio.com/latest/extensions/TeX/mathtools.js?V=2.7.2”.
Attempting to load that page gives the following error message:
404 Not Found
- Code: NoSuchKey
- Message: The specified key does not exist.
- Key: 2.7.2/extensions/TeX/mathtools.js
- RequestId: KMNCVEW8XK741T2F
- HostId: sF07HV8BhQrZnhlHLfUJt45C3I1VFzQ5FfqguxsLVySq8ghlIb2ZCVn13jriIh+o+/1irLl7zME=
This bug report suggests that using a custom MathJax url is not supported in bookdown currently, so I'm at a loss on how to get \mathclap support. I'd greatly appreciate any help.
And yes with gitbook(), this still needs to be fixed
we will prioritize that.
However, even in the current bookdown version, following new math support in last rmarkdown version, you can now use katex R package to render equation locally to included inside a Rmd document. Katex the JS library supports \mathclap
Even with this workaround, if you encounter issues, until we fix the issue with bookdown, you can also add to index.Rmd this yaml on top level
math: false
This will prevent mathjax to be included, but math will still be because katex R package is used.
However, even if Mathjax JS is still loaded, it should not do anything.