## LaTeX forum ⇒ Document Classes ⇒ lineno package

Information and discussion about specific document classes and how to create your own document classes.
rotis
Posts: 3
Joined: Sat Mar 24, 2007 2:19 pm

### lineno package

Hi. I'm a true beginner in Latex, and I have a problem:

I'm trying to use the lineno-package to numerate the lines in my manuscript.
It does not work properly: The first 70 lines got a number, but after that it seems to me to be only random lines that get number. This problem only occurs in a part with a lot of equations.

Any hint how to solve the problem (Iâ€™m using WinEdt, and writing in an elsart-environment)??

Ledurt
Posts: 12
Joined: Tue Mar 27, 2007 7:05 pm
Try to add the "displaymath" option to the lineno package.

rotis
Posts: 3
Joined: Sat Mar 24, 2007 2:19 pm
no, that did not help. Actually, it made things worse. A lot of the text with formulas was removed in the tranformation to PDF.

Ledurt
Posts: 12
Joined: Tue Mar 27, 2007 7:05 pm

pvthuan
Posts: 1
Joined: Wed Dec 05, 2007 5:30 pm
I have the same problem. I have tried several options of the package but the number is not continuous. The line with equation is not counted.

What should I do?

rotis
Posts: 3
Joined: Sat Mar 24, 2007 2:19 pm
I might have solved the problem. I use the \begin{linenomath} and \end{linenomath} before and after the equation commando. it did the work for me.
rotis

lubejob
Posts: 2
Joined: Thu Jul 31, 2008 2:56 am
I'm trying to add line numbers to a document and have tried the previous suggestions. When I use \linenumbers prior to \begin{document}, it will print line numbers but randomly skip lines and paragraphs. At least I think it is random.

I have tried \begin{linenumbers} ... \end{linenumbers} within the document, but then I get the error, "missing \begin{document} ". At this point, even "undoing", i.e. ^Z to get my original document back will erase this error. Any other suggestions? Thanks for any help.

Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm
rotis wrote:This problem only occurs in a part with a lot of equations.
Maybe this will help... (though it might be a solution to a different lineno problem) Take a look at the fix at:

To make a long story short(er), lineno is not very compatible with popular amsmath environments. So you need to patch them all to get them to automatically play nice with lineno. I tried to make this simple with the following (insert in your preamble):
If there are other environments that you use that also need patching, add a
\patchAmsMathEnvironmentForLineno{environment_name}
before that closing brace. If you want to hit both environment_name and environment_name*, use
\patchBothAmsMathEnvironmentsForLineno{environment_name}

It's not perfect, but IIRC, it's a big improvement.
-- Ted [home/blog]

lubejob
Posts: 2
Joined: Thu Jul 31, 2008 2:56 am
Thanks! That did the trick - though I had to rename my file - otherwise I kept getting a "missing \begin{document}" error.

Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm
lubejob wrote:Thanks! That did the trick - though I had to rename my file - otherwise I kept getting a "missing \begin{document}" error.
I don't quite understand the file renaming thing.

You may notice that some math environments receive two numbers. I haven't figured out a good way to solve that problem. In fact, I'm not quite sure it's possible while using lineno. It's a tradeoff. At least the line numbers in the rest of the text are still there.
-- Ted [home/blog]