[texhax] Question about numbering piece of code
Fehd, Ronald J. (CDC/CCHIS/NCPHI)
rjf2 at cdc.gov
Wed Jan 24 23:19:14 CET 2007
> Date: Thu, 11 Jan 2007 11:19:15 -0400
> From: "Dayang Wang" <061315w at acadiau.ca>
> Subject: [texhax] Question about numbering piece of code
> I want to insert a hundred lines of code to my Latex file,
> and add number list before each line of code as
> 001 *****************
> 002 *******************
> 003 ************
I regularly use the fancy-verb package
-- which is part of the TeXLive installation --
to include program code in my .pdf
%preamble:
\usepackage{fancyvrb}%VerbatimInput
\fvset{fontsize=\small%
,frame=single%
,numbers=left}%set FancyVerb defaults
\begin{document}
\VerbatimInput[label=program part 1
,frame=single,numbers=left
,firstline=1,lastline=50]
{program.txt}%filename.ext
\VerbatimInput[label=program part 2
,frame=single,numbers=left
,firstline=51,lastline=100]
{program.txt}%filename.ext
to get even fancier I put the above in a minipage:
\newcommand{\EchoTextWidth}{0.94\textwidth}%
\begin{minipage}[t]{\EchoTextWidth}%line numbers are inside margin
\VerbatimInput[label=program part 3
,firstline=101]
{program.txt}%filename.ext
\end{minipage}%
see:
The TeX Catalogue OnLine, Entry for fancyvrb,
www.ctan.org/tex-archive/help/Catalogue/entries/fancyvrb.html
Ron Fehd the {SAS} macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
More information about the texhax
mailing list