Skip to content

# sliminality/pandoc-theorem

Write LaTeX theorems in Pandoc Markdown
Haskell Makefile
sliminality Merge pull request #2 from Fate6174/add_some_more_tags
add tags and modify README
Latest commit 0b5e402 Nov 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Jun 28, 2019
examples Jun 28, 2019
src Jul 25, 2019
test Jun 28, 2019
.gitignore Jun 28, 2019
ChangeLog.md Jun 22, 2019
LICENSE Jun 22, 2019
Makefile Jun 28, 2019
README.md Jul 25, 2019
Setup.hs Jun 22, 2019
native Jun 28, 2019
package.yaml Jun 28, 2019
stack.yaml Jun 22, 2019

# pandoc-theorem

A Pandoc filter to convert definition lists into amsthm theorem environments, for compiling to PDF and LaTeX.

The extension supports the following theorem environments:

Supported environment Supported Markdown identifiers
definition Definition, Def
theorem Theorem, Thm
lemma Lemma
proof Proof, Pf
example Example, Ex
assumption Assumption

Note that compilation targets other than PDF and LaTeX have not been tested. Notably, this includes HTML.

## Example

Given the following Markdown:

Lemma (Pumping Lemming). \label{pumping}

:   Let $L$ be a regular language. Then there exists an integer $p \geq 1$ called the "pumping length" which depends only on $L$, such that every string $w \in L$ of length at least $p$ can be divided into three substrings $w = xyz$ such that the following conditions hold:

- $|y| \geq 1$
- $|xy| \leq p$
- $xy^n z \in L$, for all $n \geq 0$.

That is, the non-empty substring $y$ occurring within the first $p$ characters of $w$ can be "pumped" any number of times, and the resulting string is always in $L$.

we transform it into this PDF output:

equivalent to this LaTeX:

\begin{lemma}[Pumping Lemming] \label{lem}

Let $$L$$ be a regular language. Then there exists an integer
$$p \geq 1$$ called the pumping length'' which depends only on $$L$$,
such that every string $$w \in L$$ of length at least $$p$$ can be
divided into three substrings $$w = xyz$$ such that the following
conditions hold:

\begin{itemize}
\tightlist
\item
$$|y| \geq 1$$
\item
$$|xy| \leq p$$
\item
$$xy^n z \in L$$, for all $$n \geq 0$$.
\end{itemize}

That is, the non-empty substring $$y$$ occurring within the first $$p$$
characters of $$w$$ can be pumped'' any number of times, and the
resulting string is always in $$L$$.

\end{lemma}

## Usage

### Installation

You must have Pandoc installed and available in your PATH.

You can either download a prebuilt binary from the Releases page, or clone and stack install this repository, which copies the pandoc-theorem-exe binary to your global Stack install location.

Check that pandoc-theorem-exe is in your PATH:

### Single inline theorem

Proof.
: By induction on the structure of the typing judgment.

### Multiple inline theorems

Def (Coq).
:   A dependently-typed programming language often used for interactive theorem proving.
:   A video game that doesn't mean you understand the underlying theory, according to Bob.

### Regular definition lists still work

If you do not start a definition list with one of the recognized identifiers, the definition list will compile as usual.

Groceries
: Bananas
: Lenses
: Barbed wire
Programming language checklist

:     *Strictures:* Does the language have sufficiently many restrictions? It is always easier to relax strictures later on.

:     *Affordances:* Actually, these don't really matter.

## Acknowledgements

In addition to John MacFarlane's incredible work on Pandoc itself, this filter benefited from the following prior efforts:

You can’t perform that action at this time.