diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-11 10:32:52 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-11 10:32:52 -0700 |
commit | a0e44b1ff651ba59fe23b9e1b5d534d324dc0808 (patch) | |
tree | b7847ac514fcacc088e1d7a0f3097436e5b93374 /test/command | |
parent | 06d97131e530d2ee9b14617290a157dd42c0db30 (diff) | |
download | pandoc-a0e44b1ff651ba59fe23b9e1b5d534d324dc0808.tar.gz |
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.
Diffstat (limited to 'test/command')
-rw-r--r-- | test/command/macros.md | 38 |
1 files changed, 37 insertions, 1 deletions
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 +``` + |