Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to change MathJax renderer #1472

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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