diff --git a/NEWS.md b/NEWS.md index 1191cc4ce..438a005a2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # CHANGES IN bookdown VERSION 0.41 +- New `mathjax-config` option for `bs4_book` and `gitbook` to control MathJax config string (thanks, @bwu62, #1472). The option can be set either in the YAML metadata or as a variable in `pandoc_args`. Currently tested and supported settings: + - If empty, defaults to original `TeX-MML-AM_CHTML` which renders all equations in common HTML. + - If set to `TeX-AMS-MML_HTMLorMML` renders equations in HTML + CSS (which may look nicer for some equations). + - If set to `TeX-MML-AM_SVG` renders equations in SVG. # CHANGES IN bookdown VERSION 0.40 diff --git a/inst/templates/bs4_book.html b/inst/templates/bs4_book.html index 68578084c..31309342c 100644 --- a/inst/templates/bs4_book.html +++ b/inst/templates/bs4_book.html @@ -158,7 +158,7 @@

On this page

var script = document.createElement("script"); script.type = "text/javascript"; var src = "$if(mathjax)$$mathjax$$endif$"; - if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML"; + if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=$if(mathjax-config)$$mathjax-config$$else$TeX-MML-AM_CHTML$endif$"; if (location.protocol !== "file:") if (/^https?:/.test(src)) src = src.replace(/^https?:/, ''); diff --git a/inst/templates/gitbook.html b/inst/templates/gitbook.html index 2f6d35819..126472e15 100644 --- a/inst/templates/gitbook.html +++ b/inst/templates/gitbook.html @@ -205,7 +205,7 @@

var script = document.createElement("script"); script.type = "text/javascript"; var src = "$if(mathjax)$$mathjax$$endif$"; - if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML"; + if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=$if(mathjax-config)$$mathjax-config$$else$TeX-MML-AM_CHTML$endif$"; if (location.protocol !== "file:") if (/^https?:/.test(src)) src = src.replace(/^https?:/, '');