Example source
The example is rendered from this Markdown. The same file drives the test suite.
---
amsthm:
counter_depth: 2
definition:
- Definition
name_to_text:
KL: Klein's Lemma
parent_counter: section
plain:
- Theorem:
- Lemma
- Corollary
- With Space\*
- Proposition: Conjecture
- WithoutSpace
- KL
remark:
- Case
counter_ignore_headings:
# include these if you use pandoc-crossref
# which are auto-generated by it
- List of Figures
- List of Tables
- List of Listings
---
# Demo
::: {.Theorem info="within parenthesis"}
plain theoremstyle *here*
We can use pandoc-crossref style @simplestEquation and [@simplestEquation]
and cite before definition.
:::
::: {#simplestEquation .Theorem}
Label and reference:
$$E=mc^2$$
:::
From the \ref{simplestEquation}, we see that...
Or \eqref{simplestEquation}, ...
Or with its name, @SimplestEquation.
::: {.With_Space info="**This** is *markdown*."}
Environment name has a space, and is unnumbered.
:::
::: {.Lemma info="can cite \ref{simplestEquation}"}
This one share counter with Theorem.
:::
::: {.Definition info="pandoc-crossref style cite @simplestEquation"}
definition theoremstyle here
:::
::: {.Case info="within parenthesis"}
remark theoremstyle here
:::
::: {.proof info="Proof of the Main Theorem"}
Predefined proof theoremstyle here
:::
::: {.proof info="Proof of the *little* theorem"}
Predefined proof theoremstyle here with markdown info.
:::
::: {.proof}
Bare proof here.
:::
::: KL
Klein's Lemma from amsthm doc.
:::
::: Definition
```
code here
```
:::
# Counter test
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::
## Next level
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::
### Level 3
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::
#### Level 4
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::
##### Level 5
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::
###### Level 6
::: Theorem
some theorem
:::
::: Theorem
some theorem
:::LaTeX output
For LaTeX, the filter emits amsthm environments, and loads the package and declares them in the preamble, so the output has to be standalone:
pandoc -L amsthm.lua model-source.md --top-level-division=chapter -N -s -o model-latex.texBelow is the same output, minus pandoc’s default template, which is how the golden test keeps it comparable across pandoc versions: what the filter adds to the preamble, followed by the body.
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{Theorem}{Theorem}[section]
\newtheorem{Lemma}[Theorem]{Lemma}
\newtheorem{Corollary}[Theorem]{Corollary}
\newtheorem*{With Space}{With Space}
\newtheorem{Proposition}{Proposition}[section]
\newtheorem{Conjecture}[Proposition]{Conjecture}
\newtheorem{WithoutSpace}{WithoutSpace}[section]
\newtheorem{KL}{Klein’s Lemma}[section]
\theoremstyle{definition}
\newtheorem{Definition}{Definition}[section]
\theoremstyle{remark}
\newtheorem{Case}{Case}[section]
\chapter{Demo}\label{demo}
\begin{Theorem}[within parenthesis]
plain theoremstyle \emph{here}
We can use pandoc-crossref style \ref{simplestEquation} and
\eqref{simplestEquation} and cite before definition.
\end{Theorem}
\begin{Theorem}\label{simplestEquation}
Label and reference:
\[E=mc^2\]
\end{Theorem}
From the \ref{simplestEquation}, we see that\ldots{} Or
\eqref{simplestEquation}, \ldots{} Or with its name,
Theorem~\ref{simplestEquation}.
\begin{With Space}[\textbf{This} is \emph{markdown}.]
Environment name has a space, and is unnumbered.
\end{With Space}
\begin{Lemma}[{can cite \ref{simplestEquation}}]
This one share counter with Theorem.
\end{Lemma}
\begin{Definition}[{pandoc-crossref style cite \ref{simplestEquation}}]
definition theoremstyle here
\end{Definition}
\begin{Case}[within parenthesis]
remark theoremstyle here
\end{Case}
\begin{proof}[Proof of the Main Theorem]
Predefined proof theoremstyle here
\end{proof}
\begin{proof}[Proof of the \emph{little} theorem]
Predefined proof theoremstyle here with markdown info.
\end{proof}
\begin{proof}
Bare proof here.
\end{proof}
\begin{KL}
Klein's Lemma from amsthm doc.
\end{KL}
\begin{Definition}
\begin{verbatim}
code here
\end{verbatim}
\end{Definition}
\chapter{Counter test}\label{counter-test}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}
\section{Next level}\label{next-level}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}
\subsection{Level 3}\label{level-3}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}
\subsubsection{Level 4}\label{level-4}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}
\paragraph{Level 5}\label{level-5}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}
\subparagraph{Level 6}\label{level-6}
\begin{Theorem}
some theorem
\end{Theorem}
\begin{Theorem}
some theorem
\end{Theorem}The example also links a PDF typeset from it by Quarto.