%  Appendix C of FEYNMANDOC
\appendix
\addtocounter{chapter}{2}
\chapter{Errors}

In this appendix we discuss some of the more common errors which you might
encounter.  When the statement \verb@LATEX <FILENAME>@ 
is executed it will produce
a number of files including a \verb@<FILENAME>.LIS@ file.
Error messages will be recorded in this file (which the user often deletes
automatically if running a \TeX\ program via a standard user-defined macro).
If submitted interactively they will also appear on the terminal screen.
Rule one is to check the error message in the LIS file and locate the
purportedly offending code sequence.  Check for typos, particularly missing
backslashes, \bs end\{...\}, omitted blank spaces
and incautious use of upper or lower case letters.
If you cannot understand the error after using this appendix you might try,
firstly, the on-line interactive help facility or, failing that, the ERROR
sections in the \LaTeX\ and \TeX\ manuals.

\section{Option Errors}

\FEYNMAN\ issues a number of error statements if an incorrect sequence of
parameters is issued to a \ddrawline, \ddrawvertex\ or \bs drawloop command.
The most common of these is
\begin{verbatim}
           *** ERROR IN PARTICLE OPTIONS SELECTION ***
\end{verbatim}
This means that you asked for a combination of parameters which does not exist
or has not been implemented.  Examples are asking for a FERMION of any type
other than REG, a PHOTON in the \bs E direction of type FLIPPEDLONG, a 5-gluon
vertex, a four-scalar vertex, a photon loop and so forth.  The usual result is
that, instead of the desired line(s) a series of tiny ``Error'' statements will
appear in your diagram (see section C.2 for an example).  
Other messages of this type are:
\begin{verbatim}
           *** ERROR IN PARTICLE TYPE SELECTION ***
  +++ Try with line type \fermion, \scalar, \photon, \gluon (see manual) +++

           *** ERROR IN PARTICLE DIRECTION SELECTION ***
   +++ Try again with direction N, NE, E, SE etc. or see manual +++
\end{verbatim}
In the first instance you specified some type of line of type other than
\bs fermion, \bs scalar, \bs photon or \bs gluon.  In the second instance a
direction other than \verb@\N, \NE, \E, \SE, \S, \SW, \W@ or \verb@\NW@ was
specified (for instance ``\bs NNW'' or ``E'').  This may have been preceded by 
``Expecting Number...'' (see below).
Another message in the same vein is
\begin{verbatim}
       *** ERROR:  PARTICLE OF NEGATIVE OR ZERO LENGTH REQUESTED. ***   
       ***         TAKING ABSOLUTE VALUE.                         ***  
\end{verbatim}
which is self-explanatory.  Just remember that most parameters such as 
\bs photonlengthx, \bs plengthy \etc\ may be positive or negative
(see section 2.6).

A warning or error statement will be issued if a line of absurd length has been
requested.   For gluons, for instance, the statements would be
\begin{verbatim}
*** WARNING *** Gluon with <specified number of loops> loops requested ***
\end{verbatim}
if the number of loops which 
the user had requested was in excess of 40 and further
\begin{verbatim}
*** Reducing gluon length to 6 loops (max 85) *** 
\end{verbatim}
if the user had requested in excess of 85 loops and finally
\begin{verbatim}
*** Probable Cause:  Gluon selected instead of Fermion ***
\end{verbatim}
if the user had requested more than 1000 loops.

The latter recognizes a common cause of such problems:\ \ copying lines with an
editor.  When a \ddrawline\bs fermion statement for a fermion of length 2000
is copied and altered to generate a photon the user may forget to change the
length and thus request a photon of 2000 half-wiggles!  The result 
would be (if not caught)
either to run out of \TeX\ capacity or to produce about 30 blank pages on your
laser printer.

\section{Unexpected Results and Other Errors}

Overcoming exhausted \TeX\ capacity will be dealt with separately in the next
section.  Here we consider unusual objects which may appear in one's Feynman
diagram and a few strange \TeX-generated error messages.

\hskip 1.05in
\begin{picture}(8000,8000)
\put(-8000,4000){The diagram}
\global\unitboxheight=-900
\drawline\gluon[\SE\FLAT](0,6500)[6]
\drawline\fermion[\N\REG](\gluonfrontx,\gluonfronty)[1000]
\drawline\fermion[\W\REG](\gluonfrontx,\gluonfronty)[1000]
\drawline\fermion[\S\REG](\gluonbackx,\gluonbacky)[1000]
\drawline\fermion[\E\REG](\gluonbackx,\gluonbacky)[1000]
\global\advance\pbackx by 2500
\put(\pbackx,4000){was produced by}
\end{picture}
\begin{verbatim}

\begin{picture}(8000,8000)
\drawline\gluon[\SE\FLAT](0,7000)[6]
\drawline\fermion[\N\REG](\gluonfrontx,\gluonfronty)[1000]
\drawline\fermion[\W\REG](\gluonfrontx,\gluonfronty)[1000]
\drawline\fermion[\S\REG](\gluonbackx,\gluonbacky)[1000]
\drawline\fermion[\E\REG](\gluonbackx,\gluonbacky)[1000]
\end{picture}
\end{verbatim}
because gluons in the SE direction cannot appear in the \bs FLAT mode
(see ``ERROR IN PARTICLE OPTIONS SELECTION'' in C.1).
\medskip

{\bf Unexpected gaps and invisible lines:}\ \ These 
may appear as the result of drawing diagonal straight lines of length less than
the minimum of 1416 centipoints.  This may occur in fermions, scalars (of
seglength less than the above), stems and caps.  The minimum size of a circle
is 401 centipoints.  See also section 4.1.2.
\medskip

Broken horizontal photons, such as
\vskip -0.205in  \hskip 2.43in
%\begin{picture}(8200,2000)
\begin{picture}(8200,0)
\bigphotons
\drawline\photon[\E\REG](0,0)[8]
\end{picture}
are the result of mis-using (or not using) ``\bs bigphotons'' (section 2.9).
\global\BIGPHOTONS=0pt % re-set for rest of document.
\medskip

Other sorts of errors are:

\medskip
{\bf Expected Number ...}\ \ \ You've left a backslash off of a parameter or
variable.
\begin{verbatim}

LaTeX error.  See LaTeX manual for explanation.
              Type  H <return>  for immediate help.
! \begin{picture} ended by \end{document}.
\end{verbatim}
or, possibly something like
\begin{verbatim}
! Missing } inserted.
<inserted text> 
                }
<to be read again> 
                   \vfil 
\newpage ->\par \vfil 
                      \penalty -\@M 
\clearpage ->\newpage 
                      \write \m@ne {}\vbox {}\penalty -\@Mi 
\enddocument ->\@checkend {document}\clearpage 
                                               \begingroup \if@filesw \immed...

\end #1->\csname end#1\endcsname 
                                 \endgroup \@checkend {#1}\if@ignore \global...
l.13 \end{document}
\end{verbatim}                   
You've forgotten to close a grouping with a \bs end\{...\}.  In this case you
forgot the \verb@\end{picture}@ statement.
If the error is
\begin{verbatim}
! Use of \picture doesn't match its definition.
\end{verbatim}
Then you typed ``\bs picture'' instead of ``picture''.

\section{\TeX\ Capacity Exceeded}

This is the most dreaded of all error messages.  It is also the most common.

\LaTeX\ allows the user a certain amount of internal working space and then
uses up most of it itself.  To increase this a \TeX\ wizard must re-compile
\TeX\ (generally in Pascal).  The most obvious way in which \TeX\ will exceed
its limit is if there is too much text.  Since \FEYNMAN\ uses quite a bit of 
\LaTeX's internal resources this limits the size and complexity of diagrams to
roughly that of the cover diagram.  If gluons are not involved then more
complex diagrams are possible.  \LaTeX\ provides a partial solution to this
problem which will be discussed last.
When \TeX\ is used the LIS file will end with a summary of memory usage of the
form:
\begin{verbatim}

Here is how much of TeX's memory you used:
 462 strings out of 2520
 4525 string characters out of 29548
 44019 words of memory out of 65501
 2381 multiletter control sequences out of 2500
 19296 words of font info for 73 fonts, out of 35000 for 100
 14 hyphenation exceptions out of 307
 20i,16n,53p,168b,280s stack positions out of 200i,40n,60p,500b,600s
No pages of output.
\end{verbatim}

\subsection{Exhausting Internal Storage}

\TeX\ keeps track of a number of internal variables and will cease processing a
file should the allocated maximum usage be exceeded.  When \FEYNMAN\ is being
used extensively the most common \TeX\ capacity exceeded messages will be:

\medskip
{\bf Save-Stack:}\ \ Likely cause is that variables were passed both locally and
globally between subroutines too many times.  Check that \bs global precedes
all assignment statements, arithmetic operations (except \bs negate \etc) and
so forth.  In the above LIS file example 280 out of 600 S-stack (save stack)
positions were used.

\medskip
{\bf P-Stack:}\ \ Your macro definitions have exceeded the maximum total
number of arguments permitted.
This, and the above error, could be caused by a recursive definition gone awry.
In the above example 53 out of 60 P-Stack positions were used.

\medskip
{\bf ! No room for a new \bs count.:}\ \ You have defined too many numerical 
counters via the \bs newcount or \bs newcounter command.  Between them \TeX,
\LaTeX, and \FEYNMAN, may use up to 218 out of 234 available counters.  Try to
re-use old variables, the \bs Xone...\bs Yeight available for the user or use
some \bs dimen counters where possible.
Typically the last few lines in your LIS file will look like:
\begin{verbatim}

\OOO=\count234

! No room for a new \count .
\ch@ck ...\else \errmessage {No room for a new #3}
                                                  \fi 
\alloc@ ...\advance \count 1#1by\@ne \ch@ck #1#4#2
                                                  \allocationnumber =\count ...
l.36 \newcount\PPP
                  
\end{verbatim}
followed by a synopsis of \TeX's memory usage.

\medskip
{\bf Multi-letter Control Sequences:}\ \ Probably too many macro \bs def's
defined.  Many such errors will occur if you attempt to input 
\FEYNMAN\ more than once.

\subsection{Exhausting Memory Size}

If your LIS file tells you that you've used 65501 words of memory out of 65501
then you have reached the maximum file `size' that \LaTeX\ will permit.
Unless you've made some error, such as having a file \bs input itself, your
choices are to enlarge \TeX\ (this requires a `wizard', whatever that is),
make your program smaller, or break your document up into smaller pieces.
The last option would be irritating if, for instance, you were writing a book
and had to continually keep track of cross-references between these divisions,
page numbering and so forth.  \LaTeX\ uses the \bs include facility to
alleviate the tedium.  The only drawback is that after a break in the document
the new position will begin on a fresh page.  Individual Feynman diagrams cannot
be broken up this way and this limits their ultimate complexity.

To process just a portion of a document place the different portions in a
series of files and have a {\em driving} file which includes the statements
\begin{verbatim}
\include <file1> \include <file2> \include <file3>... \include <file n> 
\end{verbatim}
These should appear at the positions in which you want them and may be
interspersed with text and commands within the driving file.  Prior to
\TeX ing the file the commands \verb@includeonly <file>@
should appear for each piece that you want processed on that particular run.
For instance, to print out the 
first part of chapter three of this manual I have a file, which I call
FD3A.TEX, containing
\begin{verbatim}
\documentstyle[11pt]{report}
\input FEYNMAN
\includeonly{FEYNMANDOC3A}
\input FEYNMANDOC.INC
\end{verbatim}
where the file FEYNMANDOC.INC, unconditionally input, contains
\begin{verbatim}
\textheight 700pt \textwidth 450pt
<VARIOUS DEFINITIONS COMMON TO ALL PARTS>

\begin{document}           % End of preamble and beginning of text.

\include{FEYNMANDOCTITLE}
\include{FEYNMANDOCPRELIMS}
\include{FEYNMANDOC1}
\include{FEYNMANDOC2A}
\include{FEYNMANDOC2B}
\include{FEYNMANDOC2C}
                     .
                     .
                     .
\include{FEYNMANDOC4H}
\include{FEYNMANDOC4I}
\include{FEYNMANDOC4J}
\include{FEYNMANDOCEXER}
\include{FEYNMANDOCAPPB}
\include{FEYNMANDOCAPPC}
\end{document}
\end{verbatim}
When executed each section will create a number of files such as the 
\verb@<filename>.AUX@ file.  These must be retained on your \TeX\ directory
as they transmit
information about one section to the others.  AUX files tell about page
numbering, sections \etc,  BIB files contain the accumulated bibliography, TOC
files the table of contents and so forth.  For this reason it may take several
runs to get your document to come out correctly as each AUX file will be
updating itself based upon updates of the other AUX files.  TOC files will be
the last to come out correctly.  To print out this entire document I had a
COMMAND file called MAKEDOC.COM which contained:
\begin{verbatim}
$ SET DEFAULT DRA1:[LEVINE.TEXBOOK]
$ LATEXIT FDTITLE
$ LATEXIT FDPRE
$ LATEXIT FD1
$ LATEXIT FD2A
$ LATEXIT FD2B
$ PURGE FD*.AUX
$ LATEXIT FD2C
       .
       .
       .
$ LATEXIT FD4H
$ LATEXIT FD4I
$ LATEXIT FD4J
$ PURGE FD*.AUX
$ LATEXIT FDADDA
$ LATEXIT FDAPPB
$ LATEXIT FDAPPC
$ PURGE FD*.*
$ PURGE FEYNMANDOC*.*

\end{verbatim}
Where LATEXIT is a command which \LaTeX s a file, sends it to the printer and
then erases the LIS and printer files.  The files FD1, FD2A \etc\ 
are like the small FD3A
file above which processed just the first part of chapter three.
The PURGE statements remove old versions of the AUX files from your disk.
The above file is sent as a batch job by a command file like PRINTDOC which
contains
\begin{verbatim}
$!  Prints FEYNMANDOC.TEX...all of it.
$ SET DEFAULT DRA1:[LEVINE.TEXBOOK]
$ SUBMIT/NOPRINTER/NOTIFY DRA1:[LEVINE.TEXBOOK]MAKEDOC.COM
\end{verbatim}
The above is in VAX code but the format on other machines should be apparent.
\vskip 3.5in
\vbox{
\vfill
This work was supported by the UK Science and Engineering Research Council.
I would like to thank all of the people at the Cavendish Labs, Cambridge,
England, who gave their preferences and comments as to which line styles
should be incorporated.

\hskip 2in  Michael Levine, 1988
}
