blob: e3c07e6612095d722ce95c04fc8f57407864202d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
```
% pandoc -f markdown+latex_macros -t markdown+raw_tex-raw_attribute
\newcommand{\my}{\phi}
$\my+\my$
^D
\newcommand{\my}{\phi}
$\phi+\phi$
```
```
% pandoc -f markdown-latex_macros -t markdown+raw_tex-raw_attribute
\newcommand{\my}{\phi}
$\my+\my$
^D
\newcommand{\my}{\phi}
$\my+\my$
```
`\let` macros should be expanded at point of
definition, while `\newcommand` macros should be
expanded at point of use:
```
% pandoc -f latex -t latex
\let\a\b
\newcommand{\b}{\emph{ouk}}
\a a
^D
a̱
```
```
% pandoc -f latex -t latex
\newcommand{\a}{\b}
\newcommand{\b}{\emph{ouk}}
\a a
^D
\emph{ouk}a
```
```
% pandoc -f latex -t latex
\def\BDpos{}
\def\BDneg{-}
\def\beq{\begin{align}}
\def\eeq{\end{align}}
\def\e#1{\emph{#1}}
\def\f#1#2{\emph{#1--#2}}
$5\BDneg 6\BDpos 7$
\beq
x &= y\\
\eeq
\e{hi}
\f{hi}{ok}
^D
\(5-67\)
\[\begin{aligned}
x &= y\\\end{aligned}\]
\emph{hi}
\emph{hi--ok}
```
```
% pandoc -f markdown+latex_macros -t markdown+raw_tex-raw_attribute
\newcommand{\my}{\phi}
\begin{equation}
\my+\my
\end{equation}
^D
\newcommand{\my}{\phi}
\begin{equation}
\phi+\phi
\end{equation}
```
```
% pandoc -f markdown-latex_macros -t markdown+raw_tex-raw_attribute
\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+raw_tex-raw_attribute
\newcommand{\my}{\emph{a}}
\my
^D
\newcommand{\my}{\emph{a}}
\emph{a}
```
<https://tex.stackexchange.com/questions/258/what-is-the-difference-between-let-and-def>
```
% pandoc -f latex -t plain
\def\bar{hello}
\let\fooi\bar
\def\fooii{\bar}
\fooi +\fooii
\def\bar{goodbye}
\fooi +\fooii
^D
hello+hello
hello+goodbye
```
|