diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/simplewick |
Initial commit
Diffstat (limited to 'macros/latex/contrib/simplewick')
-rw-r--r-- | macros/latex/contrib/simplewick/README | 17 | ||||
-rw-r--r-- | macros/latex/contrib/simplewick/simplewick.dtx | 408 | ||||
-rw-r--r-- | macros/latex/contrib/simplewick/simplewick.ins | 9 | ||||
-rw-r--r-- | macros/latex/contrib/simplewick/simplewick.pdf | bin | 0 -> 83275 bytes |
4 files changed, 434 insertions, 0 deletions
diff --git a/macros/latex/contrib/simplewick/README b/macros/latex/contrib/simplewick/README new file mode 100644 index 0000000000..fd9d7522b8 --- /dev/null +++ b/macros/latex/contrib/simplewick/README @@ -0,0 +1,17 @@ +This package is for Wick contractions above and below math expressions +in math mode. + +Extract simplewick.sty with + + latex simplewick.ins + +and generate documentation calling + + latex simplewick.dtx + +---- + +This material is subject to the GNU General Public License. See +http://www.ctan.org/tex-archive/help/Catalogue/licenses.gpl.html +for the details of that license. + diff --git a/macros/latex/contrib/simplewick/simplewick.dtx b/macros/latex/contrib/simplewick/simplewick.dtx new file mode 100644 index 0000000000..1edd249491 --- /dev/null +++ b/macros/latex/contrib/simplewick/simplewick.dtx @@ -0,0 +1,408 @@ +%\iffalse +%<*package> +%% +%% ---- +%% +%% This program is free software; 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 2 of the License, or +%% (at your option) any later version. +%% +%% 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 +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +%% MA 02110-1301 USA +%% +%% This work consists of the files simplewick.dtx and simplewick.ins +%% and the derived file simplewick.sty. +%% +%% ---- +%% +%% Original implementation of "contraction" adopted from thophys.sty by +%% Thorsten Ohl. Contractions below expressions ("bcontraction") and +%% stretching/shrinking fix "nomathglue" by Jindrich Kolorenc. +%% +%% ---- +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%</package> +%\fi +% \iffalse +% Doc-Source file to use with LaTeX2e +% \fi +% \iffalse +%<*driver> +\documentclass[11pt]{ltxdoc} +\usepackage{simplewick} + +\CheckSum{171} +\changes{1.1}{2006/10/29}{First packed version} +\changes{1.2}{2007/08/09}{Improved spacing to cooperate better with operators (such as \cdot)} +\changes{1.2a}{2007/11/23}{License clarification} + +\def\framed#1{ +\hbox{\vrule width .02em\vbox{\hrule height .02em\vskip .5ex +\hbox{\hskip .5ex\vbox{\hbox{#1}}\hskip .5ex} +\vskip .5ex\hrule height .02em}\vrule width .02em} +} + +\begin{document} +\DocInput{simplewick.dtx} +\end{document} +%</driver> +%\fi +% +%\title{Wick contractions in \LaTeX\ with |simplewick.sty|} +%\author{Jind\v rich Koloren\v c} +%\date{2006/10/29} +%\maketitle +% +%\noindent +%This is a manual accompanying the style file |simplewick.sty| +%providing macros |\acontraction| and |\bcontraction| to draw Wick +%contractions above and below expressions, respectively. The +%functionality is best illustrated by an example, +%$$ +%\contraction{}{a}{{}^{\dagger}_i(t_1)a^{\dagger}_j(t_1)}{a} +%\relax% +%\contraction[2ex]{a^{\dagger}_i(t_1)}{a}{% +%{}^{\dagger}_j(t_1)a_j(t_1)a_i(t_1)% +%a^{\dagger}_i(t_2)a^{\dagger}_j(t_2)a_j(t_2)}{a} +%\relax% +%\contraction[3ex]{a^{\dagger}_i(t_1)% +%a^{\dagger}_j(t_1)a_j(t_1)}{a}{{}_i(t_1)% +%a^{\dagger}_i(t_2)}{a} +%\relax% +%\bcontraction{a^{\dagger}_i(t_1)% +%a^{\dagger}_j(t_1)a_j(t_1)a_i(t_1)}% +%{a}{{}^{\dagger}_i(t_2)a^{\dagger}_j(t_2)}{a} +%\relax% +%a^{\dagger}_i(t_1)a^{\dagger}_j(t_1)a_j(t_1)a_i(t_1) +%a^{\dagger}_i(t_2)a^{\dagger}_j(t_2)a_j(t_2)a_i(t_2)\,. +%$$ +% +%\section{Usage} +%The syntax will be explained on something simpler, however. The +%sequence +%\begin{verbatim} +%$$ +%\contraction{}{A}{B}{C} +%\contraction[2ex]{A}{B}{C}{D} +%ABCD +%$$ +%\end{verbatim} +%renders as +%$$ +%\contraction{}{A}{B}{C} +%\contraction[2ex]{A}{B}{C}{D} +%ABCD\,. +%$$ +%The parameters of the macro |\contraction[]{}{}{}{}| (which is a +%synonym for |\acontraction[]{}{}{}{}|) are as follows. +%\newbox\listlabelbox +%\begin{list}{$\triangleright$}{ +% \setlength{\topsep}{.6em} +% \setlength{\itemsep}{.5ex} +% \setlength{\parsep}{0pt} +% \setbox\listlabelbox=\hbox{$\triangleright$} +% \setlength{\labelwidth}{\wd\listlabelbox} +% \setlength{\leftmargin}{1.5\parindent} +%} +%\item The first (optional) argument is the height of the +%contraction. When omitted (as in the first contraction above) it +%defaults to 1ex, +%\item the second argument contains the expression that lies before the +%contraction start, +%\item the third argument contains the expression, above which the +%start of the contraction is centered, +%\item the fourth argument is the +%part of the formula that is bridged by the contraction, and finally +%\item the contraction ends above the center of the last argument of +%the macro. +%\end{list} +%Note that the macro itself typesets only the contraction alone and rewinds +%back to allow for multiple contractions. Therefore, the expression to +%appear below the contraction(s) has to be repeated once more when you +%are finished with contractions themselves. +% +%I guess now it is the right time to move to that ``real life'' example +%from the beginning of this manual. Its source is +%\begin{verbatim} +%$$ +%\contraction{}{a}{{}^{\dagger}_i(t_1)a^{\dagger}_j(t_1)}{a} +%% +%\contraction[2ex]{a^{\dagger}_i(t_1)}{a}{% +%{}^{\dagger}_j(t_1)a_j(t_1)a_i(t_1)% +%a^{\dagger}_i(t_2)a^{\dagger}_j(t_2)a_j(t_2)}{a} +%% +%\contraction[3ex]{a^{\dagger}_i(t_1)% +%a^{\dagger}_j(t_1)a_j(t_1)}{a}{{}_i(t_1)% +%a^{\dagger}_i(t_2)}{a} +%% +%\bcontraction{a^{\dagger}_i(t_1)% +%a^{\dagger}_j(t_1)a_j(t_1)a_i(t_1)}% +%{a}{{}^{\dagger}_i(t_2)a^{\dagger}_j(t_2)}{a} +%% +%a^{\dagger}_i(t_1)a^{\dagger}_j(t_1)a_j(t_1)a_i(t_1) +%a^{\dagger}_i(t_2)a^{\dagger}_j(t_2)a_j(t_2)a_i(t_2)\,. +%$$ +%\end{verbatim} +% +% +%\section{Contractions inside the text --- stretching and shrinking} +%The macro |\contraction| is prone to giving not entirely satisfactory +%results when the formula is under stress or tension, i.e., when \TeX\ +%shrinks or stretches ``the glue'' from its natural width. When we try +%to squeeze the line +%\begin{verbatim} +%Contraction under stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$ +%and with no stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$. +%\end{verbatim} +%into a narrow box, we get +%\vskip 1em +%\noindent +%\hbox to \textwidth{\hfil% +%\framed{% +%\vbox{\hsize=23.75em +%\noindent +%Contraction under stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$ +%and with no stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$. +%}}\hfil} +%\vskip 1em +%\noindent +%This is not quite right since the contraction drawn on the first line +%is slightly too long, although its length is precisely the same as +%the length of the contraction on the second line --- they were entered +%via the same piece of code, after all. The style +%|simplewick.sty| offers a fix for this inconsistency in the form of +%the macro |\nomathglue{}| that prevents \TeX\ to shrink or stretch its +%argument. When used +%\begin{verbatim} +%Contraction under stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \nomathglue{% +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2)} +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$ +%and with no stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$. +%\end{verbatim} +%the outcome should look precisely as we wanted. +%\vskip 1em +%\noindent +%\hbox to \textwidth{\hfil% +%\framed{% +%\vbox{\hsize=23.75em +%\noindent +%Contraction under stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \nomathglue{\bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2)} +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$ +%and with no stress +%$ +%\contraction{}{\bar G}{{}_1(\mathbf{q}_1)\>\>{}}{\bar G} +% \bar G_1(\mathbf{q}_1)\>\>{}\bar G_2(\mathbf{q}_2) +%=\bar\chi_{12}(\mathbf{q}_1-\mathbf{q}_2) +%$. +%}}\hfil} +% +% +%\section{Alternatives} +%An alternative method for typesetting Wick contractions with \LaTeX\ is a +%|wick.sty| by Taichiro Kugo, available at +%\begin{verbatim} +%http://www2.yukawa.kyoto-u.ac.jp/~kugo/index-e.html +%\end{verbatim} +%It is actually a more advanced solution than the one presented +%here (which is the reason why I call this package +%|simplewick|). Unfortunately, |wick.sty| seems to be somewhat +%conflicting with |amsmath| package. For example, I did not succeed to +%draw the |wick.sty| contractions above accented characters (such as +%those in the stretching examples above) when |amsmath| was +%loaded. Without |amsmath| it was just fine, however. +% +% +%\section{Credits} +%The package |simplewick.sty| is based on the code from |thophys.sty| +%by Thorsten Ohl that dates back to 1994. I only added the contractions +%below expressions (|\bcontraction|), the stretching/shrinking fix +%|\nomathglue| and this documentation. Contact information can be +%obtained by issuing a command |\simplewickcontact|. +% +% +% +% +% +%\StopEventually{} +%\section{The Code} +% \begin{macrocode} +%<*simplewick.sty> +% \end{macrocode} +% \begin{macrocode} + +\def\fileversion{v1.2a} +\def\filedate{2007/11/23} +\ProvidesPackage{simplewick}[\filedate\space\fileversion] +\typeout{Package: simplewick \fileversion\space (\filedate)} + +\makeatletter + +% ---- +% definition of several boxes we will use +% ---- +\newbox\swb@xone +\newbox\swb@xtwo +\newbox\swb@xthree +\newbox\swb@xfour +\newdimen\swdimen@ne +\newdimen\swdimentw@ + +% ---- +% contraction above the expression +% ---- +\newcommand{\acontraction}[5][1ex]{% + \mathchoice + {\acontraction@\displaystyle{#2}{#3}{#4}{#5}{#1}}% + {\acontraction@\textstyle{#2}{#3}{#4}{#5}{#1}}% + {\acontraction@\scriptstyle{#2}{#3}{#4}{#5}{#1}}% + {\acontraction@\scriptscriptstyle{#2}{#3}{#4}{#5}{#1}}}% +\newcommand{\acontraction@}[6]{% + \setbox\swb@xone=\hbox{${}#1{}#2{}$}% + \setbox\swb@xtwo=\hbox{${}#1{}#3{}$}% + \setbox\swb@xthree=\hbox{${}#1{}#4{}$}% + \setbox\swb@xfour=\hbox{${}#1{}#5{}$}% + \swdimen@ne=\wd\swb@xtwo% + \advance\swdimen@ne by \wd\swb@xfour% + \divide\swdimen@ne by 2% + \advance\swdimen@ne by \wd\swb@xthree% + \vbox{% + \hbox to 0pt{% + \kern \wd\swb@xone% + \kern 0.5\wd\swb@xtwo% + \acontraction@@{\swdimen@ne}{#6}% + \hss}% + \vskip 0.5ex% how far above the line starts + \vskip\ht\swb@xtwo}} +\newcommand{\acontracted}[5][1ex]{% + \acontraction[#1]{#2}{#3}{#4}{#5}\ensuremath{#2#3#4#5}} +\newcommand{\acontraction@@}[3][0.05em]{% +% the 1st parameter (explicitly inserted) is the width +% of the contraction line + \hbox{% + \vrule width #1 height 0pt depth #3% + \vrule width #2 height 0pt depth #1% + \vrule width #1 height 0pt depth #3% + \relax}} +% compatibility with the previous version +\let\contraction\acontraction + +% ---- +% contraction below the expression +% ---- +\newcommand{\bcontraction}[5][1ex]{% + \mathchoice + {\bcontraction@\displaystyle{#2}{#3}{#4}{#5}{#1}}% + {\bcontraction@\textstyle{#2}{#3}{#4}{#5}{#1}}% + {\bcontraction@\scriptstyle{#2}{#3}{#4}{#5}{#1}}% + {\bcontraction@\scriptscriptstyle{#2}{#3}{#4}{#5}{#1}}}% +\newcommand{\bcontraction@}[6]{% + \setbox\swb@xone=\hbox{${}#1{}#2{}$}% + \setbox\swb@xtwo=\hbox{${}#1{}#3{}$}% + \setbox\swb@xthree=\hbox{${}#1{}#4{}$}% + \setbox\swb@xfour=\hbox{${}#1{}#5{}$}% + \swdimen@ne=\wd\swb@xtwo% + \advance\swdimen@ne by \wd\swb@xfour% + \divide\swdimen@ne by 2% + \advance\swdimen@ne by \wd\swb@xthree% + \lower 0.5ex \vbox{% + \hbox to 0pt{% + \kern \wd\swb@xone% + \kern 0.5\wd\swb@xtwo% + \bcontraction@@{\swdimen@ne}{#6}% + \hss}% + }} +\newcommand{\bcontracted}[5][1ex]{% + \bcontraction[#1]{#2}{#3}{#4}{#5}\ensuremath{#2#3#4#5}} +\newcommand{\bcontraction@@}[3][0.05em]{% +% the 1st parameter (explicitly inserted) is the width +% of the contraction line + \hbox{% + \swdimentw@=#3 + \advance\swdimentw@ by -#1 + \vrule width #1 height 0pt depth #3% + \lower\swdimentw@\hbox{\vrule width #2 height 0pt depth #1}% + \vrule width #1 height 0pt depth #3% + \relax}} + +\makeatother + +% ---- +% macro to switch off shrinking/stretching in mathmode +% (consult TeXbook, page 168, to see where the numbers came from) +% ---- +\newcommand\nomathglue[1]{ +\begingroup +\thinmuskip=3mu \medmuskip=4mu \thickmuskip=5mu +#1 +\endgroup +} + +% ---- +% obfuscated contact info +% ---- +\newcommand\simplewickcontact{% +{\tt {k}{o}{l}{o}{r}{e}{n}{c}{\tt @}{f}{z}{u}{.}{c}{z}}% +} + +% \end{macrocode} +% \begin{macrocode} +%</simplewick.sty> +% \end{macrocode} +%\Finale +\endinput diff --git a/macros/latex/contrib/simplewick/simplewick.ins b/macros/latex/contrib/simplewick/simplewick.ins new file mode 100644 index 0000000000..abb3f08039 --- /dev/null +++ b/macros/latex/contrib/simplewick/simplewick.ins @@ -0,0 +1,9 @@ +\input docstrip + +\askforoverwritefalse + +\generate{\file{simplewick.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{simplewick.dtx}{simplewick.sty,package}} +} + +\endbatchfile diff --git a/macros/latex/contrib/simplewick/simplewick.pdf b/macros/latex/contrib/simplewick/simplewick.pdf Binary files differnew file mode 100644 index 0000000000..dcf55c7de5 --- /dev/null +++ b/macros/latex/contrib/simplewick/simplewick.pdf |