[TxMt] Macro/command for LaTeX wordcounts

Colin Hahn colin.hahn at gmail.com
Fri Jan 26 00:57:09 UTC 2007


I'm trying to write a macro or command (not sure which will be  
better) for doing a word count on LaTeX documents.  The basic task is  
simple enough: I want to run the command "ps2ascii [file.pdf] | wc"  
on file.tex (where file.tex is the current file I'm working on) (I've  
tested ps2ascii and it works fine for the types of documents I'll be  
writing).

However, I also want to strip the footnotes from my word count.  To  
do so, I've defined the footnotes with a custom command that I can  
redefine as empty:

\newcommand{\fn}[1]{\footnote{#1}}
% \renewcommand{\fn}[1]{}

So, the whole task I need to do is:
1) Uncomment the \renewcommand line
2) Re-run LaTex
3) Run ps2ascii | wc on the generated .pdf
4) Display the output of that command as a ToolTip
5) Re-comment the \renewcommand line (so the file is back in its  
original state)

Unfortunately, I don't know how to string these things together, nor  
how to get the argument for the ps2ascii command from the current  
filename variable TM_FILENAME (i.e., how to substitute .pdf  
for .tex).  I can add unique comments to the end of the \renewcommand  
line so it can be picked out by a regex search, if that helps.

Suggestions?  I'm also open to other ideas for getting the same end  
result, if there's an easier way.

Colin Hahn
»Geben Sie mir Kaffee, dann mache ich Phänomenologie daraus.«
"Give me my coffee so that I can make phenomenology out of it." --  
Edmund Husserl


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070125/3eb6059d/attachment.html>


More information about the textmate mailing list