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.

I want to perform a word count on my LyX document. The problem is that I include several files within my main document

  • main.lyx
    • include file1.lyx
    • include file2.lyx
      • include file21.lyx
    • include file3.lyx

I have not figured out how to do a proper PDF wordcount, since the results vary depending on how I export the PDF, but I know I could do a Tools -> Statistics... -> count words and add them up for each file, but I have something like 20 documents, hence this will be unnecessary time consuming work.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Export to text and use wc.

For example, if you are in the Italian manuals directory, you get the following output:

$ lyx -e text *.lyx && wc -w *.txt
starting local cmake binary
 18958 Customization.txt
  4115 Intro.txt
 11047 Tutorial.txt
 34402 UserGuide.txt
 68522 total

If you want just the total:

$ lyx -e text *.lyx && wc -w *.txt | awk '{ print $1 }' | tail -n 1
68522
share|improve this answer
    
Thank you. Would you also know how to do this in Windows? I forgot to mention that is the OS I am working in. –  Wilhelmsen May 29 '13 at 9:22
    
Cygwin or Python should work. The same idea holds. Export to text and use any kind of word count program. –  scottkosty May 29 '13 at 9:34
1  
@Wilhelmsen Note that in general it is difficult to get an accurate word count. Using this method, a empty 5x5 table where all line are drawn will be count as 37 words!! More ideas on how to count (after exporting .lyx to .tex) can be found here. –  e-birk May 30 '13 at 15:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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