From 28b736bf957da0df79ffb211fc5e7ec4ff713c4b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 22 Dec 2017 17:59:47 -0800 Subject: `latex_macros` extension changes. Don't pass through macro definitions themselves when `latex_macros` is set. The macros have already been applied. If `latex_macros` is enabled, then `rawLaTeXBlock` in Text.Pandoc.Readers.LaTeX will succeed in parsing a macro definition, and will update pandoc's internal macro map accordingly, but the empty string will be returned. Together with earlier changes, this closes #4179. --- test/command/4159.md | 3 +-- test/command/macros.md | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'test/command') diff --git a/test/command/4159.md b/test/command/4159.md index 4881edcc5..81deba53a 100644 --- a/test/command/4159.md +++ b/test/command/4159.md @@ -3,6 +3,5 @@ \newcommand{\gen}{a\ Gen\ b} abc ^D -[RawBlock (Format "latex") "\\newcommand{\\gen}{a\\ Gen\\ b}" -,Para [Str "abc"]] +[Para [Str "abc"]] ``` diff --git a/test/command/macros.md b/test/command/macros.md index 46179e3c7..4bd2eb00a 100644 --- a/test/command/macros.md +++ b/test/command/macros.md @@ -3,7 +3,6 @@ \newcommand{\my}{\phi} $\my+\my$ ^D -\newcommand{\my}{\phi} $\phi+\phi$ ``` @@ -66,3 +65,36 @@ x &= y\\\end{aligned}\] \emph{hi--ok} ``` + +``` +% pandoc -f markdown+latex_macros -t markdown +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +^D +\begin{equation} +\phi+\phi +\end{equation} +``` + +``` +% pandoc -f markdown-latex_macros -t markdown +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +^D +\newcommand{\my}{\phi} +\begin{equation} +\my+\my +\end{equation} +``` + +``` +% pandoc -f markdown+latex_macros -t markdown +\newcommand{\my}{\emph{a}} +\my +^D +\emph{a} +``` -- cgit v1.2.3