pandoc
is installed
- Download and extract https://github.com/hakimel/reveal.js/archive/master.zip
(Will unzip revealjs to folder
wget https://github.com/hakimel/reveal.js/archive/master.zip unzip master.zip
reveal.js-master
.) - Install mathjax:
npm install mathjax@3
- Configure pandoc revealjs template for MathJax3:
-
Step by step:
-
download https://github.com/jgm/pandoc-templates/blob/master/default.revealjs
-
add in
$if(mathjax)$ ... $endif$
enclosing:mathjax3: { mathjax: '$mathjaxurl$', tex: { inlineMath: [[ '$$', '$$' ], [ '\\(', '\\)' ]] }, options: { skipHtmlTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ] }, },
(note the double
$
signs in contrast to the revealjs documentation) and replaceRevealMath
plugin byRevealMath.MathJax3
inplugins: [...]
list.(As of 2024-01-22, the
default.revealjs
file seems to be set up for MathJax2.)
-
-
Automatic via patch (works with https://github.com/jgm/pandoc-templates/blob/bc7a16b590122a2dc99d1f17f222b72152acc1e7/default.revealjs):
wget https://raw.githubusercontent.com/jgm/pandoc-templates/master/default.revealjs patch -p0 < mathjax3.patch mv default.revealjs template.md
-
Example: see
template.md
file of this repository
-
- Set
mathjaxurl
in the header of the presentation markdown file:
mathjaxurl: node_modules/mathjax/es5/tex-mml-chtml.js
for the local installationmathjaxurl: /usr/share/mathjax/tex-mml-chtml.js
or similar for a (possible) system packagemathjaxurl: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
for the CDN package (works only with an internet connection; default whenmathjaxurl
is not specified)
Assuming, the revealjs
and node_modules
folders, pandoc template (modified default.revealjs
, renamed template.md
) and presentation markdown file (pres.md
) are all located in the current path:
pandoc -s --mathjax -i -t revealjs pres.md --template=template.md -V center=false -V history=false -V revealjs-url=reveal.js-master -o pres.html
Alternatively, the
Makefile
can
be used to invoke the pandoc command, via
make
It detects automatically, if a template.md
file is present.