From a0e44b1ff651ba59fe23b9e1b5d534d324dc0808 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 11 Aug 2021 10:32:52 -0700 Subject: LaTeX reader: improve handling of plain TeX macro primitives. - Fixed semantics for `\let`. - Implement `\edef`, `\gdef`, and `\xdef`. - Add comment noting that currently `\def` and `\edef` set global macros (so are equivalent to `\gdef` and `\xdef`). This should be fixed by scoping macro definitions to groups, in a future commit. Closes #7474. --- test/command/macros.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'test/command') diff --git a/test/command/macros.md b/test/command/macros.md index e3c07e661..9f7a0f9d3 100644 --- a/test/command/macros.md +++ b/test/command/macros.md @@ -25,7 +25,7 @@ expanded at point of use: ``` % pandoc -f latex -t latex \let\a\b -\newcommand{\b}{\emph{ouk}} +\def\b{\emph{ouk}} \a a ^D a̱ @@ -123,3 +123,39 @@ hello+hello hello+goodbye ``` +``` +% pandoc -f latex -t plain +\def\txt{a} +\def\foo{\txt} +\let\bar\foo +\bar % -> a +\def\txt{b} +\bar % -> b +\def\foo{OH} +\bar % -> b +^D +a b b +``` + +``` +% pandoc -f latex -t plain +\def\aaa{aaa} +\def\bbb{x\aaa} +\edef\ccc{y\aaa} +\def\aaa{AAA} +\bbb \ccc +^D +xAAAyaaa +``` + +``` +% pandoc -f latex -t plain +\gdef\aaa{aaa} +\gdef\bbb{x\aaa} +\xdef\ccc{y\aaa} +\gdef\aaa{AAA} +\bbb \ccc +^D +xAAAyaaa +``` + -- cgit v1.2.3