Adding LaTeX Support to AsciiDoc and Jekyll on Ubuntu
-
Ensure that Ubuntu’s software repositories are up to date
$ sudo apt update
-
Install the complete TeX package
$ sudo apt install texlive-full
-
Install the Asciidoctor LaTeX Plugin
$ sudo gem install asciidoctor-latex --pre
-
Create a new document and set the
stem
variable tolatexmath
to ensure that LaTeX is the interpreter for all Stem blocks in this document.:stem: latexmath
-
If you followed the recommendation in a previous post, Customize the Jekyll Footer, then adding the following remote reference to
MathJax.js
at the top your custom_includes/footer.html
file is trivial. Otherwise, follow the link for details on how to set up this footer override._includes/footer.html<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML-full"> </script>
-
Create a Stem block with your TeX equation or other LaTeX-specific text. Remember to use the block delimiter ++++ to enclose mutliple lines of \(\LaTeX{}\) content.
[stem] ++++ $y = \int_0^\infty \gamma^2 \cos(x) dx$ ++++
-
View your new Jekyll static site in a web browser: http://localhost:4000
Replace localhost with the hostname or domain name of your remote server if your Jekyll installation is not on your local workstation.
-
The rendered equation in the example should look like this.