[comp.text.tex] Do something special in verbatim

weiske@lan.informatik.tu-muenchen.dbp.de (Thomas Weiske) (06/13/90)

Here is a macro, that allows you to escape verbatim
mode and to call macros.  The idea is to define
a new command char, for example '@', that is not
used in the verbatim environment.

% \beginspecial\begin{verbatim} ... verb @macro... \end{verbatim}\endspecial
\def\beginspecial{\catcode`@=0}
\def\endspecial{\catcode`@=12}

Grammar with bold tokens
\def\bebecoms{$\rightarrow$}
\beginspecial\begin{verbatim}
       while_stat @bebecoms @bf while @tt cond @bf do @tt stat_list @bf od @tt
       stat_list  @bebecoms  stat ; stat_list
				  |
\end{verbatim}\endspecial

I think the idea is old but not too bad.