Generaltexcount | Saving the Output

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mes38
Posts: 5
Joined: Wed Jun 22, 2011 7:00 pm

texcount | Saving the Output

Post by mes38 »

I've downloaded the texcount script to generate word counts and have got it to work for me to a point by creating a build profile which has the following parameters:

Code: Select all

Program: C:/Perl/bin/perl5.10.1.exe
Arguments: C:\Program Files\MiKTeX 2.8\texcount\texcount.pl
-v
-html
-inc
$fullname
The manual suggests then having two further arguments:

Code: Select all

>
outputfile.html
However, when I run the profile with these two options, it says it can't find the file > and then the same message with the output file.

Other pages talk about the ">" being a redirection command - does anyone know how to implement that command into TexWorks?

When I run the build profile without the two arguments > and outputfile.html, then I get the output I want being displayed in the console output. I can then manually copy the output and create a new html file, paste in the console contents and then view it. That seems a bit of a faff, so I'm keen to generate the file directly.

Any help really appreciated.
Last edited by mes38 on Tue Aug 02, 2011 4:29 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mes38
Posts: 5
Joined: Wed Jun 22, 2011 7:00 pm

texcount | Saving the Output

Post by mes38 »

I've found that if I set a profile to run the program as cmd.exe then when I run it, the console output allows me to manually type the commands:

Code: Select all

c:\users\texcount.pl -v -html c:\users\alt.tex > c:\users\counter3.html
This creates the file that I'm after, but again for obvious reasons not particularly helpful since I still have to manually type everything.

Any suggestions
Einar Andreas
Posts: 2
Joined: Mon Aug 01, 2011 8:14 pm

texcount | Saving the Output

Post by Einar Andreas »

The point of the > file.html is to redirect the output from TeXcount to a file which you can then open in a browser. However, this redirect is normally handled by the shell, not by TeXcount, so the > file.html part does not go as arguments to TeXcount and TeXcount does not know what > means.

I'm not sure if TeXworks has a feature for redirecting the output from a command to file: if it does, that would solve your problem.

An alternative might be to run TeXcount through the command shell CMD using the /C argument:

Code: Select all

cmd /C "texcount.pl -v -html -inc $fullname > output.html"
Don't know if this kind of thing would work.

Another alternative could be to run this through a batch script, e.g. a file named texcount.bat containing

Code: Select all

texcount.pl -v -html -inc $1 > output.html
as explained on the TeXcount FAQ...except the lines starting with # which should either be removed or start with rem...or this example script.

The last option I started thinking of would be to add a feature to TeXcount to write output directly to file...that might be useful in a few contexts I suppose, but would require some modification to the script.

Einar
mes38
Posts: 5
Joined: Wed Jun 22, 2011 7:00 pm

Re: texcount | Saving the Output

Post by mes38 »

Hi Einar,

thanks so much for the help - I was struggling with why the " > ouput" didn't work, but now it makes sense and running through the batch script works now.

Thanks,

Mark
Post Reply