localkatex

Render math using KaTeX while building the site

To install, run nikola plugin -i localkatex

A plugin that renders math using a local KaTeX install.

Requirements

  • node.js installed, in $PATH, accessible as the node command
  • KaTeX accessible by Node (run npm install in this plugin’s folder)
  • USE_KATEX = True in config

You may also edit math_helper.tmpl to remove the KaTeX JavaScript includes (which are now unused).

Examples:

Inline:

Euler’s formula: {{% lmath %}}e^{ix} = \cos x + i\sin x{{% /lmath %}}

Display:

{{% lmath display=true %}}\int \frac{dx}{1+ax}=\frac{1}{a}\ln(1+ax)+C{{% /lmath %}}
{{% lmathd %}}\int \frac{dx}{1+ax}=\frac{1}{a}\ln(1+ax)+C{{% /lmathd %}}

Alternate name:

{{% localkatex %}}e^{ix} = \cos x + i\sin x{{% /localkatex %}}

The following options are supported: displayMode, display (alias), throwOnError, errorColor, colorIsTextColor — see KaTeX docs for details.

Suggested Configuration:

# Enable KaTeX styles
USE_KATEX = True

# Make sure you run `npm install` in this plugin’s directory.

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.