jemdoc+MathJax

※ Click here to see my interview with MathJax.org about jemdoc+MathJax.

jemdoc is a static site generator that is being widely used for creating simple academic websites like the one you are looking at now.

In addition to being lighter and easier to use than other static site generators, the ability to load LaTeX equations has been one of the reasons for jemdoc's popularity in creating adacemic websites. However, the original jemdoc loads LaTeX equations as PNG images, which can be pixelated on high-resolution displays or upon magnifying the webpage.

I have modified the original jemdoc code to support MathJax, which is “an open source JavaScript display engine for mathematics that works in all browsers” and has “high-quality typography” that is not pixelated. The modified code is called jemdoc+MathJax. The equations in this website are all created by jemdoc+MathJax.

System Requirements

  • Python 2 or Python 3

(Many thanks to Ganesh Ajjanagadde, who made most of the changes for Python 3 compatibility.)

Download

Press the “Download ZIP” button in the right panel of jemdoc+MathJax's GitHub page.

Examples

Here are LaTeX equation rendering examples taken from the MathJax samples page, demonstrating the perfect support of MathJax in jemdoc+MathJax.

  • Quadratic Formula

\[ \begin{equation} x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}\label{eq:lorentz} \end{equation} \]

  • Cauchy's Integral Formula

\[ \begin{equation} f(a) = \frac{1}{2\pi i} \oint_\gamma \frac{f(z)}{z-a} dz \end{equation} \]

  • Angle Addition Formula for Cosines

\[ \begin{equation} \cos(\theta + \varphi) = \cos\theta \cos\varphi - \sin\theta \sin\varphi \end{equation} \]

  • Gauss’ Divergence Theorem

\[ \begin{equation} \int_D (\nabla \cdot \mathbf{F}) \, dV = \int_{\partial D} \mathbf{F} \cdot \mathbf{n} \, dS \end{equation} \]

  • Curl of a Vector Field

\[ \begin{equation} \nabla \times \mathbf{F} = \left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right) \mathbf{\hat{i}} + \left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right) \mathbf{\hat{j}} + \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right) \mathbf{\hat{k}} \end{equation} \]

  • Standard Deviation

\[ \begin{equation} \sigma = \sqrt{\frac{1}{N} \sum_{i=1}^N (x_i - \mu)^2} \end{equation} \]

  • Definition of Christoffel Symbols

\[ \begin{equation} (\nabla_X Y)^k = X^i (\nabla_i Y)^k = X^i \left(\frac{\partial Y^k}{\partial x^i} + \Gamma_{im}^k Y^m \right) \end{equation} \]

Click here to see additional examples.

Note that the usual tasks you perform on equations in LaTeX, such as automatic equation numbering and hyperlinking, are all supported in jemdoc+MathJax, as can be seen in the hyperlinked equation number in “Eq. \(\eqref{eq:lorentz}\).”

You can see the LaTeX codes for the above equations by right-clicking the individual equations and selecting “Show Math As > TeX Commands.”

How to Use

Once you download jemdoc+MathJax, you can install and use it like the original jemdoc. See the jemdoc user guide, especially the example page.

The additional features introduced in jemdoc+MathJax on top of the original jemdoc are as follows:

  • MathJax support

  • Underscore

  • Link opening in the current web broswer tab (like this) or in a new tab (like this)

  • Works on both Python 2 and 3

The usage of these new features can be found in the example/ directory in the downloaded jemdoc+MathJax package.

jemdoc+MathJax in Action

Here are a few websites found on Google that show the actual usage of jemdoc+MathJax: