Generate commutative diagrams inside of Pandoc with Tikz
TeX Haskell
Latest commit daa6c84 Jan 10, 2014 @sdiehl add options to command line
Failed to load latest commit information.
misc Initial commit. Aug 21, 2012
src add options to command line Jan 10, 2014
texinclude Initial commit. Aug 21, 2012
.gitignore Initial commit. Aug 21, 2012
LICENSE Initial commit. Aug 21, 2012 Added install directions. Aug 21, 2012
Setup.hs Initial commit. Aug 21, 2012
cats.cabal add options to command line Jan 10, 2014


Buildchain to generate commutative diagrams inside Pandoc markdown with LaTeX + Tikz.

In addition to the Haskell infastructure for Pandoc you will need:

  • One of the following TeX compilers: pdflatex, xetex, lualatex
  • inkscape
  • ghostscript


$ cd cats
$ cabal install


You want to compile this:

    The following diagram proves the existence and uniqueness of the
    canonical duality between coherent sheaves on spectral sites of stacks
    of quotient moduli spaces of pointed curves with fixed ultragenus and
    the category of categories fibered in megaloid over an abelian smooth
    autoisotropic of general type category:

    \node (P) {$P$};
    \node (B) [right of=P] {$B$};
    \node (A) [below of=P] {$A$};
    \node (C) [below of=B] {$C$};
    \node (P1) [node distance=1.4cm, left of=P, above of=P] {$\hat{P}$};
    \draw[->] (P) to node {$f$} (B);
    \draw[->] (P) to node [swap] {$g$} (A);
    \draw[->] (A) to node [swap] {$f$} (C);
    \draw[->] (B) to node {$g$} (C);
    \draw[->, bend right] (P1) to node [swap] {$\hat{g}$} (A);
    \draw[->, bend left] (P1) to node {$\hat{f}$} (B);
    \draw[->, dashed] (P1) to node {$k$} (P);

    As a consequence, the isotrivial families of superconnected unimodular
    curves are self-dual with respect to the motivic theory of ultrafilters.
    The entirety of mathematics and logic then trivially follows as a
    consequence. The proof is left to the reader.

Into this:


You can either invoke from the commandline.

$ cat yourfile | cats

Or integrate with your existing Pandoc program:

import Data.Pandoc.Tikz

doTikz :: Block -> IO Block

In your CWD you will need two files. The preamble.tex and a postamble.tex as well as any libraries needed by these files.

For example, for a simple commutative diagram using preview package. The preamble is:

\begin{tikzpicture}[node distance=2cm, auto]

And the postamble:


Path Munging

Depending on your TeX distribution you may have to modify TEXINPUTS to include various Tikz or preview libraries.

$ export TEXINPUTS=./texinclude:$TEXINPUTS

Hakyll Integration