Is they a way of obtaining a word count in LyX that does not include text inside captions (Figures, tables etc.)?


One way is to remove the insets for which you don't want the words to be counted. First backup your document. Then, to remove all of the caption insets try the following on the mini-buffer (alt+x):

command-sequence inset-forall Caption char-delete-forward; statistics; undo

What this does is the following

  1. Remove all Caption insets
  2. Word count
  3. Undo "Remove all Caption insets"
  • is there a way of extending the command above to exclude notes and appendices as well? – joshlk May 6 '13 at 15:18
  • @Josh For notes, yes. You can see an example of inset-forall for notes in Help > LFUNs and searching for LFUN_INSET_FORALL. So you would just add that new command as another element in the ';'-delimited command-sequence and then probably you need another 'undo' at the end. For appendices I don't think this would work. You could use an LFUN to find (see e.g. LFUN_WORD_FIND) a certain phrase and and then use LFUNS to delete until the end. It's all about looking for the right LFUNs. Note that if you have View > Messages, when you do something in the GUI it will often list the corresponding LFUNs. – scottkosty May 6 '13 at 15:41

The simplest but most tiresome way (and as far as I know only way in LyX) would be to select step by step parts of the LyX document skipping the parts you do not want to count and use "Tools > Statistics" to note a word count. Finally, all word counts need to be added.

Alternatively, one can export the LyX document to a LaTeX file and apply all sorts of TeX related methods as shown in: Is there any way to do a correct word count of a LaTeX document? Especially, TeXcount offers ways to exclude captions and certain environments.

  • @Josh This way could be set up automatically by using a custom converter (see Help > Customization) or maybe plyx, which is a third-party tool to run quick python scripts (I've never tried it out though). – scottkosty Apr 25 '13 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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