# set URL and HMAC secret key # (note: replace value of MATHYD_HMAC_KEY with your own randomly # generated one) export MATHYD_URL="http://whatever.example.com:3000/" export MATHYD_HMAC_KEY="2dhXA3HTmfEMq2d5" # render output bin/mathy < cubic.tex > cubic.svg
Given this input file, the command above produces the following result:
You can install and run the Mathyd Docker image with a single command:
# run mathyd as a daemon on port 3000 # (note: replace value of MATHYD_HMAC_KEY with your own randomly # generated one) docker run --rm -d -e MATHYD_HMAC_KEY="2dhXA3HTmfEMq2d5" -p 3000:3000 pablotron/mathyd:latest
- Be sure to generate your own HMAC secret key rather than reusing the key from the examples above.
- Don’t expose Mathyd via a publicly-accessible URL; it does not support TLS and MathJax may use a lot of memory for large input files. If you really do want to do this, then you’ll need to proxy the Mathyd endpoint behind Apache or nginx on an authenticated, TLS-encrypted URL.
Under the hood, Mathyd is just:
- A JSON-encoded body of input parameters.
- A hex-encoded, SHA-256 HMAC of the body and the HMAC
secret key in the
The endpoint does the following:
A command-line client, written in Ruby, which:
I prefer TeX over other formats because it’s still the least-worst format for complex math formulas.
I prefer SVGs over bitmap images whenever possible because:
- SVGs scale to any screen size and resolution. This is particularly useful for responsive design.
- SVGs are supported by all modern browsers, including mobile browsers.