LaTeX
How to add LaTeX support via MathJAX
The course repos support embedded Math notation using MathJAX provided you turn this on
in your _config.yml settings.
In addition to understanding how to use use MathJAX, it may also be helpful to understand a bit about how Kramdown, the dialect of Markdown we are using handles Math blocks:
Enabling LaTeX
To enable LaTeX support via MathJAX:
-
You’ll need the URL to load MathJAX from a CDN (Content Delivery Network) with the options you want.
When this documentation was written on 2019-01-03, this was a reasonable choice of URL:
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTMLYou may want to check the MathJAX website to see if there is a more recent one before continuing with these instructions. If so, use that instead.
The part after
configin that URL is also something you may want to customize for your purposes. -
In the
_config.ymlfile, search for the stringhead_scripts, and determine whether it is already defined or not. This key is defined as a list of strings, each of which is the URL of a JavaScript files that should be loaded after all of the standard ones that are part of the Jekyll theme. -
If
head_scriptsis not already defined, add the following definition, using the URL from the first step.head_scripts: - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML -
If
head_scriptsis already defined, add the URL to the list of scripts. For example:Change:
head_scripts: - /static/my_custom_script.jsTo:
head_scripts: - /static/my_custom_script.js - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML