TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Despite the easy-sounding task, it appears to be hard to find a suitable package to print line numbers that ignore the automatically generated section/subsection etc. headlines in their counter.

The currently preferred, non-deprecated choice of line-numbering package seems to be lineno, which sadly doesn't have the desired option. My current way of implementing it is calling it using

\usepackage[pagewise, modulo]{lineno}

before the beginning of the document and then calling


after the table of contents so it doesn't interfere with these.

However, using

text longer than 5 lines

results in lineno printing the number 5 next to text line number 4, because it also counts the section heading as a line. Please note that I'd like to refrain from using the linenumbers-environment to manually number every paragraph since my document is quite long.

share|improve this question
Welcome to TeX.sx! – Rico Jan 19 '13 at 15:40
up vote 3 down vote accepted

I am the maintainer of lineno – thanks for the idea. What about using \Section rather than \section after


Later, one might "patch" \section accordingly, maybe even dealing with the optional argument.

share|improve this answer
Wow, I wouldn't have expected that. Thanks for your concern and for providing a fully working solution. – Big-Blue Jan 19 '13 at 19:53
Welcome to TeX.sx! – barbara beeton Jan 19 '13 at 21:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.