Not possible use a newer version of Mathjax
MathJax has some packages optional. One of them is gensymb that can't be loaded via \require. If i still do \require{gensymb} then i see the message in the browser's console that says:
GET https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/extensions/TeX/gensymb.js?V=2.7.9 net::ERR_ABORTED 404
First thing to notice here is that an outdated version of MathJax will be referenced automatically. The current version should be 3.
The second thing to notice is that gensymb.js isn't available at the given address. So i followed the instruction at MathJax's homepage by adding these two snippets into my JS file that i use for adding elements to the page and there was no change in the outcome. i also have a current address inside _output.yml:
bookdown::bs4_book:
css: style.css
includes:
in_header: js.html
repo: https://github.com/piiskop/manual-for-rstudio
math_method:
engine: mathjax
url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js
That current address won't be used as i see in the console that it still tries to access the version 2.7.9.
As here is requested the session info i add it:
xfun::session_info('bookdown')
R version 4.2.1 (2022-06-23) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.4 LTS, RStudio 2022.2.2.485
Locale: LC_CTYPE=et_EE.UTF-8 LC_NUMERIC=C LC_TIME=et_EE.UTF-8 LC_COLLATE=et_EE.UTF-8 LC_MONETARY=et_EE.UTF-8 LC_MESSAGES=et_EE.UTF-8 LC_PAPER=et_EE.UTF-8
LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=et_EE.UTF-8 LC_IDENTIFICATION=CPackage version: base64enc_0.1.3 bookdown_0.27.3 bslib_0.4.0 cachem_1.0.6 digest_0.6.29 evaluate_0.15 fastmap_1.1.0 fs_1.5.2 glue_1.6.2 graphics_4.2.1 grDevices_4.2.1 highr_0.9
htmltools_0.5.3 jquerylib_0.1.4 jsonlite_1.8.0 knitr_1.39 magrittr_2.0.3 memoise_2.0.1 methods_4.2.1 R6_2.5.1 rappdirs_0.3.3 rlang_1.0.4 rmarkdown_2.14 sass_0.4.2
stats_4.2.1 stringi_1.7.8 stringr_1.4.0 tinytex_0.40 tools_4.2.1 utils_4.2.1 xfun_0.31 yaml_2.3.5
There are two issues in one here:
- R Markdown ecosystem uses mathjax 2.7 by default - we recently updated to latest 2.7.9 in https://github.com/rstudio/bookdown/pull/1355 waiting for our CDN version to be updated https://github.com/rstudio/rstudio/issues/11535
For context, Mathjax 2 is still used by default because switching to 3 would break some existing content. Example of breakage possible: https://github.com/mathjax/MathJax/issues/2312 but there will be others probably.
- However, it should be possible to use custom mathjax. It was made possible recently in rmarkdown, but maybe we have an issue in bookdown that does not make it work despite our recent change. Possibly related to https://github.com/rstudio/bookdown/issues/915 which require a not-so-small rewrite of this code part.
Thanks for the report, we'll look into this.