Trying to run TeXcount on Windows 7 with TeX Live results in

Can't locate Win32/Console/ANSI.pm in @INC (@INC contains: C:/texlive/2013/tlpkg/tlperl/lib c:/texlive/2013/tlpkg/tlperl/lib .) at c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl line 11.
BEGIN failed--compilation aborted at c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl line 14
C:/texlive/2013/bin/win32/runscript.tlu:650: command failed with exit code 2:
perl.exe c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl

By searching for ansi.pm on Google, it appears that there are two Perl libraries called ansi.pm: one is for SQL, and the other (the relevant one) is for translating ANSI colour codes for the Windows console. I haven't been able to find the latter file on the internet.

  • 2
    Please report to the TeX Live mailing list (see tug.org)
    – daleif
    Nov 18, 2013 at 8:57
  • 1
    This is more of a Perl issue, and would depend on which Perl installation you're using. Which version of TeXcount do you have? If it's version 3.0, it should have checked if Win32:Console:ANSI was available and catch it if it wasn't, turning of the colour codes; but some slightly older versions just assumed it would be there under Windows. On the other hand, the colour codes are convenient. Nov 18, 2013 at 20:26

1 Answer 1


You can find Win32::Console::ANSI at CPAN. I'm not enough of a Perl expert to tell if that would contain all you need, or if it would depend on which Perl installation you're using.

If it doesn't work, you'll just have to remove the inclusion of the package in TeXcount. In the latest version of TeXcount, the code to include the package is:

# Conditional package inclusion
if ($^O=~/^MSWin/) {
  eval {
    require Win32::Console::ANSI;
  if ($@) {
    print STDERR 'Package Win32::Console::ANSI required for colour coded output.';

This should have captured the error given if the package is not available. However, if for some reason that doesn't happen, you can replace the entire block with the single line for turning of ANSI colours:


Of course, this means there will be no colour coding of the verbose output in the console, which makes it much less useful. Instead, you could then run TeXcount with the -html option to produce HTML code which you could then view in a browser.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .