To typeset Feynman diagrams, take a look at the FeynMF (or FeynMP, the
MetaPost equivalent) package.
Years ago, somebody posted a macro that does Wick contraction. I don't
remember who the author is already, but here's the code:
\makeatletter
\newcommand{\contraction}[5][1ex]{%
\mathchoice
{\contraction@\displaystyle{#2}{#3}{#4}{#5}{#1}}%
{\contraction@\textstyle{#2}{#3}{#4}{#5}{#1}}%
{\contraction@\scriptstyle{#2}{#3}{#4}{#5}{#1}}%
{\contraction@\scriptscriptstyle{#2}{#3}{#4}{#5}{#1}}}%
\newcommand{\contraction@}[6]{%
\setbox0=\hbox{$#1#2$}%
\setbox2=\hbox{$#1#3$}%
\setbox4=\hbox{$#1#4$}%
\setbox6=\hbox{$#1#5$}%
\dimen0=\wd2%
\advance\dimen0 by \wd6%
\divide\dimen0 by 2%
\advance\dimen0 by \wd4%
\vbox{%
\hbox to 0pt{%
\kern \wd0%
\kern 0.5\wd2%
\contraction@@{\dimen0}{#6}%
\hss}%
\vskip 0.2ex%
\vskip\ht2}}
\newcommand{\contracted}[5][1ex]{%
\contraction[#1]{#2}{#3}{#4}{#5}\ensuremath{#2#3#4#5}}
\newcommand{\contraction@@}[3][0.06em]{%
\hbox{%
\vrule width #1 height 0pt depth #3%
\vrule width #2 height 0pt depth #1%
\vrule width #1 height 0pt depth #3%
\relax}}
\makeatother
and an example showing how to use it would be:
\begin{equation}
\contraction[2ex]{}{A}{(x)B(y)}{C}
\contraction{A(x)}{B}{(y)C(z)}{D}
A(x)B(y)C(z)D(w)
\end{equation}
Wick contraction can also be done using PSTricks, too.
Cheong Siew Ann