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.

1 Answer 1


You can tell texcount to treat the content of tabular environments like normal text by including the line %TC:group tabular 1 1 in your preamble. The %TC: tells the parser that a textcount 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

%TC:group table 0 1
%TC:group tabular 1 1
One two & three four five six\\
Seven eight, nine & ten eleven!\\
Twelve. Thirteen.


Words in text: 13

Alternatively, you can edit texcount.pl and change the instruction 'tabular'=>0 in the definition of my %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 instruct texcount.pl to take its options from that file by calling texcount.pl -opt=TCoptions.txt <TeX file>

  • Amazing! I had no idea about these flags for texcount.
    – qubyte
    Commented Dec 10, 2011 at 7:18
  • 9
    If the tabular is inside a table, then words won't be counted; adding %TC:group table 0 1 overrides this default behavior.
    – egreg
    Commented Dec 10, 2011 at 10:11

You must log in to answer this question.

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