| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\title{Foobar} |
| 4 |
|
| 5 |
\usepackage{countwords} |
| 6 |
\newcounter{words} |
| 7 |
|
| 8 |
\usepackage{totcount} |
| 9 |
\regtotcounter{words} |
| 10 |
|
| 11 |
\begin{document} |
| 12 |
|
| 13 |
\maketitle |
| 14 |
|
| 15 |
There are \total{words} words in this document. |
| 16 |
% (After second LaTeX run) will print: |
| 17 |
% There are 69 words in this document. |
| 18 |
|
| 19 |
% Start counting after title is printed, so it is excluded from total. |
| 20 |
\countwordsstart{words} |
| 21 |
|
| 22 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do |
| 23 |
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad |
| 24 |
minim veniam, quis nostrud exercitation ullamco laboris nisi ut |
| 25 |
aliquip ex ea commodo consequat. Duis aute irure dolor in |
| 26 |
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla |
| 27 |
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in |
| 28 |
culpa qui officia deserunt mollit anim id est laborum. |
| 29 |
|
| 30 |
% Stop counting before wordcount declaration. |
| 31 |
\countwordsstop{words} |
| 32 |
\end{document} |