From 6cbe5efd5628ddd67f4e17d75a3c3370f53b0e87 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Mon, 2 Nov 2020 15:04:16 -0800
Subject: LaTeX reader: fix bug parsing macro arguments.

If `\cL` is defined as `\mathcal{L}`, and `\til` as `\tilde{#1}`,
then `\til\cL` should expand to `\tilde{\mathcal{L}}`, but pandoc
was expanding it to `\tilde\mathcal{L}`.  This is fixed by
parsing the arguments in "verbatim mode" when the macro expands
arguments at the point of use.

Closes #6796.
---
 test/command/6796.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 test/command/6796.md

(limited to 'test')

diff --git a/test/command/6796.md b/test/command/6796.md
new file mode 100644
index 000000000..f51205a81
--- /dev/null
+++ b/test/command/6796.md
@@ -0,0 +1,16 @@
+```
+% pandoc -f latex -t markdown
+\newcommand{\cL}{\mathcal{L}}
+\newcommand{\til}[1]{\tilde{#1}}
+
+$$\til\cL$$
+
+\newcommand{\mc}[1]{\mathcal{#1}}
+\newcommand{\dL}{\mc{L}}
+
+$$\til\dL$$
+^D
+$$\tilde{\mathcal{L}}$$
+
+$$\tilde{\mathcal{L}}$$
+```
-- 
cgit v1.2.3