I am using TexShop and was wondering if there is an easy way to find the wordcount in a document ?
The way I do it now is copy and paste the PDF document into Word to calculate the word count. Is there a way I can do this directly from the PDF file in MACOS's Preview ? Or through LaTeX directly ?


2 Answers 2


You could try detex document.tex | wc -w

(detex does a decent, but not perfect, job at eliminating LaTeX commands, if you use such to write part of the text, the count will be off. And I don't remember offhand how it handles accents, i.e. l'H\^opital might give too many words).

  • Where do I place this command ?
    – Razor
    Apr 12, 2013 at 17:46
  • 1
    Run it from the command line. detex is part of TeXlive, at least.
    – vonbrand
    Apr 12, 2013 at 17:51
  • I don't mean to be bothersome, but can you please provide more info ? Where is the command line ? How do I run it ?
    – Razor
    Apr 12, 2013 at 18:22
  • I don't know Mac that well, but it is a Unixy system. There should be some way to get a terminal where you can enter commands, in that you can cd to where your document lives. Sorry I can't help more.
    – vonbrand
    Apr 12, 2013 at 18:29
  • Oh okay I got you. Mac uses Terminal. So I cd into the folder and run this ? Will try it now.
    – Razor
    Apr 12, 2013 at 18:30

TexCount will do a word count for you and also break it down per section etc.
Available both as a web-app as well as a download, and comes packaged with TeX Live. Can be invoked in the command line with texcount mytexfile.tex.

  • 2
    I've seen that thank you, but I was afraid my code will be stored somewhere and might be marked as plagiarism when I submit my report.
    – Razor
    Apr 12, 2013 at 18:47
  • 3
    @NLed -- texcount comes with TeX Live, and can be invoked from the commandline (assuming Bash, or equivalent) as follows: texcount mytexfile.tex. It is much better than detex + wc.
    – jon
    Apr 12, 2013 at 19:22
  • Yes, should have mentioned that there is also a downloadable version.
    – Ubiquitous
    Apr 13, 2013 at 12:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.