Article View: comp.text.tex
Article #1677Re: line numbers in LaTeX
From: Vashti Galpin
Date: Sun, 23 Aug 1992 20:38
Date: Sun, 23 Aug 1992 20:38
102 lines
4389 bytes
4389 bytes
This is a summary of reponses I received. Apologies for taking so long
and thanks for the replies.
>As my supervisor and I are going to be discussing my Master's
>thesis by email, I would like to print a copy for him with
>line numbers, for example
> text....
> text....
> text....
> text....
> 5 text....
> text....
> text....
> text....
> text....
>10 text....
> text....
> .
> .
>Is there some way that I can do this (or something similar) in LaTeX?
______________________________________________________________
James Fortune <jafortun@vela.acs.oakland.edu> writes:
I will be attempting just such a macro this month. Comp.text.tex knows
about it since I posted to find out if anyone else had done it.
The version I will be attempting will put the line numbers on the
outside margin. There are also some pointers in Tugboat 1990, 1, 2, and 4
that I will be checking out before I begin. Let me know what you need
and if it is easy to include into what I'm doing then I'll put it in.
JAF
--
James Fortune - There are many sides to every question
Oakland University - until you know the truth. Then there's
jafortun@vela.acs.oakland.edu - only one. -- C. S. Lewis
Disclaimer: Not O.U. opinions -
______________________________________________________________
ecsgrt@luxor.latrobe.edu.au (Geoffrey Tobin) writes:
There is a LaTeX style, for inputting a whole file, and placing line
numbers on each fifth line, but not counting blank lines.
% 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 "verbatim 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[n]{<filename>} for verbatim inclusion
% with line numbers every nth line
%
% --- 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.
% --- optional argument for numbering multiples of [N] by H. Schulzrinne
% hgschulz@cs.umass.edu
%
% --- 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}\newcounter{Lineno}
\def\verbatimlisting{\@ifnextchar[{\@verbatimlisting}{\@verbatimlisting[5]}}
\def\@verbatimlisting[#1]#2{\setcounter{lineno}{0}\setcounter{Lineno}{0}%
\begingroup \@verbatim \frenchspacing \@vobeyspaces \parindent=20pt
\everypar{\stepcounter{lineno}\stepcounter{Lineno}\ifnum\value{Lineno}=#1
\setcounter{Lineno}{0}\llap{\footnotesize\it\thelineno\ \ }\fi}\input#2
\endgroup
}
%
% End verbatimfiles.sty
--
---------------------------------------------------------------
Vashti Galpin vashti@concave.cs.wits.ac.za
Department of Computer Science, University of the Witwatersrand
2050 Wits, South Africa. Tel 27(11)716-3295 Fax 27(11)403-1926
Technical Details
Message-ID:
<vashti.714602330@concave>Path:
arc1-ca.pugleaf.net!sparky!uunet!psgrain!hippo!shannon!concave!vashtiReferences:
<vashti.713719259@concave>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!hippo!shannon!concave!vashti From: vashti@concave.cs.wits.ac.za (Vashti Galpin) Subject: Re: line numbers in LaTeX Message-ID: <vashti.714602330@concave> Keywords: line numbers Sender: news@shannon.ee.wits.ac.za Organization: CS Dept, University of the Witwatersrand References: <vashti.713719259@concave> Date: 23 Aug 92 20:38:50 GMT Lines: 102