1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
% $Id: verbatimfiles.sty,v 1.2 1996/12/23 01:32:18 JCL Exp $
% verbatimfiles.sty by Rowley/Clark
% Provides commands:
% \verbatiminput{<file>}
% The contents of <file> resp. <file>.tex is displayed verbatim.
% \verbatimlisting{<file>}
% The contents is displayed verbatim together with leading line
% numbering.
%
% Change Log:
% See Log at end of file.
%
% --- start 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{<filename>} for verbatim inclusion of a file
% --- \verbatimlisting{<filename>} 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!
%
\makeatletter %JCL
\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
}
\makeatother %JCL
% --- end verbatimfiles.sty
\endinput
% $Log: verbatimfiles.sty,v $
% Revision 1.2 1996/12/23 01:32:18 JCL
% o added some informative comments and log history
% o uses now \makeatletter, \makeatother (hope that's ok)
%
|