| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\title{Foobar} |
| 4 |
|
| 5 |
\usepackage{countwords} |
| 6 |
\newcounter{words} |
| 7 |
|
| 8 |
\begin{document} |
| 9 |
|
| 10 |
\maketitle |
| 11 |
|
| 12 |
% Start counting after title is printed, so it is excluded from total. |
| 13 |
\countwordsstart{words} |
| 14 |
|
| 15 |
There are seven words in this sentence. |
| 16 |
|
| 17 |
% Stop counting before the maths... |
| 18 |
\countwordsstop{words} |
| 19 |
|
| 20 |
\[ |
| 21 |
e^{i\pi} - 1 = 0 |
| 22 |
\] |
| 23 |
|
| 24 |
% ... and then start again. |
| 25 |
\countwordsstart{words} |
| 26 |
|
| 27 |
And six more in this sentence. |
| 28 |
|
| 29 |
\countwordsstop{words} |
| 30 |
|
| 31 |
There are \arabic{words} words in this document. |
| 32 |
% Will print: |
| 33 |
% There are 13 words in this document. |
| 34 |
|
| 35 |
\end{document} |