[net.text] TeX macro for a ``verbatim'' listing

rease@IITCS.UUCP (Tim Rease) (01/11/85)

.

Has anyone developed a macro for TeX which will produce a ``verbatim''
listing of its parameter?

Some examples are given in Knuth's The TeXbook, but after
they have been used once, such as in the middle of your document,
their effects continue throughout the rest of the document; 
i.e. once the macro has been used, it won't turn itself off!

If anyone has one, I am in desperate need of it!

Please reply to:	ihnp4!iitcs!rease


Thank you

chris@umcp-cs.UUCP (Chris Torek) (01/13/85)

We have one which I almost don't want to post.  (It's that ugly...)
It verbatims all text from "\begincf" until the string "`@" (without
the double quotes).  Here it is; don't forget to delete the .signature:

% fonts
\font\bigtt=amtt10 scaled 1200
\font\bigrm=amr10 scaled 1200
\font\bigbf=ambx10 scaled 1200
\font\bigtitle=amssbx10 scaled 1200

\footline={} % no page numbers
\chardef\backquote=`\` % a backquote (`)
{\obeyspaces \gdef {\ }} % spaces are REALLY spaces
{\catcode`\`=13\gdef`{\testendcf}} % make active ` invoke \testendcf

% make RETURN break lines, when it's active
\def\creturn{\futurelet\next\checkline}
{\catcode13=\active% these lines must end with %
  \gdef\checkline{\ifx\next^^M\let\next=\blankstuff\else\let\next=\endgraf\fi%
    \next}%
  \gdef^^M{\creturn}}
\def\blankstuff{\endgraf\vskip0.0pt\leavevmode}

% stuff for magic cf text
\def\midcf{\begingroup
  \catcode`\\=12
  \catcode`\{=12
  \catcode`\}=12
  \catcode`\$=12
  \catcode`\&=12
  \catcode`\#=12
  \catcode`\%=12
  \catcode`\~=12
  \catcode`\_=12
  \catcode`\^=12
  \obeyspaces
  \bigtt}

\def\mypar{\endgraf\message{How did I get here?}}
% \def\mypar{\message{HI}\endgraf\vskip\baselineskip\leavevmode}
\outer\def\begincf{\midcf\let\par=\mypar
  \parskip=0.0pt\parindent=0.0pt
  \catcode`\`=\active\catcode13=\active}
\def\testendcf{\futurelet\next\testendtu}
\def\testendtu{\ifx\next@\let\next=\endcf\else\let\next=\relax\backquote\fi
  \next}
\def\endcf@{\endgroup}
% that's all...
-- 
(This line accidently left nonblank.)

In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland