Setting Jekyll on Ubuntu 16.04 with Latex support


Update July 2018:

This post is outdated as the issues stated at the time of writing are not issues anymore. It is still kept for potential interest.

When adapting TeXt theme, LaTex support is essential.

  • The first thing is about setting up both ruby and node.js environment on my Ubuntu machine. Installing Ruby and gem went smoothly, therefore setting up Jekyll is easy. But when I tried to install Node.js and npm, my Ubuntu constantly complained that it could not install the current stable version of Node.js, and it installed Node 4.2.6 instead, which in turn made the latest npm refuse to work with the old Node 4.2.6. Many people filed this problem already, but most of them did not work for me.

    The problem is caused by a discontinued ppa application, I need to remove it from /etc/apt/source.list and /etc/apt/source.list.d. This is the detailed solution

  • The second thing is to make LaTex work in Markdown. MathJax is the choice but there exists several ways to set up MathJax in Jekyll, and some of them just did not work for me. I did not have the time to dig out the reason but just wanted to find a quick solution. Eventually I made it work with these settings:

    1. Using kramdown engine for markdown.
    2. Putting <script type="text/javascript" src=""> </script> in TeXt theme’s _layouts/page.html. Be sure to use https, otherwise the rendering online could fail.
    3. Then I could write equations in LaTex! For inline equations, the expressions need to be embraced with double dollar sign like this: $$x$$. For independent lines, the expressions should start from a new line after $$, and the ending $$ should also stay in a new line.

Okay, that is it. I hope someone could find this post useful.