Adding line
numbers to a LaTeX document
- download the lineno package (http://www.ctan.org/get/macros/latex/contrib/lineno.zip)
- unpack it ('unzip lineno.zip')
and from the subdirectory lineno/
copy all files *.sty
into the
directory with your LaTeX main document
- in the LaTeX preamble include the line
\RequirePackage{lineno}
before the \documentclass{...}
command.
(Note: this rather unusual way of including a package is necessary due
to incompatibilities between the lineno package and revtex. If you are
not using revtex to prepare your document you can also use the standard
way: \usepackage{lineno})
- line numbers can be activated by adding the line
\linenumbers
after \begin{document}
The package has
several options, for instance printing only every 5th line number, or
starting to count at 1 for each page, etc. A users guide is available
at http://www.ctan.org/tex-archive/macros/latex/contrib/lineno/ulineno.pdf
Example for D0 PRL template with line numbers printed every 5 lines and
starting at 1 for each page:
\RequirePackage{lineno}
\documentclass[aps,prl,twocolumn,showpacs,groupedaddress]{revtex4}
% for review and submission
\usepackage{graphicx} %
needed for figures
\usepackage{dcolumn}
% needed for some tables
\usepackage{bm}
% for math
\usepackage{amssymb}
% for math
\begin{document}
\setpagewiselinenumbers
\modulolinenumbers[5]
\linenumbers
....
Notes:
- In case
that the table of content becomes garbled, add the \linenumbers
command after the \tableofcontent
command.
- To
increase the font size of the line numbers add
\def\linenumberfont{\normalfont\small\sffamily}
(in two
column layouts this might have the unwanted effect of
line numbers of the right column overlapping with the text in the left
column)
If you have questions about the usage of the lineno
package contact
cammin_at_fnal.gov.
Last update:
06/30/2008 14:00