Skip to content

Commit

Permalink
Add config option to change MathJax renderer (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwu62 authored Jul 24, 2024
1 parent 542f21b commit 5dcce03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion inst/templates/bs4_book.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h2>On this page</h2>
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?:/, '');
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/gitbook.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h1>
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?:/, '');
Expand Down

0 comments on commit 5dcce03

Please sign in to comment.