% Read in by FEYNMANDOC:  FEYNMANDOC4C.  Called by FD4C.COM
%\chapter{Advanced Features con't - PHANTOM COMMANDS - STORING ITEMS}
%
%\subsection{Phantom Commands}
which is produced by:
\begin{verbatim}

\begin{picture}(8000,8000)
% This picture isn't printed out.  The \drawvertex statement sets up some
% spacing for the pic below.  It tests the `phantom mode' option.
% The \fermions below are superfluous and merely test \startphantom.
\startphantom
\drawvertex\gluon[\NE 3](0,0)[4]
\drawline\fermion[\SW\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\SE\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\E\REG](\vertextwox,\vertextwoy)[2000]
\drawline\fermion[\N\REG](\vertextwox,\vertextwoy)[2000]
\drawline\fermion[\E\REG](\vertexthreex,\vertexthreey)[2000]
\drawline\fermion[\S\REG](\vertexthreex,\vertexthreey)[2000]
\stopphantom
\global\Xtwo=\vertextwox  \global\Ytwo=\vertextwoy
\global\Xthree=\vertexthreex  \global\Ythree=\vertexthreey
\end{picture}
\hskip 2.0in
\begin{picture}(18000,18000)
\global\Xone=\Xthree  \negate\Xone
\global\Yone=\Ytwo    \negate\Yone
\drawvertex\gluon[\NE 3](\Xone,\Yone)[4]
\drawline\fermion[\S\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\W\REG](\vertexonex,\vertexoney)[2000]
\global\Xone=\Xthree  \negate\Xone 
\global\Yone=\Ytwo    %\negate\Yone 
\drawvertex\gluon[\SE 3](\Xone,\Yone)[4]
\drawline\fermion[\W\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\N\REG](\vertexonex,\vertexoney)[2000]
\global\Xone=\Xthree  %\negate\Yone
\global\Yone=\Ytwo    \negate\Yone
\drawvertex\gluon[\NW 3](\Xone,\Yone)[4]
\drawline\fermion[\E\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\S\REG](\vertexonex,\vertexoney)[2000]
\global\Xone=\Xthree  %\negate\Xone
\global\Yone=\Ytwo    %\negate\Yone
\drawvertex\gluon[\SW 3](\Xone,\Yone)[4]
\drawline\fermion[\E\REG](\vertexonex,\vertexoney)[2000]
\drawline\fermion[\N\REG](\vertexonex,\vertexoney)[2000]
\put(-9500,-14000){The number of vertices (including phantom vertices) = 
\number\vertexcount}
\end{picture}


\end{verbatim}
We see that the diagram is drawn by reflecting the lower left
vertex three times.  This is necessary since each vertex
can only be drawn beginning at one specific point.
%The slight mismatches at the joints occur because the various
%vertices are not truly symmetric (a \TeX\ defect).
First the \bs NE vertex is drawn, commencing at (0,0), in phantom mode.
This provides the $x$ and $y$ displacements of the vertex relative
to what will become the centre of the square gluon loop at the co-ordinate
(0,0).  Then we use reflection symmetry, with the \bs negate command,
to draw all four vertices.  The assignment statements such as
\verb@\global\Yone=\Ytwo@ are discussed
below in the section on saving and re-using items.

As an exercise in the use of phantom and arithmetic commands 
draw the following box diagram for the supersymmetric production process 
$q\bar q \rightarrow \tilde q \bar{\tilde q}$.  Make sure that the
box is exactly square, that the scalar gaps are 
precisely one half of the length of the segments,
and use a gluon of the \bs FLAT type.
\vskip 0.3in
\begin{picture}(20000,15000)
\drawline\gluon[\E\FLAT](10000,15000)[7]
% Calc lengths of scalars segments and gaps.
\global\Xone=\gluonlengthx
\global\divide\Xone by 8 %  \Xone will be the gap length
\global\Yone=\Xone
\double\Yone  %  \Yone will be the segment length
% Draw fermions:
\drawline\fermion[\W\REG](\gluonfrontx,\gluonfronty)[\gluonlengthx]
\drawline\fermion[\S\REG](\gluonfrontx,\gluonfronty)[\gluonlengthx]
\drawline\fermion[\W\REG](\fermionbackx,\fermionbacky)[\gluonlengthx]
% Draw scalars
\global\gaplength=\Xone  \global\seglength=\Yone
\drawline\scalar[\E\REG](\gluonbackx,\gluonbacky)[3]
\global\gaplength=\Xone  \global\seglength=\Yone
\drawline\scalar[\S\REG](\gluonbackx,\gluonbacky)[3]
\global\gaplength=\Xone  \global\seglength=\Yone
\drawline\scalar[\E\REG](\scalarbackx,\scalarbacky)[3]
% Now the photon.  Need to know it's length so use \phantom
\startphantom
\drawline\photon[\E\FLIPPED](0,0)[8]  % Can draw from anywhere
\stopphantom      % Now we have the photon's length!!
\negate\photonlengthx
\global\advance\gluonlengthx by \photonlengthx  % the difference
\global\divide\gluonlengthx by 2
\drawline\fermion[\E\REG](\fermionfrontx,\fermionfronty)[\gluonlengthx]
\drawline\photon[\E\FLIPPED](\pbackx,\pbacky)[8]  % Exactly as in phantom mode.
\drawline\fermion[\E\REG](\pbackx,\pbacky)[\gluonlengthx]
% This is even easier using stemmed photons!
\end{picture}
\vskip -0.1in
You might also try labelling the lines.  What would be the difficulty
in rotating this diagram through 45 degrees?
You will find it convenient to use the assignment statement
\verb@\global<name>=<name>@ mentioned above.  Remember that \bs seglength
and \bs gaplength always resume their defaults after a line is drawn.

\section{Storing and Re-Using Items}

It is often convenient, as well as efficient, to store a line, collection
of lines and vertices, or even an entire picture for re-use later.
\FEYNMAN\ itself continuously stores lines for various periods.
It is also useful to be able to store a parameter value for use
later in the same or a subsequent picture.  Examples of the latter have 
already been given and will now be presented formally.

\subsection{Storing and Re-Using Information}

The basic command for storing a parameter is
\begin{verbatim}
\global<parameter 1>=<parameter 2>
\end{verbatim}
Several examples were given in the previous section such as:
\begin{verbatim}
\global\gaplength=\Xone  \global\seglength=\Yone
\end{verbatim}
Such statements are particularly useful when some value needs to be 
altered, such as by
\begin{verbatim}
\global\advance\particlebackx by 2000
\end{verbatim}
and yet also need to be retained for further use.  Certain variables,
such as \verb@\vertexcount@, are dangerous to adjust and so would need
to be copied prior to alteration.  Note that \verb@\global<\name>=...@
is a \TeX\ primitive operation.  As discussed earlier \LaTeX\ 
has its own equivalent statements but these should not be used in conjunction
with variables defined internally by \FEYNMAN.  (For instance attempting
to use \verb@\setcounter@ in conjunction with \verb@\pmidx@ would result in
an error.)  The \verb@\global@ statement prior to \verb@<name>=, \advance@
\etc is often superfluous but it is safest to use it.  This makes the
changes instituted common to all subroutines called by \FEYNMAN.
If you continually forget to use it you may someday find the following
baffling sort of error:
\begin{verbatim}
TeX capacity exceeded.
Save Stack overflow.
\end{verbatim}
If this occurs go back and insert \verb@\global@
just prior to every assignment and alteration statement.

Every variable named must commence with a backslash (\bs)
however one cannot indiscriminantly create a variable, say \verb@\mycopy@,
by entering \verb@\global\mycopy=\pbackx@.
This is because {\em control sequences}, such as \verb@\begin@, also commence
with backslashes.  \FEYNMAN\ has pre-defined a series of empty variable
names which may be freely used.  These are
\begin{verbatim}
                   \Xone                    \Yone
                   \Xtwo                    \Ytwo  
                   \Xthree                  \Ythree
                   \Xfour                   \Yfour
                   \Xfive                   \Yfive
                   \Xsix                    \Ysix
                   \Xseven                  \Yseven
                   \Xeight                  \Yeight
\end{verbatim}
Not terribly imaginative, I'll grant you, but they work.
If the user feels obliged to define his own variable names be warned
that there is very little excess \LaTeX\ capacity available for such
man\oe vers.  A handfull may be defined.  This is done by entering
\begin{verbatim}
\global\newcount<your variable name>
\end{verbatim}
prior to assigning it a value.  This may be done on the same line:
\begin{verbatim}
\global\newcount\pmidycopy   \global\pmidycopy=\pmidy
\end{verbatim}
The globals may be omitted ({\it every} time \bs pmidycopy is assigned or
altered!) if the variable's value is not to be retained from picture to picture.
Note, however, that \verb@\pmidycopy@ will remain defined as a variable
until the end of the program and so
\verb@\global\newcount\pmidycopy@ must appear only once in the program
(this may be prior to the \verb@\begin{document}@ statement).
To repeat it is to receive an error.  Attempts to define variable names
such as ``\bs begin'' or ``\bs drawline'' lead to real trouble.

A word about outputting the value of a variable.  As illustrated
at the end of the final example of the previous section, one cannot
simply say \verb@\put(x,y){\pmidycopy}@ and expect the current value of
\verb@\pmidycopy@ to be placed that the indicated co-ordinates.
It must first be converted from a parameter name to what that name represents
(\ie evaluated).  This may be done by preceeding the variable by
\bs number or \bs the.  The same is true of output to the terminal which
is done via the \bs message command:
\begin{verbatim}
\message{pmidycopy=\the\pmidycopy}
\end{verbatim}
This latter is often useful for debugging your picture when things
are not appearing where you thought they would go.


\subsection{Storing and Re-Using Pictures}

\FEYNMAN\ has a number of specialized commands which enables the user to
store and re-use one or a number of lines.  To store a segment of, or an
entire, picture one utilizes \LaTeX's \bs{\it savebox} facility.
Unfortunately one will frequently exhaust \LaTeX's (tiny) internal
working memory when this is attempted.  The best solution in this
case is to ask a kindly \TeX\ wizard to expand \TeX's capacity.
