In this post, I’ll write about how I integrated latex typesetting into beautiful-jekyll based web page. Check out beautiful-jekyll website to learn more about how to set up a personal website/blog within minutes.

I used mathjax version 3.0 for writing latex. One of the nice things about beautiful-jekyll is that a lot of options are supported out of the box. So, it’s just a matter off specifying some options instead of writing them yourself.

To start, we’ll look at the _config.yml file. YAML files contains fields as name:value pair. Scroll down to the end until you find markdown field. It should be set to kramdown. A few lines below that you should find:

The input field should be set to GFM. You just have to add math_engine: mathjax.

That’s all there is to tweak in the _config file.

Now browse to /_includes/head.html. At the bottom of the page, before the </head> tag, add the following lines:

You’ll find the detailed explanation of the various fields and their uses on MathJax 3.0 Documentation. I won’t bother you with the details here.

That’s all you need to do. You can now start writing latex.

One thing to look out for is to be careful about writing latex in markdown files. MathJax doesn’t support \emph, \begin{enumerate} ... \end{enumerate} or other text-mode macros or environments. You have to use HTML or markdown to handle such formatting tasks.

Also check out this awesome stackexchange post for a comprehensive reference to writing MathJax!

If you have any questions, feel free to contact me!