Yesterday a friend of mine, who I force to read my blog, asked me how I write blogs that require lot of math equations. For his convenience, I am documenting the steps here in case it helps him and anyone else.

  • Write the blog in LyX. LyX is an open-source document processor that allows one to write professional looking documents. It supports LaTeX, which is great for creating math-heavy content. I have created an AutoHotkey file (please download it here) that allows to invoke shortcuts really easily, e.g., pressing shift twice quickly will start the inline math mode (equivalent to $$ in LaTeX), typing \df and then pressing tab will start a displayed equation (equivalent to \[ \] in LaTeX) etc. For equations, use these two modes ($$ and \[\]) only. If equation numbering is required then we have to do it manually. Here is an inline equation: \(E=mc^{2}\). Here is a displayed equation \[a^{2}+b^{2}=c^{2}\quad(1).\]

  • Convert the file to LaTeX. After we are done, we convert the document to LaTeX as follows: File -> Export -> LaTeX (plain).

  • Convert the LaTeX file. Now we convert the .tex file into a .html file using Pandoc. Install it if you do not have it. In Linux terminal (there are similar codes for Windows and Mac OS X) we type (without the quote): pandoc -s name-of-the-file.tex --mathjax -o name-of-the-file.html.

  • Preparing the .html file for Jekyll. Now we open the created .html file using a text editor and add the following info at the beginning.

--- 
layout: post 
title: Name of the blog 
categories: [Catagory 1, Catagory 2] 
tags: [Tag 1, Tag 2] 
comments: true 
---

At some place in the .html write

 <!-- more --> 

. Whatever appears before this will appear as a highlight of your blog on the homepage. Now we save the .html file and rename it as YYYY-MM-DD-Name-of-the-blog.html. Now we just copy the .html file in the _posts folder of our Jekyll blog. That’s it!