Path: utzoo!utgpu!watmath!att!dptg!rutgers!gatech!ncar!boulder!hartzell@boulder.Colorado.EDU From: hartzell@boulder.Colorado.EDU (George Hartzell) Newsgroups: comp.text,cu.users.tex Subject: Re: verbatim macros in latex Message-ID: <11182@boulder.Colorado.EDU> Date: 30 Aug 89 23:43:35 GMT References: <11181@boulder.Colorado.EDU> Sender: news@boulder.Colorado.EDU Reply-To: hartzell@boulder.Colorado.EDU (George Hartzell) Followup-To: comp.text Organization: MCD Biology, University of Colorado, Boulder Lines: 113 In-reply-to: hartzell@boulder.Colorado.EDU (George Hartzell) In article <11181@boulder.Colorado.EDU>, hartzell@boulder (George Hartzell) writes: >I just picked up the verbatimfile style from the latex-style archive, >and have to questions about it. First, the verbatimlisting >environment doesn't number blank lines. Second, it doesn't seem to >deal well with tabs. I took a brief stab at getting the macro number >each line (replacing the everypar with every{cr,vbox,hbox}) to no >avail. Before I try something complicated has anyone solved either of >these problems? > >g. > >George Hartzell (303) 492-4535 > MCD Biology, University of Colorado-Boulder, Boulder, CO 80309 >hartzell@Boulder.Colorado.EDU ..!{ncar,nbires}!boulder!hartzell I just found and tried the macros from the epic package from which the verbatimfile macros were derived and found that it does label spaces. I understand where the tabs are going, but would love it someone has a way to get TeX to deal with them. So, I guess that my immediate problem has been solved, but I get the impression that there might be a "cleaner" solution. For reference, here are the macros. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % verbatimfiles.sty % % Here is a version of Adrian's VERBATIM.STY, for inputting whole files % verbatim, which is "more LaTeX-like" in that it uses the actual LaTeX % macros which set up the `verbatim' environment. % % As a matter of interest, it is much nicer for TeX if you input large % quantities of "verbatim material" from an "external file" rather than by use % of the `verbatim' environment (i.e. putting the material in the main input % file. This is because this environment, in common with most (but not all) % other "verbatim macros", makes the whole of the "vebatim material" a macro % argument and therefore eats up TeTeX's internal memory. % % Chris Rowley % % --- V E R B A T I M F I L E S . S T Y % % --- This LaTeX style-file defines two user-callable macros: % --- \verbatimfile{} for verbatim inclusion of a file % --- \verbatimlisting{} for verbatim inclusion with line numbers % % --- The macros are based on those distributed with Sunil Podar's % --- `EPIC.STY' macro package, attributed to Tim Morgan, % --- modified to keep internal macros internal by Adrian F. Clark, % --- alien@uk.ac.essex.ese % --- ---and further latexification by Chris Rowley, % --- ca_rowley@uk.ac.open.acs.vax. % % --- Note that the precise layout of line breaks in this file is important! % \def\verbatimfile#1{\begingroup \@verbatim \frenchspacing \@vobeyspaces \input#1 \endgroup } \newcounter{lineno} \def\verbatimlisting#1{\setcounter{lineno}{0}% \begingroup \@verbatim \frenchspacing \@vobeyspaces \parindent=20pt \everypar{\stepcounter{lineno}\llap{\thelineno\ \ }}\input#1 \endgroup } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % verbatim.sty from epic % %From: Tim Morgan %Subject: verbatim macros %Here are some macros which I mostly stole from the TeXbook source and %other places. You can say % % \verbfile{filename} %to \input all of "filename" in verbatim mode. The end of the file is the %only thing that gets you back out of verbatim -- no characters are special. %\listing is the same except that each line of the file is automatically %numbered. %Tim % % Produce verbatim listings of various sorts \def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials} \def\setupverbatim{% \par \tt \spaceskip=0pt % Make sure we get fixed tt spacing \obeylines\uncatcodespecials\obeyspaces\verbatimdefs } {\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }} \gdef\verbatimgobble#1^^M{}} % % Input a file in verbatim mode. Sometimes useful for including % real-life examples into a paper. \def\verbfile#1{\begingroup\setupverbatim \parskip=0pt plus .05\baselineskip \parindent=0pt \input#1 \endgroup } % This is the same as the above, but it adds line numbers to each % line of the file printed. \newcount\lineno \def\listing#1{\lineno=0\begingroup\setupverbatim \parskip=0pt plus .05\baselineskip \parindent=20pt \everypar{\advance\lineno by 1 \llap{\the\lineno\ \ }}\input#1 \endgroup } George Hartzell (303) 492-4535 MCD Biology, University of Colorado-Boulder, Boulder, CO 80309 hartzell@Boulder.Colorado.EDU ..!{ncar,nbires}!boulder!hartzell