% LAST EDIT: Tue Sep  3 13:04:43 1996 by Peter Pepper (basti!pepper) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\section{Trouble shooting}


The styles appear to be working acceptably well. There are a few typical
problems that may arise.

\begin{itemize}
  \item A wide program fragment may cause \emph{large gaps} in the
    surrounding program. This is due to the fact that everything is
    organized as nested tabular environments.

    \emph{Solution}: The commands \verb+\0+ and \verb+\Shrink+ can be used
    to create zero width.
    
  \item A \emph{line number} appears on the successive line.
    
    \emph{Solution}: The \verb+\lnr+ has to come \emph{before} the comment.

  \item In \emph{unaligned comments} the \emph{spaces} may disappear, or
    there may be undesired spaces.

    \emph{Solution 1}: Missing spaces have to be enforced by `\verb+~+'.

    \emph{Solution 2}: Unwanted spaces are trickier. Suppose you obtain
    something like $f~(x~)$. The only way to get rid of the spaces is to
    write your own little command

    \verb+\newcommand{\short}[1]{\hbox to 0.6em{#1}}+ 

    and then write \verb+\short{f}(\short{x})+.
    
  \item The principle of longest match sometimes generates unexpected
    output. For example, \verb=IMPORT Foo[+]= doesn't work as expected,
    since it generates \(IMPORT Foo[+]\) instead of \(IMPORT Foo[ +]\).

    \emph{Solution}: The desired output is obtained by adding a space:
    \verb=IMPORT Foo[ +]=.
    
  \item Problems with \verb=^= and \verb=_=: If you try to define commands
    like \verb=\SetSymbol{^|^}{...}= or \verb=\SetSymbol{_|}{...}=, you
    have to turn the \verb=^= or the \verb=_= into normal characters first.
    One solution is
    \verb+\catcode`\^=12\SetSymbol{^|^}{...}\catcode`\^=7+ and
    \verb+\catcode`\_=12\SetSymbol{_|}{...}\catcode`\_=8+.
    
    A better way is to do the change of category only locally within a
    group. However, this would make the new command \verb=^|^= also only
    locally known. Hence, the solution is slightly more complex:
\begin{verbatim}
{ \catcode`\^=12
  \global\def\MyNewSymbol{\SetSymbol{^|^}{...}}
}\MyNewSymbol
\end{verbatim}
    
  \item \verb+\`...'+ does \emph{not} work in environments, where \verb+\`+
    is used as a special macro (for instance in tabular environments). 

    \emph{Solution}: Use \verb+\KeyWord{foo}+.


  \item It has not yet been tested, whether the fancy commands and symbols
    can be used with parameters.


\end{itemize}

The scanner appears to harmonize with most \TeX~and \LaTeX~features (and to
be reasonably efficient%
\footnote{ The scanner works on a line-by-line basis.}). However,
there are known problems:

\begin{itemize}
\item \TeX~constructs such as \verb=\hbox to 12pt{...}= do not work. 
  
  \emph{Reason}: In order to properly cope with macro parameters and with
  sub- or superscripts, the scanner has to enclose many tokens into
  parantheses \verb={...}=. This is, however, forbidden for things like
  ``\texttt{12pt}''.

  \emph{Solution}: Define an auxiliary command 
  \verb=\def\mybox{\hbox to 12 pt}= outside of the program and use 
  \verb=\mybox{...}= inside.

\item An \verb=\end{...}= command cannot be used inside programs.

  \emph{Reason}: The scanner looks for \verb=\end= in order to stop at
  \verb=\end{program}=

  \emph{Solution}: Same as above.

\item If you write \verb=$...$= inside a program, the first \verb=$=
  switches the scanner and math mode \emph{off}! The second \verb=$=
  switches math mode on again, but not the scanner (unless you have said
  \verb=\ActivateMathScan=). At the following line the scanner is switched
  on again.

  If \verb=\ActivateMathScan= is set, then the situation
  \verb=$...$= simply switches \emph{off} scanning \emph{between} the
  two \verb=$= symbols.


\end{itemize}







