[texworks] Count Characters Script

Stefan Löffler st.loeffler at gmail.com
Tue Mar 13 20:22:09 CET 2012


Hi,

On 2012-03-13 18:22, heck.johannes at googlemail.com wrote:
> I’ve just been looking for a possibility to count characters in latex
> documents.

I assume we're talking about some form of "relevant" words in the
document (i.e., not the number of characters in an arbitrary text file
which happens to have a .tex extension).

This has been suggested a while ago
(http://code.google.com/p/texworks/issues/detail?id=157). The problem is
that (La)TeX is a very versatile (programming) language [1], so doing
this properly (without essentially forking most of the TeX interpreter
code itself) is most likely impossible. Consider, e.g., the simple case
\newcommand{\a}{Hallo Welt}
\a
How would a script know about this (or more complicated constructs),
except when it properly parses the whole document.

> I’ll need that for my next document, because it’s limited to 144k Chars.

Characters of input, or of output? What about ligatures like "ffi" (1
char?, 3?, something else?)?

> I’ve found “TeXcount” and saw, that there’s also a perl script version
> of it.
> What about integrating that into TeXworks / adapting it to TWScripting?

Sounds good, but I still have the same concerns mentioned above.
It may be just what you personally need, though, and implementing it
should not be too difficult (ranging from simply installing it as a
typesetting tool as can be done for, e.g., latexmk, to writing a script
to call TeXcount on the command line (as has been done for TeXShop
(http://www2.hawaii.edu/~ramonf/TeXShop/index.html))).

Regards,
Stefan


[1] <off-topic>Is TeX Turing-complete?</off-topic>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20120313/389906b1/attachment.html>


More information about the texworks mailing list