-
Notifications
You must be signed in to change notification settings - Fork 4
/
simpler-wick.tex
105 lines (92 loc) · 2.73 KB
/
simpler-wick.tex
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Simpler-Wick
% Simpler Wick contractions in LaTeX
% Copyright (C) 2018 Joshua Ellis
%
%
% This work may be distributed and/or modified under the conditions of the LaTeX
% Project Public License, either version 1.3 of this license or (at your option)
% any later version.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Joshua Ellis.
%
% This program is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE. See the LaTeX Project Public License for more
% details.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input tikz.tex
% Define \refmathstyle and \labelmathstyle as refmathstyle is a LaTeX-only
% package.
\let\refmathstyle\relax
\let\labelmathstyle\relax
% makeatletter
\edef\simplerwickatcode{\the\catcode`\@}
\catcode`\@=11
% Definition of \@ifnextchar from LaTeX
%
% Scan for the next non-space token and do something depending on
% whether it matches #1 or not.
%
% #1 : token to look for
% #2 : true code
% #3 : false code
\long\def\@ifnextchar#1#2#3{%
\let\reserved@d=#1%
\def\reserved@a{#2}%
\def\reserved@b{#3}%
\futurelet\@let@token\@ifnch}
% Helper macro to \@ifnextchar
%
% This branches for the next token. If the scanned token is a space
% (\@sptoken) it keeps on looking. Otherwise it either branches to the
% true or false code saved earlier.
\def\@ifnch{%
\ifx\@let@token\@sptoken
\let\reserved@c\@xifnch
\else
\ifx\@let@token\reserved@d
\let\reserved@c\reserved@a
\else
\let\reserved@c\reserved@b
\fi
\fi
\reserved@c}
% These definitions look like this because we need that explicit space
% token. Read the TeXbook for details.
\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
% \PackageWarning from LaTeX
\def\PackageWarning#1#2{%
\GenericWarning{%
(#1)\@spaces\@spaces\@spaces\@spaces
}{%
Package #1 Warning: #2%
}%
}
\def\GenericWarning#1#2{%
\begingroup
\def\MessageBreak{^^J#1}%
\set@display@protect
\immediate\write\@unused{^^J#2\on@line.^^J}%
\endgroup
}
\newwrite\@unused
\def\@spaces{\space\space\space\space}
\def\set@display@protect{\let\protect\string}
\def\on@line{ on input line \the\inputlineno}
% Externalize is not available in Plain. Make them no-ops.
\let\tikzexternalenable\relax
\let\tikzexternaldisable\relax
% Input the code
\input simpler-wick.code.tex
% makeatother
\catcode`\@=\simplerwickatcode
\endinput
% Local Variables:
% TeX-master: "simpler-wick-plain"
% End: