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

I'm using the lineno package to print line numbers (each page starts with number one) in the draft of my document:

\usepackage[switch*, pagewise]{lineno}

Is there a way to read out the number of lines in the whole document (or even per chapter) from one of the aux files?

I do only want to count the "real" text lines, not the headers and footers, so a sum of all the linenumbers would be quite useful. (Even if also floats are counted as one line each.)

share|improve this question
up vote 14 down vote accepted

The last annotation in the .aux file made by lineno is of the form


where 251 is the global number of counted lines and 5 is the last page number. Of course this will depend on the document.

If you say

\AtEndDocument{\typeout{Total number of lines: \thelinenumber}}

in your preamble, you'll see a message such as

Total number of lines: 251

in the log file (and on the terminal window).

share|improve this answer

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.