Using Word Count

Overleaf's Word Count feature helps you track the size of your project

You can obtain a word count which automatically excludes the LaTeX commands by selecting File and then Word Count as demonstrated below:

The Word Count option in the File menu

This will run the TeXcount utility to count the words in the project's main file and any files imported into your project's main file via \include and \input. Note that your project's main document must be on the project's top level (i.e. not within a folder) for TeXcount to work in Overleaf.

Include references in the word count

By default, references, headers, captions, floats, displayed math, etc. are not included in the count. To include the citations and references:

  1. Add %TC:incbib in your .tex file's preamble, and then

  2. Add a file named latexmkrc (no file extension) in your project, with the following line in it:

See Run TeXcount with custom parameters for showing word counts for headers, captions, floats, displayed math, etc.

Ignoring some sections

At times, you may want to exclude certain sections or regions from the word count. You can place %TC:ignore and %TC:endignore around such regions. For example:

Run TeXcount with custom parameters

If you'd like to use your own set of TeXcount parameters to customize the output, or to perform a character count, or to include captions etc, you can do so by defining a few commands in your project (though this involves using LaTeX commands). For example:

Note that due to how the Overleaf build process is configured, you must include "output.bbl" in the TeXcount command for BibTeX-produced reference lists to be counted as well.

Assuming your file is named main.tex, invoking these commands in your project would then have the following output in the PDF. The output includes breakdown for each (sub)section, as well as for captions, floats, displayed equations, etc.

See the TeXcount documentation for what each runtime flag does. You can see these examples in action here.

"Words in headers" and "headers" in the section-by-section breakdown is for \section, \subsection, etc. but excluding the numbers 1, 1.1, etc. "Word outside text" and "captions" in the section-by-section breakdown is for \caption but excluding the prefix "Table 1", etc.

By default, inline citations aren't counted. If you want to count them, add these lines to your preamble:

Note that each \citep{ddd} counts only as one word in TeXcount; otherwise, you can artificially bump up word counts tremendously by citing references with multiple authors.

So \cite{faye1996}, although rendered as "(Fay, 1996)", is counted as one word by TeXcount but two words by other word processors.

To include words in tabulars and tables in the "words in main text" count, you can add these TeXcount instructions as well:

Using the \import command with TeXcount

By default, TeXcount recognises common commands like \input and \include for counting included subfiles. However, the command \import from the import package is not supported by default.

Therefore if you are using \import in your document, you may wish to use the more common \input and \include commands instead, and TeXcount will work without any further changes.

If you do prefer to continue using \import, you can add a TeXcount instruction in the preamble so that \import{foo}{bar} looks like \include{foo/bar} to TeXcount, so that it'll count the words in the subfiles:

Last updated

Was this helpful?