Question

I use the perl script texcount in terminal to count the number of words in my tex files. However, the dissertation I'm writing is quite long and I've broken it up so that each section has its own tex file, with an overall file (Thesis.tex) that combines each section when I want to print the document. Running texcount on the Thesis.tex does not give me the combined word count of each file but only of the Thesis.tex.

I would like to write a small script that will call texcount on each section and sum up the word counts so that I get an overall word count.

I have 5 sections not including Thesis.tex:

-Thesis.tex (which combines them all),
-Introduction.tex 
-Literature.tex 
-Model.tex
-Results.tex
-Conclusion.Tex

The output from texcount command looks like this:

JoeDanger:Dissertation joedanger$ texcount Thesis.tex
File: Thesis.tex
Encoding: ascii
Words in text: 34
Words in headers: 13
Words in float captions: 0
Number of headers: 1
Number of floats: 0
Number of math inlines: 0
Number of math displayed: 0

It is the Words in text: output that I would like to sum.

Was it helpful?

Solution

Note that if you run texcount Thesis.tex Introduction.tex Literature.tex Model.tex Results.tex Conclusion.Tex, you will get a TOTAL count at the end.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top