Debian Codegraph @

texmf-dist/doc/latex/simpler-wick/simpler-wick.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Simpler-Wick
4 % Simpler Wick contractions in LaTeX
5 % Copyright (C) 2015 Joshua Ellis
6 %
7 %
8 % This LaTeX file is free: you can redistribute it and/or modify it under the
9 % terms of the GNU General Public License as published by the Free Software
10 % Foundation, either version 3 of the License, or (at your option) any later
11 % version.
12 %
13 % This is distributed in the hope that it will be useful, but WITHOUT ANY
14 % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 % A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20 %% HEADER
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22
23 \def\pgfautoxrefs{1}
24 \documentclass[a4paper,final]{ltxdoc}
25
26 \usepackage{etex}
27
28 %% Formatting
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30
31 \usepackage[vmargin=4cm, hmargin=3cm]{geometry} % Customize text width, page height, margins, etc.
32 % \usepackage{multicol} % {multicols}{n} environment
33 % \usepackage{pdflscape} % {landscape} environment
34
35 %\usepackage{setspace} % Line spacing
36 %\singlespacing % 1-spacing (default)
37 %\onehalfspacing % 1,5-spacing
38 %\doublespacing % 2-spacing
39
40 \usepackage{fontspec} % Allows other fonts to be specified
41 \setmainfont{EB Garamond}[
42 Contextuals={Alternate},
43 Numbers=OldStyle,
44 ]
45 \setmonofont{Inconsolata-g}[
46 Scale=MatchLowercase,
47 ]
48 \newfontface\swshape{EB Garamond 12 Italic}[Style=Swash]
49
50 \usepackage{microtype} % Fine small typographical details
51 \usepackage{titlesec} % Change section heading font
52 \titleformat*{\section}{\huge\scshape}
53 \titleformat*{\subsection}{\Large\scshape}
54 \titleformat*{\subsubsection}{\large\scshape}
55 \titleformat*{\paragraph}{\scshape}
56
57 \usepackage[symbol*,perpage]{footmisc}
58 \usepackage{enumitem} % Easily customize lists
59 \setlist[description]{font=\normalfont\scshape}
60
61 %% Change the Table of Contents fonts
62 \usepackage{tocloft}
63 \renewcommand{\cftsecfont}{\normalfont\scshape}
64 \setlength\cftbeforesecskip{0pt}
65 \setcounter{tocdepth}{2}
66
67 %% Language
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69
70 \usepackage[UKenglish]{babel} % Set up the language
71 \usepackage{csquotes}
72 \usepackage{siunitx} % Provides \SI{1}{\metre}, also \ang{90}.
73 \usepackage{textcomp}
74
75 %% Graphics & Figure
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77
78 \usepackage{graphicx} % Allow graphics to be included
79 \usepackage{xcolor} % Define and use colours
80 % \usepackage{subcaption} % Subfigures inside a figure
81
82 % Keep all pictures in the './img/' sub-directory.
83 \graphicspath{{./img/}}
84
85 %% Math Packages
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87
88 \usepackage{amsmath} % The core math package
89 \usepackage{amssymb} % Defines additional math fonts
90 \usepackage{mathtools} % Various extra maths functions
91 % \usepackage{cancel} % Show cancellations with \cancel{}
92 % \usepackage{autonum} % Only number referenced equations (must be loaded after cleverref)
93 \usepackage{dsfont}
94 \usepackage{simpler-wick}
95
96 \usepackage[cmintegrals,varg]{newtxmath} % Nice math with Garamond
97
98 %% Define \withnumber which forces the line to have number
99 \newcommand{\withnumber}{\refstepcounter{equation}\tag{\theequation}}
100
101 %% Allows page breaks in math (1 = avoid if possible, 4 = whenever)
102 %% Page breaks can be avoided at particular places by using \\*
103 \allowdisplaybreaks[2]
104
105 %% Tables
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107
108 \usepackage{array} % New column types, including >{}x<{}
109 \usepackage{booktabs} % Provides nicer horizontal lines
110 \usepackage{multirow} % Allows cells to span multiple rows
111 %\usepackage{longtable} % Allows for tables to span multiple pages
112
113 %% Define the maths version of clr columns.
114 \newcolumntype{C}{>{\(}c<{\)}}
115 \newcolumntype{L}{>{\(}l<{\)}}
116 \newcolumntype{R}{>{\(}r<{\)}}
117
118 %% Other Packages
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
121 \usepackage{listings} % Code listings
122 \usepackage{minted} % Use Pygments
123 \usepackage{fp} % Floating point arithmetics
124 \usepackage{makeidx} % Index creation
125 \usepackage{xr} % Cross-referencing
126
127 \usepackage{hyperref} % Automatically inserts hyperlinks.
128 \usepackage{cleveref} % Use `\cref{}` to reference anything
129
130 \usepackage{autonum}
131
132 %% Other modifications
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
134
135 % Modify the skip after each paragraph
136 \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
137 \setlength{\parindent}{0pt}
138
139 \providecommand\href[2]{\texttt{#1}}
140 \providecommand\hypertarget[2]{\texttt{#1}}
141 \providecommand\hyperlink[2]{\texttt{#1}}
142
143 \newenvironment{example}
144 {\VerbatimEnvironment
145 \begin{VerbatimOut}{example.out}}
146 {\end{VerbatimOut}%
147 \vspace{1ex}%
148 \setlength{\parindent}{0pt}%
149 \fbox{\begin{minipage}{0.5\linewidth}%
150 \inputminted[resetmargins]{latex}{example.out}%
151 \end{minipage}%
152 \hspace{0.05\linewidth}%
153 \begin{minipage}{0.43\linewidth}%
154 \input{example.out}%
155 \end{minipage}%
156 \vspace{1ex}}}
157
158 \let\origtexttt=\texttt
159 \def\texttt#1{{\def\textunderscore{\char`\_}\def\textbraceleft{\char`\{}\def\textbraceright{\char`\}}\origtexttt{#1}}}
160 \def\exclamationmarktext{!}
161 \def\atmarktext{@}
162
163 {
164 \catcode`\|=12
165 \gdef\pgfmanualnormalbar{|}
166 \catcode`\|=13
167 \AtBeginDocument{\gdef|{\ifmmode\pgfmanualnormalbar\else\expandafter\verb\expandafter|\fi}}
168 }
169
170 \makeatother
171
172 \makeindex
173
174 %% Define some slightly nicer colors
175 \definecolor{link-color}{RGB}{96 0 0}
176 \definecolor{cite-color}{RGB}{0 96 0}
177 \definecolor{file-color}{RGB}{0 0 96}
178 \definecolor{url-color}{RGB}{0 0 96}
179 \definecolor{link-border-color}{RGB}{255 159 159}
180 \definecolor{cite-border-color}{RGB}{159 255 159}
181 \definecolor{file-border-color}{RGB}{159 159 255}
182 \definecolor{url-border-color}{RGB}{159 159 255}
183
184 \hypersetup{
185 pdfborder=0 0 0,
186 }
187
188 %% Document Information
189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
190
191 \makeatletter
192 \newcommand{\@keywords}{}
193 \newcommand{\keywords}[1]{\renewcommand{\@keywords}{#1}}
194
195 \newcommand{\@version}{}
196 \newcommand{\version}[1]{\renewcommand{\@version}{#1}}
197
198 \AtBeginDocument{
199 \hypersetup{
200 pdftitle={\@title},
201 pdfauthor={\@author},
202 pdfkeywords={\@keywords},
203 }
204 }
205 \makeatother
206
207 \title{Simpler-Wick}
208 \version{1.0.0}
209 \author{Joshua \textsc{Ellis}}
210 \keywords{Wick contractions; TeX; LaTeX; TikZ; Simpler-Wick}
211
212
213
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %% DOCUMENT
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217 \begin{document}
218
219 \begin{titlepage}
220 \makeatletter
221 \begin{center}
222 \vspace*{1em}
223 \tikz\node[scale=1.5]{%
224 \color{gray}\Huge\ttfamily \char`\{\textcolor{red!75!black}{\@title}\char`\}};
225
226 \vspace{0.5em}
227 {\Large\bfseries Simpler Wick Contractions}
228
229 \vspace{0.7em}
230 {Version \@version \qquad \today}
231
232 \vspace{1.3em}
233 {by \@author}
234 \end{center}
235 \makeatother
236
237 \vfill
238
239 \begin{VerbatimOut}{example.out}
240 \(\wick{\c1Simp\c2le\c3r\ \c2Wick\ \c3Contractio\c1n}\)
241 \end{VerbatimOut}
242
243 \begin{center}
244 \tikzexternaldisable
245 \tikz\node[scale=2]{\input{example.out}};
246 \tikzexternalenable
247
248 \begin{minipage}{0.65\linewidth}
249 \inputminted{latex}{example.out}
250 \end{minipage}
251 \end{center}
252
253 \vfill
254
255 \tableofcontents
256 \end{titlepage}
257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258 %% CONTENT
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 \newpage
261 \section{Introduction}
262 \label{sec:introduction}
263
264 This package provides simple way of inserting Wick contractions.
265
266 If you have any suggestions or have found any bugs, please feel free to create a
267 new issue or pull request on the Github page:
268 \href{https://www.github.com/JP-Ellis/simpler-wick}{|https://www.github.com/JP-Ellis/simpler-wick|}.
269
270 \subsection{Installation}
271 \label{subsec:installation}
272
273 In order to use this as it is, simply download |simpler-wick.sty| and place it
274 in the same directory as your \TeX~file and include it using the usual
275 |\usepackage{simpler-wick}|. Alternatively, it is also possible to install
276 |simpler-wick| system-wide by placing it inside \TeX's search path (which will
277 vary based on your operating system). This package is also available through
278 \href{https:/ctan.org}{\textsc{ctan}}.
279
280
281 \section{Usage}
282 \label{sec:usage}
283
284 The package is imported by adding |\usepackage{simpler-wick}| to your preamble.
285 In your math environment, you can now use the |\wick| command in combination
286 with |\c|:
287
288 \begin{example}
289 \begin{equation}
290 \wick{\c\phi A \c\phi}
291 \end{equation}
292 \end{example}
293
294 If you wish to have multiple contractions, then follow |\c| with a number
295 between 1 and 9; the first occurrence of |\cN| will start the Wick contraction,
296 and the second occurrence of |\cN| will end it. After you have ended a
297 contraction, |\cN| start another contraction.
298
299 \begin{example}
300 \begin{equation}
301 \wick{
302 \c1 a \c2 b \c3 c \c1 a \c4 d \c1 e
303 \c1 e \c1 a \c2 b \c3 c \c1 a
304 }
305 \end{equation}
306 \end{example}
307
308 The package has two options: |sep| and |offset|. |sep| is
309 the distance separating each level and |offset| is the base offset. By default,
310 |\sep=3pt| and |\offset=1em|, but they can be changed globally by specifying
311 them as package variables:
312
313 \begin{minted}{latex}
314 \usepackage[sep=5pt, offset=1.5em]{simpler-wick}
315 \end{minted}
316
317 Or you can specify them as optional argument to |\wick|. This is particularly
318 useful if you have some tall symbols within your Wick contraction:
319
320 \begin{example}
321 \begin{equation}
322 \wick[offset=2em]{\c\phi \int \frac{dx}{x} \c\phi}
323 \end{equation}
324 \end{example}
325
326 \end{document}
327
328 %%% Local Variables:
329 %%% TeX-master: t
330 %%% End: