Im having a problem with the wordcounter in overleaf v2 not counting the words in the subfiles, but only in the main tex, is it somehow possible to make the word count include subfiles?


1 Answer 1


I'm not familiar with Overleaf, but as I understand it uses TeXcount to do the word count.

TeXcount has multiple options, including options for including subfiles: eg the -merge option. However, this must be provided to the TeXcount command line, which Overleaf apparently does not.

The Overleaf page on word counts has a section on How to run texcount with custom parameters, but the solution this provides is to use \write18 to execute TeXcount from within LaTeX, and then include the resulting output into the document. This is a pure TeX/LaTeX solution which executes TeXcount when you typeset the document, not from the word count menu.

Given that this is Overleaf's suggestion, I assume they don't have a solution that modifies the behaviour of the word count menu item. Perhaps it could be suggested to them to add it.

An alternative would have been if TeXcount was able to turn on subfile inclusion from within the TeX code, but it doesn't.

Related question: Total word count using texcount

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .