%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Simpler-Wick
% Simpler Wick contractions in LaTeX
% Copyright (C) 2015 Joshua Ellis
%
%
% This LaTeX file is free: you can redistribute it and/or modify it under the
% terms of the GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option) any later
% version.
%
% This 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 GNU General Public License for more details.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pgfautoxrefs{1}
\documentclass[a4paper,final]{ltxdoc}
\usepackage{etex}
%% Formatting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[vmargin=4cm, hmargin=3cm]{geometry} % Customize text width, page height, margins, etc.
% \usepackage{multicol} % {multicols}{n} environment
% \usepackage{pdflscape} % {landscape} environment
%\usepackage{setspace} % Line spacing
%\singlespacing % 1-spacing (default)
%\onehalfspacing % 1,5-spacing
%\doublespacing % 2-spacing
\usepackage{fontspec} % Allows other fonts to be specified
\setmainfont{EB Garamond}[
Contextuals={Alternate},
Numbers=OldStyle,
]
\setmonofont{Inconsolata-g}[
Scale=MatchLowercase,
]
\newfontface\swshape{EB Garamond 12 Italic}[Style=Swash]
\usepackage{microtype} % Fine small typographical details
\usepackage{titlesec} % Change section heading font
\titleformat*{\section}{\huge\scshape}
\titleformat*{\subsection}{\Large\scshape}
\titleformat*{\subsubsection}{\large\scshape}
\titleformat*{\paragraph}{\scshape}
\usepackage[symbol*,perpage]{footmisc}
\usepackage{enumitem} % Easily customize lists
\setlist[description]{font=\normalfont\scshape}
%% Change the Table of Contents fonts
\usepackage{tocloft}
\renewcommand{\cftsecfont}{\normalfont\scshape}
\setlength\cftbeforesecskip{0pt}
\setcounter{tocdepth}{2}
%% Language
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[UKenglish]{babel} % Set up the language
\usepackage{csquotes}
\usepackage{siunitx} % Provides \SI{1}{\metre}, also \ang{90}.
\usepackage{textcomp}
%% Graphics & Figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{graphicx} % Allow graphics to be included
\usepackage{xcolor} % Define and use colours
% \usepackage{subcaption} % Subfigures inside a figure
% Keep all pictures in the './img/' sub-directory.
\graphicspath{{./img/}}
%% Math Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath} % The core math package
\usepackage{amssymb} % Defines additional math fonts
\usepackage{mathtools} % Various extra maths functions
% \usepackage{cancel} % Show cancellations with \cancel{}
% \usepackage{autonum} % Only number referenced equations (must be loaded after cleverref)
\usepackage{dsfont}
\usepackage{simpler-wick}
\usepackage[cmintegrals,varg]{newtxmath} % Nice math with Garamond
%% Define \withnumber which forces the line to have number
\newcommand{\withnumber}{\refstepcounter{equation}\tag{\theequation}}
%% Allows page breaks in math (1 = avoid if possible, 4 = whenever)
%% Page breaks can be avoided at particular places by using \\*
\allowdisplaybreaks[2]
%% Tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{array} % New column types, including >{}x<{}
\usepackage{booktabs} % Provides nicer horizontal lines
\usepackage{multirow} % Allows cells to span multiple rows
%\usepackage{longtable} % Allows for tables to span multiple pages
%% Define the maths version of clr columns.
\newcolumntype{C}{>{\(}c<{\)}}
\newcolumntype{L}{>{\(}l<{\)}}
\newcolumntype{R}{>{\(}r<{\)}}
%% Other Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings} % Code listings
\usepackage{minted} % Use Pygments
\usepackage{fp} % Floating point arithmetics
\usepackage{makeidx} % Index creation
\usepackage{xr} % Cross-referencing
\usepackage{hyperref} % Automatically inserts hyperlinks.
\usepackage{cleveref} % Use `\cref{}` to reference anything
\usepackage{autonum}
%% Other modifications
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Modify the skip after each paragraph
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}
\providecommand\href[2]{\texttt{#1}}
\providecommand\hypertarget[2]{\texttt{#1}}
\providecommand\hyperlink[2]{\texttt{#1}}
\newenvironment{example}
{\VerbatimEnvironment
\begin{VerbatimOut}{example.out}}
{\end{VerbatimOut}%
\vspace{1ex}%
\setlength{\parindent}{0pt}%
\fbox{\begin{minipage}{0.5\linewidth}%
\inputminted[resetmargins]{latex}{example.out}%
\end{minipage}%
\hspace{0.05\linewidth}%
\begin{minipage}{0.43\linewidth}%
\input{example.out}%
\end{minipage}%
\vspace{1ex}}}
\let\origtexttt=\texttt
\def\texttt#1{{\def\textunderscore{\char`\_}\def\textbraceleft{\char`\{}\def\textbraceright{\char`\}}\origtexttt{#1}}}
\def\exclamationmarktext{!}
\def\atmarktext{@}
{
\catcode`\|=12
\gdef\pgfmanualnormalbar{|}
\catcode`\|=13
\AtBeginDocument{\gdef|{\ifmmode\pgfmanualnormalbar\else\expandafter\verb\expandafter|\fi}}
}
\makeatother
\makeindex
%% Define some slightly nicer colors
\definecolor{link-color}{RGB}{96 0 0}
\definecolor{cite-color}{RGB}{0 96 0}
\definecolor{file-color}{RGB}{0 0 96}
\definecolor{url-color}{RGB}{0 0 96}
\definecolor{link-border-color}{RGB}{255 159 159}
\definecolor{cite-border-color}{RGB}{159 255 159}
\definecolor{file-border-color}{RGB}{159 159 255}
\definecolor{url-border-color}{RGB}{159 159 255}
\hypersetup{
pdfborder=0 0 0,
}
%% Document Information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcommand{\@keywords}{}
\newcommand{\keywords}[1]{\renewcommand{\@keywords}{#1}}
\newcommand{\@version}{}
\newcommand{\version}[1]{\renewcommand{\@version}{#1}}
\AtBeginDocument{
\hypersetup{
pdftitle={\@title},
pdfauthor={\@author},
pdfkeywords={\@keywords},
}
}
\makeatother
\title{Simpler-Wick}
\version{1.0.0}
\author{Joshua \textsc{Ellis}}
\keywords{Wick contractions; TeX; LaTeX; TikZ; Simpler-Wick}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{titlepage}
\makeatletter
\begin{center}
\vspace*{1em}
\tikz\node[scale=1.5]{%
\color{gray}\Huge\ttfamily \char`\{\textcolor{red!75!black}{\@title}\char`\}};
\vspace{0.5em}
{\Large\bfseries Simpler Wick Contractions}
\vspace{0.7em}
{Version \@version \qquad \today}
\vspace{1.3em}
{by \@author}
\end{center}
\makeatother
\vfill
\begin{VerbatimOut}{example.out}
\(\wick{\c1Simp\c2le\c3r\ \c2Wick\ \c3Contractio\c1n}\)
\end{VerbatimOut}
\begin{center}
\tikzexternaldisable
\tikz\node[scale=2]{\input{example.out}};
\tikzexternalenable
\begin{minipage}{0.65\linewidth}
\inputminted{latex}{example.out}
\end{minipage}
\end{center}
\vfill
\tableofcontents
\end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CONTENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\section{Introduction}
\label{sec:introduction}
This package provides simple way of inserting Wick contractions.
If you have any suggestions or have found any bugs, please feel free to create a
new issue or pull request on the Github page:
\href{https://www.github.com/JP-Ellis/simpler-wick}{|https://www.github.com/JP-Ellis/simpler-wick|}.
\subsection{Installation}
\label{subsec:installation}
In order to use this as it is, simply download |simpler-wick.sty| and place it
in the same directory as your \TeX~file and include it using the usual
|\usepackage{simpler-wick}|. Alternatively, it is also possible to install
|simpler-wick| system-wide by placing it inside \TeX's search path (which will
vary based on your operating system). This package is also available through
\href{https:/ctan.org}{\textsc{ctan}}.
\section{Usage}
\label{sec:usage}
The package is imported by adding |\usepackage{simpler-wick}| to your preamble.
In your math environment, you can now use the |\wick| command in combination
with |\c|:
\begin{example}
\begin{equation}
\wick{\c\phi A \c\phi}
\end{equation}
\end{example}
If you wish to have multiple contractions, then follow |\c| with a number
between 1 and 9; the first occurrence of |\cN| will start the Wick contraction,
and the second occurrence of |\cN| will end it. After you have ended a
contraction, |\cN| start another contraction.
\begin{example}
\begin{equation}
\wick{
\c1 a \c2 b \c3 c \c1 a \c4 d \c1 e
\c1 e \c1 a \c2 b \c3 c \c1 a
}
\end{equation}
\end{example}
The package has two options: |sep| and |offset|. |sep| is
the distance separating each level and |offset| is the base offset. By default,
|\sep=3pt| and |\offset=1em|, but they can be changed globally by specifying
them as package variables:
\begin{minted}{latex}
\usepackage[sep=5pt, offset=1.5em]{simpler-wick}
\end{minted}
Or you can specify them as optional argument to |\wick|. This is particularly
useful if you have some tall symbols within your Wick contraction:
\begin{example}
\begin{equation}
\wick[offset=2em]{\c\phi \int \frac{dx}{x} \c\phi}
\end{equation}
\end{example}
\end{document}
%%% Local Variables:
%%% TeX-master: t
%%% End: