Jackey's 感悟

Do Research

Tag Archives: texcount

Add a word count script for TeXWorks

We can add a new script to count the words of one tex file like this

Here is the script “wordcouter.js”

// TeXworksScript
// Title: Count the words in tex file
// Description: counter 
// Author: Jackey Lu
// Version: 0.1
// Date: 2011-09-21
// Script-Type: standalone
// Context: TeXDocument

var cmd = "e:\\local\\texlive\\2010\\bin\\win32\\texcount.exe " + TW.target.fileName;
var result = TW.system(cmd);

Put the script in the TeXworks profile directory “scripts”, in windows 7, it is like this, C:\Users\[your username]\TeXworks\scripts.

PS: you must change the path of  texcount.exe with your real path.

To enable it, You should change the preference.


then you can count the words of your tex file now, use the menu Script –> Count the words in tex file.