Sunday, May 1, 2011

latex line numbers

A great resource is here
http://www-d0.fnal.gov/Run2Physics/WWW/templates/lineno.html

you can do every 5 numbers if you use \modulolinenumbers[5]

the key is:
\usepackage{lineno}
\begin{document}
\linenumbers

*linenumber command  comes after \begin{document}

Another example with more options:


  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)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.