Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!udel!eplrx7!leipold From: leipold@eplrx7.uucp (Walt Leipold) Newsgroups: comp.text.tex Subject: LaTeX verbatim Message-ID: <1991Apr11.163230.10343@eplrx7.uucp> Date: 11 Apr 91 16:32:30 GMT Sender: usenet@ee.udel.edu Distribution: na Organization: DuPont Engineering Physics Laboratory Lines: 29 Nntp-Posting-Host: louie.udel.edu I'm writing a report (using LaTeX) which has to include a *lot* of short (1 to 40 line) code fragments. How the heck do I get each of these fragments displayed as an indented block of verbatim code? That is, how can I do it from a LaTeX \newcommand or \newenvironment? I can't figure out how to embed the \begin{verbatim}..\end{verbatim} into a LaTeX \newcommand or \newenvironment. I'm looking for something like \source{ linear(x,xmin,xmax,smin,smax) = if xmin=xmax then error "Linear interpolation with zero range." else (x-xmin)/(xmax-xmin)*(smax-smin) } I tried the \listing macro from the TeXbook, but it seems to work only for material that's \input (maybe because the EOF on the \input file puts all the character codes back where they belong?). Creating a hundred little source files just to get LaTeX to display 'em properly doesn't appeal to me... -- -------------------------------------------------------------------------- "Never attribute to malice that which Walt Leipold is adequately explained by stupidity." (leipolw%esvax@dupont.com) -------------------------------------------------------------------------- -- The UUCP Mailer