11

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.)

15

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

\@LN{251}{5}

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).

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.