From: overman@point.mps.ohio-state.edu (Ed Overman)
Newsgroups: comp.text.tex
Subject: > Problems with "|" in {verbatim} after "s_tables"
Followup-To: <hm308ba.714986204@unidui>
Date: 31 Aug 1992 07:25:36 -0400
Organization: Department of Mathematics, The Ohio State University
Distribution: world
NNTP-Posting-Host: point.mps.ohio-state.edu



> Hi TEXers,
> 
> I use the "s_tables" macros in LaTeX to create tables.
> 
> The problem arises when I try to import some lines of plain ASCII 
> containing the pipe character "|" into a {verbatim} environment later.
> 
> Each occurence of this character in {verbatim} produces error messages
> like the follwing:
> ----------------------------------------------------------------------
> ! Undefined control sequence.
> <argument> ...   Text^^M     |  ^  ^^^M        ...
> 
> \@xverbatim #1\end{verbatim}->#1
>                                 \end [verbatim]
> l.93 \end{verbatim}
> ---------------------------------------------------------------------- 
> 
> "|" has a special meaning inside a "stable" that seems to keep alive
> outside (even within {verbatim} ) ...  Are there any ideas how to stop that?
> 
> Thanks in advance!
> 
>  +----------------------------+-----------------------------------------+
>  |       Mathias Bartsch      |  Laboratorium f. Festkoerperphysik      |
>  |   Uni -GH- Duisburg (FB10) |  phone : +49 203 379 3476               |
>  |       Lotharstr. 1-21      |  Email : hm308ba@unidui.uni-duisburg.de |
>  |      W-4100 DUISBURG 1     |  FAX   : +49 203 379 3163               |
>  +----------------------------+-----------------------------------------+

There is a small problem with  stables  that should be fixed by anyone who
uses the package, namely, as described above, the "|" character is redefined
and cannot be used normally by TeX or LaTeX (including in math mode).  The
fix is quite simple and can be made by any user (JUST MAKE SURE TO DOCUMENT
THE CHANGES).

The problem:
The catcode of "|" is changed by
  \catcode`\|=\active%
so that it cannot be used normally.  This MUST be done by  stables  so that
the "|" can be used to delimit columns of a table.  The problem is that it
is defined when  stables  is INPUT, i.e.,
  \input stables
and NOT inside the macro  \stablestart .  Thus, "|" cannot be used normally
after
  \input stables

The fix:
Remove the line (it is about line 67)
  \catcode`\|=\active%
and replace the line (it is about line 132)
  \def\stablestart{%
by
  {\catcode`\|=\active %   Vertical Bar Activation to define \stablestart
  \gdef\stablestart{%
    \catcode`\|=\active %   Vertical Bar Activation in \stablestart
    \def|{\relax\ifmmode \vert \else \global\advance\stablesmode by 1&&&\fi}%
Finally, change the line (it is about line 230)
    \stablesomitfalse}
to
    \stablesomitfalse}%
  }

What does this do:
  1) The catcode of "|" must be changed OUTSIDE the macro  \stablestart
     so that the contents of the macro will be interpreted correctly.
     (Normally, "\def|" will cause an error message when TeX READS the macro
     because "|" is not an active character - this is different from the
     "\catcode`\|=\active" just preceding the "\def|" which makes "|" an
     active character INSIDE "\stablestart ... \stablesend".  (If you don't
     understand this - just trust me.)
  2) "\def\stablestart" must be changed to "\gdef\stablestart" since it is
     now defined inside a group (i.e., "{ ... }").
  3) Next we change the catcode of "|" to active and define it.  The
     original definition was
       \def|{\global\advance\stablesmode by 1&&&}%
     However we want "|" to retain its normal meaning inside math mode
     (even inside a table) and so we check if "|" occurs in math mode.
     If it does, keep its normal meaning (it is equivalent to  \vert).
     Otherwise, use its definition in  stables .
  4) Finally, we must end the "\catcode" before the definition of
     \stablestart  by adding an "}" after the macro's definition ends.

Ed Overman
The TeXbook --- similar to the Bible but has a better index.