I am using texcount
to count the words in my LaTeX document, but I have quite a lot of text in tables and want to count those too.
Is there any way to do this using texcount
? There doesn't seem to be a simple command-line switch, and the documentation for the macros section seems rather confusing.
Best Answer
You can tell
texcount
to treat the content oftabular
environments like normal text by including the line%TC:group tabular 1 1
in your preamble. The%TC:
tells the parser that atextcount
instruction follows,group
indicates that the instruction concerns an environment that starts with\begin{...}
and ends with\end{...}
,tabular
is the name of the environment we're specifying, the first number defines how many arguments are to be ignored (in this case 1, the column specifications), and the second number defines what to do with the content of the environment (1
tells the parser to count the text).Parsing the following document using the perl script or the online interface
returns
Alternatively, you can edit
texcount.pl
and change the instruction'tabular'=>0
in the definition ofmy %TeXgroup
to'tabular'=>1
.If you don't want to edit your TeX file or
texcount.pl
, you can create a new text file called, say,TCoptions.txt
containing the line%group tabular 1 1
(not%TC:group tabular 1 1
) and instructtexcount.pl
to take its options from that file by callingtexcount.pl -opt=TCoptions.txt <TeX file>