Latex wordcounting

I wanted a quick way to get the word count for my latex document – so I now have 2 lovely hacky scripts.
My latex file is called document.tex, so ‘document’ should be changed to the name of your file.

In your Latex file you need to include ‘\input{hack}’ at the top of your document and ‘\input{wordcount}’ wherever you want to include your wordcount.

The following script removes the bibliography and citations and then counts the words outputting to a file:
makeme:

echo > wordcount
echo "\renewcommand{\cite}[1] {}
\renewcommand{\maketitle}[1] {}
\renewcommand{\bibliography}[1] {}" > hack
pdflatex document
ps2ascii document.pdf | wc -w > wordcount

makemepropper:

echo > wordcount
./makeme
echo "" > hack
bibtex document
pdflatex document
bibtex document
pdflatex document
bibtex document
pdflatex document

Eclipse & Subversion

Somehow I managed to overwrite my 54th revision of a project with a far less developed version. I wasn’t able to find any way to recover the file from subversion as it’s copy had been replaced (if there is a way to see ‘every’ change made to SVN I’d like to know!). So I attempted to revert my file in Eclipse using a local revision however it was stubbornly telling me there was no history for the specified file. In the end I managed to find my document 🙂 using Eclipse’s history. On linux the history tends to be in ‘~/workspace/.metadata/.plugins/org.eclipse.core.resources/.history’, this directory contains many folders, with files which have hashes for their name.

To find the files with the particular contents I wanted I ran this:
This gave me a list of files along with their dates of modification, so I could choose the relevant ones.

for x in `grep -Rl “SEARCH_FOR” *`; do echo `ls -l $x`; done