Cannot load mathtools MathJax extension in bookdown

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":

\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 “”.

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.

Yes bookdown will use mathjax 2.7 by default and mathtools has been added to mathjax 3.2 (What’s New in MathJax v3.2 — MathJax 3.2 documentation)

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

  math_method: r-katex

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.

We'll fix this soon.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.