Mathjax (the javascript library) renders mathematical equations in a web page. But it's heavy and may not be supported everywhere. For example, Github Wiki does not allow use of external javascript libraries. HTML pages with bitmap equations are light and with as little dependency as possible.
This script generates png images from equations in a (R)Markdown document and replace an equation enclosed in $ or $$ with a reference to the rendered image.
In a Debian based OS:
sudo apt install bash texlive-base grep sed imagemagick
# install required latex packages
tlmgr install array standalone mathtools amssymb amsthm
git clone https://github.com/faridcher/math2img
cd math2eqn
chmod +x eqn2img.sh
# first argument is an auto-created directory to put the images and a (Github) Markdown document is read from stdin
./math2img eqn < gfm.md
- A Pandoc filter
- GladTex written in Python; use it in combination with
pandoc --gladtex
option. - math2img written in Perl
Relative to the above alternatives, this script is simpler and minimal dependencies.
- Only works with equations enclosed in single $ for inline and double dollar sign ($$) for display equations
- Sed scripts are concise but notorious for not being readable and hence this Bash script as well
- Support [] for display and () for inline equations
GPL v2