在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sliminality/pandoc-theorem开源软件地址(OpenSource Url):https://github.com/sliminality/pandoc-theorem开源编程语言(OpenSource Language):Haskell 93.8%开源软件介绍(OpenSource Introduction):pandoc-theoremA Pandoc filter to convert definition lists into amsthm theorem environments, for compiling to PDF and LaTeX. The extension supports the following theorem environments:
Note that compilation targets other than PDF and LaTeX have not been tested. Notably, this includes HTML. ExampleGiven 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} InstallationYou must have pandoc 2.8 or greater installed and available in your PATH. If you are on pandoc 2.11 or later, you can either download a prebuilt binary from the Releases page, or clone and cd pandoc-theorem
stack install Check that > which pandoc-theorem-exe
/Users/slim/.local/bin/pandoc-theorem-exe # or a different path Older versions of pandocYou may need to build from source to use this filter with earlier versions of pandoc. You can use the provided alternate stack install --stack-yaml="stack.pandoc-2.8.yaml" # 2.8 and 2.9
stack install --stack-yaml="stack.pandoc-2.10.yaml" # 2.10 UsageTo use, pass the # Compile to PDF.
pandoc --filter pandoc-theorem-exe input.md -H header.tex -o output.pdf
# Output LaTeX.
pandoc --filter pandoc-theorem-exe input.md -H header.tex -t latex Note that you will always need to include the following header file using Pandoc's % examples/header.tex
\usepackage{amsthm}
\newtheorem{claim}{Claim}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}
\newtheorem{example}{Example}
\newtheorem{assumption}{Assumption} You can also define these environments directly in the document, using YAML frontmatter to avoid passing ---
title: Glamorous paper
header-includes:
\usepackage{amsthm}
\newtheorem{claim}{Claim}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}
\newtheorem{example}{Example}
\newtheorem{assumption}{Assumption}
--- Finally, you can choose to add these environments directly to your chosen template, eliminating the need to define them in every document. Syntaxpandoc-theorem repurposes the syntax for definition lists, checking for recognized identifiers. Theorem (Fermat's Little).
: If $p$ is a prime number, then for any integer $a$, the number $$a^p - a$$ is an integer multiple of $p$. In general, the format looks like this: <term>
: <body> where
That is, a
Supported Confused about indentation, line spacing, or the More examples can be found in the Examples section below. ExamplesThis repository includes an example Markdown file in pandoc --filter pandoc-theorem-exe examples/kitchen-sink.md -H examples/header.tex -o examples/kitchen-sink.pdf Simple block-level theoremTheorem (Hedberg).
: Any type with decidable equality is a set. Complex block-level theoremLemma (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:
- $|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$. Single inline theoremProof.
: By induction on the structure of the typing judgment. Multiple inline theoremsDef (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 workIf 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. AcknowledgementsIn addition to John MacFarlane's incredible work on Pandoc itself, this filter benefited from the following prior efforts:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论