# Lineno splitting the document into hundreds of pages

I was trying to get all the lines numbered in my document, as explained in this question: Show the number of lines in margin

However, when I added the lines:

\usepackage{lineno}
\linenumbers


to the top of my document, the document got split into hundreds of pages - one line per page. How can I get it to work?

EDIT: The preamble of the document looks like this:

\documentclass[12pt,twoside,pra,aps,amssymb,amsfonts,amsmath,tightenlines]{revtex4}

\usepackage{dsfont}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{natbib}
%\usepackage{url}
\usepackage{lineno}
\linenumbers


EDIT 2: Minimal example:

\documentclass[12pt,twoside,pra,aps,amssymb,amsfonts,amsmath,tightenlines]{revtex4}

\usepackage{dsfont}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{natbib}
%\usepackage{url}
\usepackage{blindtext}
\usepackage{lineno}
\pagewiselinenumbers

\begin{document}
\Blindtext

\end{document}

• Coincidentally my test document also uses RevTeX - and doesn't show the same issue. I think a full MWE would be in order. Sep 24, 2013 at 15:28
• @ChrisH, the example is provided now. Thanks! Sep 24, 2013 at 15:32

Your MWE can be greatly reduced to be

\documentclass{revtex4}
\usepackage{lineno}
\usepackage{blindtext}
\pagewiselinenumbers

\begin{document}
\Blindtext
\end{document}


With such a simple MWE it becomes clear that the problem is an interaction between revtex4 and lineno. Searching the lineno documentation yields:

1. if a class changes \output (APS journal class revtex4, e.g.), lineno.sty should be loaded by \RequirePackage[here presumably following some options in brackets]{lineno} preceding \documentclass.

Leading to a working MWE of

\RequirePackage{lineno}
\documentclass{revtex4}
\usepackage{blindtext}
\pagewiselinenumbers

\begin{document}
\Blindtext
\end{document}