[texhax] custom verbatim macro
Jan Zouhar
janzouhar at quick.cz
Sat Jan 3 16:03:16 CET 2004
hi,
i tried create my custom tex verbatim macro, that takes input text
between \verbatim ... \verbatimend, prints it without interpreting (
like other verbatim macros do), prints some separator and finally prints
the input text processed by tex.
ex: \berbatim $a \rightarrow b$
output: $a \rightarrow b$ -- a->b
My problem is that i can read input, set category of special characters
to 12, print non-interpreted text but i can't set category of special
characters back to get interpreted output.
So i get output: $a \rightarrow b$ -- $a \rightarrow b$
Can anubody help me, please?
Code:
\def\verbatimsep{--}
\chardef\other=12
\def\do#1{\catcode`#1=\other}
\long\def\normalprint#1{%
\verbatimsep
\begingroup
\tt
#1
\endgroup
}
\def\setverbatim{
\begingroup
\noindent
\dospecials
\obeyspaces
\tt }
\long\def\verbatim{
\setverbatim
\verbatimprint }
{
\catcode`\|=0
|catcode`|\=\other
|long|gdef|verbatimprint#1\verbatimend{
#1
|endgroup
|normalprint{#1}
}
}
More information about the texhax
mailing list