A program for creating and managing a static weblog with LaTeX math and diagrams

Latest on Hackage:0.6

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Jonathan Daugherty


mathblog is a Haskell program targeted at people who want to write statically-generated, mathematically-themed weblogs. It supports:

  • Extended Markdown input syntax as supported by the Pandoc library

  • Inline and block-level TeX math rendered by MathJax or LaTeX

  • Function graphing with TikZ / pgfplots LaTeX packages

  • Integration of Javascript-based web services such as Disqus

  • Template-based document rendering with support for layout and style customization

Getting Started

See the manual PDF in doc/.

Project vision

I wrote mathblog with a very specific set of requirements in mind, motivated by the following principles:

  • A blog should be easy to create, host, and update.

  • A blog should be easy to maintain.

  • I should be able to edit posts in my editor of choice and write them in an intelligent textual markup language.

  • It should be easy to embed high-quality mathematical symbols and equations in the blog posts.

As a result, mathblog has the following properties:

  • The software is composed of a single executable which will automatically take care of creating your blog and regenerating pages when your post markup changes.

  • All content is stored in plain text files and is generated statically. No database or web framework is used.

  • A mathblog can be hosted with a simple static fileserver such as thttpd, Lighttpd, or Apache.

  • Blog posts are written in the Markdown format with extensions, as supported by the Pandoc document converter.

  • Math is embedded with $...$ or \(...\) for inline math and $$...$$ or \[...\] for block-level math.

These properties have some nice advantages; your blog content is cacheable and can be subjected to revision control. Posts are easy to edit and editing doesn't require a web browser. The static file representation model means you can compose a blog post on your laptop and get it just right using a local installation of mathblog, then push it up to your server to post it to your public blog.


mathblog takes advantage of three primary software components:

  • Pandoc, a document-processing library.

  • Math typesetting packages:

    • MathJax if you choose mathjax for the value of the mathBackend configuration setting. mathblog uses the MathJax CDN for MathJax resources.
  • Function graph plotting packages:

    • The TikZ and pgfplots LaTeX packages if you set tikz = yes in your config. This is the recommended backend for function graph plotting.



  • Added support for building with GHC 7.10
  • doc: update manual-generating scripts to assume "mb" is installed a cabal sandbox
  • Propagate Pandoc loading errors to top level via EitherT
  • Fix read-then-close (lazy IO) (thanks Thomas M. DuBuisson (
  • Un-bitrot (wrt system-filepath and old-locale/pandoc) (thanks Thomas M. DuBuisson (
  • Update to use Pandoc 1.12, JuicyPixels 3.1
  • Render images at double DPI, then shrink in the HTML (read: support retina displays!)
  • Stop using greadlink in manual scripts
  • Move Mathjax configuration from Haskell code to page template (fixes #11)
  • Add browser reloading support to blog regeneration
  • Add built-in HTTP server in listen mode
  • manual: actually run "mb" to generate "mb" output in the manual
  • Discontinue support for Gnuplot
  • Start to use fsnotify
  • Added manual
  • mathjax: include cancel extension
  • bugfix: use correct indexing when generating next/prev post links
  • Remove support for gladtex
  • bugfix: only consider .html files when checking for modified templates
  • Feature: parse date from blog post header and include in RSS feed
  • Feature: add support for page-wide TeX macro blocks (#tex-macros) for both Mathjax and TikZ
  • Add more packages to TikZ preamble, enable AMS extensions in mathjax
  • Mathjax: turn on AMS equation numbering, also print tikz source on tikz failure
  • tikz: add calc tikzlibrary
  • Rename -h/--html-dir to -o/--output-dir, add -h/--help and -v/--version
  • CHANGE: rename MBBASEDIR to MBDATADIR, --baseDir to --data-dir; also remove default output directory behavior
  • Fixed typos in the documentation (thanks Peter Simons (
comments powered byDisqus