Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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 ?

share|improve this question

marked as duplicate by doncherry, Werner, Kurt, mafp, Herbert Apr 12 '13 at 21:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 4 down vote accepted

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).

share|improve this answer
    
Where do I place this command ? –  Razor Apr 12 '13 at 17:46
1  
Run it from the command line. detex is part of TeXlive, at least. –  vonbrand Apr 12 '13 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 '13 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 '13 at 18:29
1  
Thanks it works perfectly :) –  Razor Apr 12 '13 at 18:31

TexCount is a web-based tool that will do a word count for you and also break it down per section etc.

share|improve this answer
1  
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 '13 at 18:47
    
@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 '13 at 19:22
    
Yes, should have mentioned that there is also a downloadable version. –  Ubiquitous Apr 13 '13 at 12:34

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