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.


1 Answer 1


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.

  • Wow, I wouldn't have expected that. Thanks for your concern and for providing a fully working solution.
    – Big-Blue
    Jan 19, 2013 at 19:53
  • Welcome to TeX.sx! Jan 19, 2013 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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