2

I am writing a proposal that requires giving the number of characters (including spaces) of each section. My question is very much related to:

Dynamically count and return number of words in a section

The (excellent) accepted answer there does exactly what I need, but for word count. The code uses texcount, which, unfortunately, can only count characters excluding spaces.

Enzo
  • 163
  • 4
  • The "poor man's solution" to the problem is to run TeXcount twice: first to do the character count (excluding spaces) and then to do the word count, and then add these two together. It won't be totally accurate, and will (at least by default) not count punctuation. – Einar Rødland Jan 20 '15 at 23:09
  • What will the content be? If it's just words and characters (i.e., no math, no \macros), a utility like wc will do the trick. – jon Jan 21 '15 at 01:46
  • Hi Einar, your "poor man's solution" actually sounds cool to me :) The only worry I have is that TeXcount seems to enormously underestimate word count, but it may be a problem with my text? (I use \gls every once in a while and lots of \cite, but nothing else) – Enzo Jan 21 '15 at 10:28
  • Hi jon, I don't use \macros (or at least not explicitly? Does \gls use macros?). Thanks! – Enzo Jan 21 '15 at 10:30
  • @Enzo: Inspecting the verbose, colour coded output should allow you to check what is counted and what is not. You can also get cumulative counts at the end of each line in the verbose output by using the -sum option with the verbose output. A fast and easy way to try this is to use the TeXcount web interface. – Einar Rødland Jan 23 '15 at 11:07

0 Answers0