% Hideki ISOZAKI isozaki@expert-sun.ntt.junet
% $@F|K\8l(JLaTeX$@MQ%(%i!<%a%C%;!<%8!%(J
%      ****************************************
%      *           ERROR HANDLING             *
%      ****************************************
%
%  \@latexerr{MSG}{HLP}: Types a LaTeX error message MSG and gives an error
%                          halt with error help message HLP.
%
%\newlinechar`\^^J  

\def\@latexerr#1#2{\begingroup
\edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}%
\typeout{LaTeX $@%(%i!<!%(J \space LaTeX $@%^%K%e%"%k$r8+$F$/$@$5$$!%(J^^J
 \space\@spaces\@spaces\@spaces $@%X%k%W$O(J\space H <return> \space 
}\typeout{#1}\errmessage{}\endgroup}

\def\@spaces{\space\space\space\space}

%% error help message pieces.
\def\@eha{$@$3$N%3%^%s%I$OL5;k$7$^$9!%(J
^^J$@$[$+$N%3%^%s%I$KCV$-49$($?$1$l$P(J \space I <command> <return> \space $@$r(J
^^J$@$=$N$^$^B39T$7$?$1$l$P(J\space <return> \space $@$r(J}
\def\@ehb{$@J8>O$,0lIt<:$o$l$^$9!%(J \space \@ehc}
\def\@ehc{$@B39T$7$?$1$l$P(J \space <return> 
  \space $@$r!%(J^^J$@$&$^$/$$$+$J$+$C$?$i(J \space X <return> \space $@$G(J
  $@=*N;$7$F$/$@$5$$!%(J}
\def\@ehd{$@$3$3$GLdBj$,H/@8$7$^$7$?!%(J  \space\@ehc}

% Here are all the error message-generating commands of LaTeX.
%
% \@notdefinable : Error message generated in \@ifdefinable from calls
%                  by \newcommand, \newlength, \newtheorem specifying an
%                  already-defined command name.
%
% \@nolnerr      : Generated by \newline and \\ when called in vertical mode.
%                  
% '\... undefined' : Generated in \renewcommand.
%
% \@nocnterr     : Generated by \setcounter, \addtocounter or \newcounter
%                  for undefined counter.
%
% \@ctrerr       : Called when trying to print the value of a counter 
%                  numbered by letters that's greater than 26.
%
% 'Environment --- undefined' : Issued by \begin for undefined environment.
%
% \@badend       : Called by \end that doesn't match its \begin.
%
% \@badmath      : Called by \[, \], \( or \) when used in wrong mode.
%
% \@toodeep      : Called by a list environment nested more than six levels
%                  deep, or an enumerate or itemize nested more than four
%                  levels.
%
% \@badpoptabs   : Called by \endtabbing when not enough \poptabs have
%                  occurred, or by \poptabs when too many have occurred.
%
% \@badtab : Called by \>, \+ , \- or \< when stepping to an undefined tab.
%
% 'tab overflow' : Occurs in \= when maximum number of tabs exceeded.
%
% '\< in mid line' : Occurs in \< when it appears in middle of line.
%
% \@preamerr : Occurs in array or tabular environment, or in \multicolumn
%              command, when error in argument detected.
%
% \@badlinearg : Occurs in \line and \vector command when a bad slope 
%                argument is encountered.
%
% \@parmoderr  : Occurs in a float environment or a \marginpar when
%                encountered in inner vertical mode.
%
% \@fltovf     : Occurs in float environment or \marginpar when there
%                are no more free boxes for storing floats.
%
% \@latexbug   :  Occurs in output routine.  This is bad news.
%
% 'Float(s) lost' : In output routine, caused by a float environment or
%                   \marginpar occurring in inner vertical mode.
%
% \@nofonterror   : Typeface not available.  %%% OBSOLETE; DELETED.
%
% \@badcrerr      : A \\ used where it shouldn't be in a centering or flushing
%                   environment.
%
% \@noitemerr     : \addvspace or \addpenalty was called when not in vmode.  
%                   Probably caused by a missing \item.
%
% \@notprerr      : A command that can be used only in the preamble
%                   appears after the \begin{document} command.

\def\@notdefinable{\@latexerr{'\@tempa' $@$H$$$&%3%^%s%I$O$9$G$K$"$j$^$9!%(J}\@eha}

\def\@nolnerr{\@latexerr{$@6/@)2~9T$9$k9T$NCf?H$,$"$j$^$;$s!%(J}\@eha}

\def\@nocnterr{\@latexerr{$@%+%&%s%?!<$,Dj5A$5$l$F$$$^$;$s!%(J}\@eha}

\def\@ctrerr{\@latexerr{$@%+%&%s%?!<$,Bg$-$9$.$^$9!%(J}\@ehb}

\def\@nodocument{\@latexerr{\string\begin{document}$@$,$"$j$^$;$s!%(J}\@ehd}

\def\@badend#1{\@latexerr{\string\end{#1}$@$OAa$9$.$^$9!%(J
\string\begin{\@currenvir} $@$O$I$&$J$C$?$N$G$9$+!%(J}\@eha}

\def\@badmath{\@latexerr{$@?t<0%b!<%I$N3+;O!J=*N;!K$,0[>o$G$9!%(J}\@eha}

\def\@toodeep{\@latexerr{$@%M%9%H$,?<$9$.$^$9!%(J}\@ehd}

\def\@badpoptabs{\@latexerr{\string\pushtabs \space $@$H(J \string\poptabs
    \space $@$,%^%C%A$7$^$;$s!%(J}\@ehd}

\def\@badtab{\@latexerr{$@BP1~$9$k%?%V0LCV$,@_Dj$5$l$F$$$^$;$s!%(J}\@ehd}

\def\@preamerr#1{\@latexerr{\ifcase #1 $@$3$NJ8;z$O;H$($^$;$s!%(J\or
 $@%"%l%$$N0z?t$K(J @-exp $@$,$"$j$^$;$s!%(J\or
 $@%"%l%$$N0z?t$K(J p-arg $@$,$"$j$^$;$s!%(J\fi\space
     }\@ehd}

\def\@badlinearg{\@latexerr{\string\line\space $@$+(J \string\vector
   \space $@$N0z?t$,ITE,@Z$G$9!%(J}\@ehb}

\def\@parmoderr{\@latexerr{Not in outer par mode}\@ehb}

\def\@fltovf{\@latexerr{$@%U%m!<%H$,B?$9$.$^$9!%(J}\@ehb}

\def\@latexbug{\@latexerr{LaTeX $@$N%P%0$H;W$o$l$^$9!%(J}{$@C/$+$K(J
$@=u$1$F$b$i$C$F$/$@$5$$!%(J}}

% \def\@nofonterror{\@latexerr{Typeface not available}\@eha}

\def\@badcrerr {\@latexerr{\string\\ $@$N;H$$J}$,ITE,@Z$G$9!%(J}\@ehc}

\def\@noitemerr{\@latexerr{\string\item $@$,$"$j$^$;$s!%(J}\@ehc}

\def\@notprerr {\@latexerr{\string\begin{document}$@$NA0$K$7$+=q$1$^$;$s!%(J}\@eha}


