Is it ok that LaTeX doesn't have a wordcounter?

texcount is a very valuable external esource to determine how many words you have in your document, but it relies on console and executing a separate command. But instead of using a console to figure this out it could be a good option to a have a visual input on how long a document's pdf gets while running one compilation after another.

  • One possible way to have wordcount done in a visual manner would to have the number of words signaled and printed to the resulting pdf on a certain amount of periods. One could have this wordcount set for each paragraph, page, chapter, and/or full text. How could this be done?

How do get wordcount on our working file pdf?

Options could be the total number in the 1st page, or as draft options, or as a separate page. The possibilities are endless. This SE site is full of places where it's stated that LaTeX can do anything. A comment ot this question explains quite well that tex is not optimal for word count so an external source is a good thing. But maybe there's some way to connect the external tool to tex?

if using luatex it might be more reasonable as you could count in lua without disturbing the tex macros so much

I'd prefer LaTeX but if luatex is a chance ... how would it work?

The other chance would have the result printed to the beginning of the preamble of the document in the master document where our main.tex file is. This has been suggested before and is not the main question here:

  • 1
    getting such information from tex is massively intrusive and almost certain to clash with other macros in the document, it is far better to get it from an external tool, either one that reads the source or one that reads the generated pdf. (even then the results are more or less meaningless, especially for documents with any amount of mathematics) (if using luatex it might be more reasonable as you could count in lua without disturbing the tex macros so much) Jan 10, 2017 at 12:21
  • @DavidCarlisle your answer is quite instructive and completely reasonable. However, since I believe it could be a major upgrade to get this going: how would you go for info in text of a pdf or luatex? Also, is there any way I could improve further the question?
    – nilon
    Jan 11, 2017 at 20:47


Browse other questions tagged or ask your own question.