Getting equations in Jekyll is not hard, but it was annoying to figure out how to do it. Many things come up when you search, but most are outdated. Here’s what worked for me.
I added the following to my _includes/head.html
:
That’s it.
Then you need TWO dollar signs for most Latex, to keep kramdown
from messing with it. Inline works like normal (i.e., normal except for the two-dollar-sign thing), and display equations are automatic if they are on their own line.
Some inline Latex: $$a^2 + b^2 = c^2$$
Some inline Latex: \(a^2 + b^2 = c^2\)
Display equation:
$$\int e^{-kx} \, dx = -\frac{1}{k} e^{-kx}$$
Display equation:
\[\int e^{-kx} \, dx = -\frac{1}{k} e^{-kx}\]