Document Classeslineno: no line numbers but one line per page

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
robert
Posts: 3
Joined: Tue Oct 28, 2008 12:01 pm

lineno: no line numbers but one line per page

Post by robert »

Hi,

I am trying to add linenumbers to a document using lineno. When using the \linenumbers command, it does not add any line numbers but shows one line per page. So that my document has as many pages as lines.
I have already added the solutions suggested elsewhere in this forum, for solving problems with amsmath.

Thanks for suggestions,

Robert

Here is my preamble:

\documentclass[preprint,aps,prb,endfloats*]{revtex4}

\usepackage{dcolumn}
\usepackage{amsmath,revsymb}
\usepackage{graphics}
%\usepackage{ednotes}

\usepackage[displaymath]{lineno}
%\usepackage{numline}
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
\patchAmsMathEnvironmentForLineno{array}%
\patchAmsMathEnvironmentForLineno{split}%
}
\linenumbers
\begin{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

lineno: no line numbers but one line per page

Post by pandammonium »

On the one occasion I used the lineno package, I used it as an environment, thus:

Code: Select all

\begin{document}
...
\begin{linenumbers}
numbered lines of text blah-de blah blah
\end{linenumbers}
...
\end{document}
Does that help?
robert
Posts: 3
Joined: Tue Oct 28, 2008 12:01 pm

Re: lineno: no line numbers but one line per page

Post by robert »

Unfortunately not, I tried both variants, using the environment for parts of the document and for the whole.
The result is always the same.
Thanks,

Robert
pandammonium
Posts: 55
Joined: Thu Oct 30, 2008 4:12 pm

lineno: no line numbers but one line per page

Post by pandammonium »

Have you had any success with this yet? Have you tried reordering the packages to see if that makes a difference? Have you tried paring down what packages you have to make a minimum working (but buggy!) example?
robert
Posts: 3
Joined: Tue Oct 28, 2008 12:01 pm

Re: lineno: no line numbers but one line per page

Post by robert »

I haven't had any success. I gave up after reading that the revtex package I need is generally not working with lineno, and that this problem is currently unsolved.

Good luck,

Robert
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

lineno: no line numbers but one line per page

Post by kaiserkarl13 »

From the APS web site:
Why does the \linenumbers command cause page breaks at each line?

REVTeX 4 is incompatible with lineno.sty. We are working on fixing this for the next release. Meanwhile, please refer to CTAN's User's Guide. Section 4, "Numbering modes," gives details on running line numbers and pagewise line numbers.
Section 4 of ulineno.pdf ("Numbering modes") essentially tells you that the way lineno.sty tricks TeX into giving it the ability to number the lines is by pretending that the page actually ends after every line. In RevTeX4, they've obviously done something that forces lineno.sty's pretend world to become reality....
itsme
Posts: 1
Joined: Wed Sep 15, 2010 3:14 pm

Re: lineno: no line numbers but one line per page

Post by itsme »

I had the same problem. But with adding the line

\RequirePackage{lineno}

at the beginning of the document it also works for me with revtex4.
I hope it'll also works for you
Post Reply