A while ago I switched to XeLatex from Latex as it can do some amazing
things. One particularly cool thing is word counting from within the
document itself. This is great for paper abstracts! I got the code
from
here
(or possibly somewhere else with similar code – it was a while ago!)
and tweaked it a bit to produce my wordcounter environment:
Usage is very simple – just wrap the part of the document that needs
to be word-counted in the wordcounter environment, and a message
will be inserted into the document after the text giving the word
count. For example