Skip to content
Generate commutative diagrams inside of Pandoc with Tikz
Branch: master
Clone or download
sdiehl Merge pull request #3 from christian-marie/master
Fix pandoc and optparse-applicative changes, drop upper bounds
Latest commit 1b2ebf1 Jul 6, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
misc Initial commit. Aug 21, 2012
src Fix pandoc and optparse-applicative changes, drop upper bounds Jul 3, 2017
texinclude Initial commit. Aug 21, 2012
.gitignore Initial commit. Aug 21, 2012
LICENSE Initial commit. Aug 21, 2012
README.md Added install directions. Aug 21, 2012
Setup.hs Initial commit. Aug 21, 2012
cats.cabal Fix pandoc and optparse-applicative changes, drop upper bounds Jul 3, 2017

README.md

cats

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

Installation

$ cd cats
$ cabal install

Usage

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:

    ```commute
    \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:

Illustration

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:

\documentclass{article}
\include{preview}
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{preview}
\begin{tikzpicture}[node distance=2cm, auto]

And the postamble:

\end{tikzpicture}
\end{preview}
\end{document}

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

You can’t perform that action at this time.