🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #1378

Re: Help me with \def and verbatim (in LaTeX)

#1378
From: Victor Eijkhout
Date: Fri, 17 Apr 1992 16:10
36 lines
1668 bytes
In article <kut4fnINN385@alhena.usc.edu>, ajayshah@alhena.usc.edu (Ajay Shah) writes:

|> I'm trying to \def something which uses \begin{verbatim} and \end{verbatim}.
|> How should it be done?

Tricky business, old chap.

|> \def\fndef#1#2{
|> \item \index{Library Function {\tt #1}}
|> \small \begin{verbatim}
|> #2
|> \end{verbatim} \normalsize
|> }

This won't work. As you've found out. The \begin{verbatim} sets up a lot
of exceptional values for certain TeX parameters (category codes of
most of the special characters), but if you scoop up the verbatim text
as argument #2, you've already fixed their values, and there's nothing the
verbatim mode can do about it.

If you leave out parameter #2, and abuse the grouping of LaTeX's
environments you can write

\def\beginfndef#1{
\item \index{Library Function {\tt #1}}
\small \begin{verbatim}}

\begin{fndef}{name of hte function}
ver@@#$^batim
}}}}{{{{text!&&&&
\end{verbatim}\end{fndef}

If the double \end bothers you, you can redefine some internal LaTeX
commands for the verbatim mode, but I doubt that that's worth the trouble.

Victor.
Technical Details
Message-ID: <kutu2uINNdbf@utkcs2.cs.utk.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!darwin.sura.net!gatech!utkcs2!cupid.cs.utk.edu!eijkhout
References: <kut4fnINN385@alhena.usc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!darwin.sura.net!gatech!utkcs2!cupid.cs.utk.edu!eijkhout
From: eijkhout@cupid.cs.utk.edu (Victor Eijkhout)
Newsgroups: comp.text.tex
Subject: Re: Help me with \def and verbatim (in LaTeX)
Date: 17 Apr 92 16:10:06 GMT
Organization: Computer Science Dept, University of Tennesee, Knoxville
Lines: 36
Distribution: world
Message-ID: <kutu2uINNdbf@utkcs2.cs.utk.edu>
References: <kut4fnINN385@alhena.usc.edu>
Reply-To: eijkhout@cupid.cs.utk.edu (Victor Eijkhout)
NNTP-Posting-Host: cupid.cs.utk.edu