Skip to content

Commit 6631cfe

Browse files
Merge pull request #158 from Trivadis/bugfix/issue-157-arithmatex-rendering
Bugfix/issue 157 arithmatex rendering
2 parents a1ec24d + 5eb0a8f commit 6631cfe

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

docs/javascripts/mathjax.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
window.MathJax = {
2+
tex: {
3+
inlineMath: [["\\(", "\\)"]],
4+
displayMath: [["\\[", "\\]"]],
5+
processEscapes: true,
6+
processEnvironments: true
7+
},
8+
options: {
9+
ignoreHtmlClass: ".*|",
10+
processHtmlClass: "arithmatex"
11+
}
12+
};
13+
14+
document$.subscribe(() => {
15+
MathJax.typesetPromise()
16+
})
17+

mkdocs.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,21 @@ theme:
1818
accent: 'red'
1919

2020
extra_css:
21-
- 'stylesheets/extra.css'
21+
- stylesheets/extra.css
2222
extra_javascript:
23-
- 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'
23+
- javascripts/mathjax.js
24+
- https://polyfill.io/v3/polyfill.min.js?features=es6
25+
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
26+
2427
markdown_extensions:
2528
- admonition
2629
- pymdownx.highlight:
2730
linenums: true
2831
linenums_style: table
2932
- pymdownx.superfences
3033
- pymdownx.inlinehilite
31-
- pymdownx.arithmatex
34+
- pymdownx.arithmatex:
35+
generic: true
3236
- footnotes
3337

3438
extra:

tools/run-in-container/genpdf.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function create_target_dir(){
88
function copy_resources() {
99
cp ${DATA_DIR}/mkdocs.yml ${TARGET_DIR}/mkdocs.yml
1010
cp -r ${DATA_DIR}/docs/images ${TARGET_DIR}/docs
11+
cp -r ${DATA_DIR}/docs/javascripts ${TARGET_DIR}/docs/javascripts
1112
cp -r ${DATA_DIR}/docs/stylesheets ${TARGET_DIR}/docs/stylesheets
1213
}
1314

@@ -19,7 +20,12 @@ function copy_resources() {
1920
# with some nice features for the HTML version.
2021
function fix_mkdocs_yml() {
2122
mv ${TARGET_DIR}/mkdocs.yml ${TARGET_DIR}/mkdocs.ori.yml
22-
sed -e 's/linenums_style: table/linenums_style: pymdownx-inline/g' ${TARGET_DIR}/mkdocs.ori.yml > ${TARGET_DIR}/mkdocs.yml
23+
sed -e 's/linenums_style: table/linenums_style: pymdownx-inline/g' ${TARGET_DIR}/mkdocs.ori.yml | \
24+
sed -e 's|javascripts/mathjax.js|https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML|g' | \
25+
sed -e 's| - https://polyfill.io/v3/polyfill.min.js?features=es6||g' | \
26+
sed -e 's| - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js||g' | \
27+
sed -e 's/pymdownx.arithmatex:/pymdownx.arithmatex/g' | \
28+
sed -e 's/ generic: true//g' > ${TARGET_DIR}/mkdocs.yml
2329
}
2430

2531
function create_cover() {

0 commit comments

Comments
 (0)