\documentclass{article} \title{Foobar} \usepackage{countwords} \newcounter{words} \begin{document} \maketitle % Start counting after title is printed, so it is excluded from total. \countwordsstart{words} There are seven words in this sentence. % Stop counting before the maths... \countwordsstop{words} \[ e^{i\pi} - 1 = 0 \] % ... and then start again. \countwordsstart{words} And six more in this sentence. \countwordsstop{words} There are \arabic{words} words in this document. % Will print: % There are 13 words in this document. \end{document}