Including line numbers in typeset output

For general numbering of lines, there are two packages for use with LaTeX, lineno (which permits labels attached to individual lines of typeset output) and numline. (Numline is considered obsolete, but remains available from the archive.)

Both of these packages play fast and loose with the LaTeX output routine, which can cause problems: the user should beware…

If the requirement is for numbering verbatim text, moreverb, or fancyvrb (see including files verbatim) may be used. Class memoir also provides the necessary facilities.

One common use of line numbers is in critical editions of texts, and for this the edmac package offers comprehensive support; ledmac is a LaTeX port of edmac.

The vruler package sidesteps many of the problems associated with line-numbering, by offering (as its name suggests) a rule that numbers positions on the page. The effect is good, applied to even-looking text, but is poor in texts that involve breaks such as interpolated mathematics or figures. Documentation of the package, in the package itself, is pretty tough going, though there is an example (also inside the package file).

edmac
macros/plain/contrib/edmac (or browse the directory); catalogue entry
fancyvrb.sty
macros/latex/contrib/fancyvrb (or browse the directory); catalogue entry
ledmac.sty
macros/latex/contrib/ledmac (or browse the directory); catalogue entry
lineno.sty
macros/latex/contrib/lineno (or browse the directory); catalogue entry
memoir.cls
macros/latex/contrib/memoir (or browse the directory); catalogue entry
moreverb.sty
macros/latex/contrib/moreverb (or browse the directory); catalogue entry
numline.sty
obsolete/macros/latex/contrib/numline/numline.sty; catalogue entry
vruler.sty
macros/latex/contrib/vruler (or browse the directory); catalogue entry

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=linenos