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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Special Symbols}


In order to make the input text for programs (and mathematics) more
readable, a number of special commands are introduced by the package
\verb+symbols.sty+.

The user can easily define new symbols himself.


\subsection{Predefined symbols}

A major feature of our styles is that they allow readable input for many
special symbols by providing `fancy' \TeX~commands. Example: In order to
obtain \(<==>\) one merely has to write \verb+<==>+.

Table~\ref{tab:SpecialSymbols} gives the list of the `fancy' symbols that
are introduced by the style \texttt{symbols.sty}.

Some characters --- such as \verb+%+ or \verb+#+ --- that have special
meanings in \TeX\ have to be set to normal in the \texttt{program}
environment, since they are standard characters in programming languages.
This is e.g.~done for the symbols in Table~\ref{tab:Normalized symbols} by
the \texttt{opal} environment.




\subsection{Defining your own symbols}

The tokens assembled by the scanner are usually treated as identifiers,
digits, or graphemes. However, there is also a way to turn them into
\emph{fancy commands}, that is, commands that cannot normally be written in
\TeX~ or \LaTeX. This is done by the following commands:

\begin{itemize}
  \item \verb=\SetCommand=
    
    defines its first argument as new ``fancy'' command and takes the second
    argument as its meaning. Example:
    \verb+\SetCommand{FUN}{\KeyWord{fun}}+ makes \texttt{FUN} into a
    command that produces \verb=\KeyWord{fun}=.
  
  \item \verb=\SetSymbol= 
    
    defines its first argument as new ``fancy'' command and takes the
    second argument as its meaning. (By contrast to \verb=\SetCommand= this
    command takes math mode into consideration.) Example:
    \verb+\SetSymbol{<=>}{\Leftrightarrow}+ makes \texttt{<=>} into a
    command that generates ``$\Leftrightarrow$''.
  
  \item \verb=\SetAmsSymbol=
    
    is analogous to \verb=\SetSymbol=, but has a third argument, which is
    used instead of the second one, when \verb=amssymb= is not loaded.
    Example:
\begin{verbatim}
  \SetAmsSymbol{>->}{\rightarrowtail}{%
      \mathbin{\raise0.18ex\hbox{$\scriptstyle>$}%
      \hskip-0.4em-\hskip-0.75em\raise0.18ex\hbox{$\scriptstyle>$}}}
\end{verbatim}
    Using \verb=>->= creates either ``$\rightarrowtail$'' or
``${\raise0.18ex\hbox{$\scriptstyle>$}%
  \hskip-0.4em-\hskip-0.75em\raise0.18ex\hbox{$\scriptstyle>$}}$'',
depending on the availability of \texttt{amssymb}.
    
  \item \verb=\UnSetSymbol=

    anihilates a fancy symbol. Example:
    \verb+\UnSetSymbol{<=>}+.

  \item \verb=\SetMacro=
    
    introduces the definition of a macro into the \TeX~``variable''
    \verb+\Special@Macros+. This variable is called in the \texttt{program}
    environment in order to make all these macros available. Example:
    \verb+\SetMacro{\/}{\vee}+ defines \verb+\/+ to stand for \verb+\vee+
    in the \texttt{program} environment.

\end{itemize}

If you have set the option \texttt{[suppress]}, then you can define all the
symbols in Table~\ref{tab:SpecialSymbols} by issuing the command
\begin{itemize}
  \item \verb=\SetAllSymbols=
\end{itemize}







\subsection{Sub/superscripts}

Sub- and superscripts in mathematical formulas are somewhat problematic,
because the two symbols \verb=^= and \verb=_= are printable characters in
many programming languages. Therefore, they are converted into normal
symbols in the \texttt{opal} environment (but \emph{not} in the
\texttt{program} environment).

\emph{However}, we do not want to lose the ability to use these symbols
also for sub- and supersetting. Here are the rules:

\begin{itemize}
  \item When \verb=^= is followed by a \verb={...}=-group, then it acts as
    \verb=\sp{...}=.
  \item When \verb=^= is followed by a digit, then it acts as \verb=\sp=.
  \item In all other cases the character \verb=^= is printed.
\end{itemize}

The rules for \verb=_= are analogous. Table~\ref{tab:subsup} shows examples
for the effects of sub- and supersetting.



