# TeXcount counting \multicolumn

When using TeXcount on the following MWE \multicolumn macro is counted as a word and I get:

Words in text: 6

What can I do to avoid this behavior and get the correct word count?

\documentclass{article}

%TC:group table 0 1
%TC:group tabular 1 1

%TC:macro \specialcell [0,text]

\newcommand{\specialcell}[3][c]{%
\begin{tabular}[#1]{@{}#2@{}}#3\end{tabular}}

\begin{document}

\begin{table}
\begin{tabular}{lr}
\multicolumn{2}{c}{word1 word2} \\
word3 & \specialcell[t]{l}{word4\\word5} \\
\end{tabular}
\end{table}

\end{document}

-

Ouch! This was a nasty bug!

Problem is that \mu gets interpreted as the greek letter, and so \multicount gets parsed as a the word {\mu}lticount.

The error is in the line

my $specialchars='\\\\('.join('|',@LetterMacros).')(\{\}|\s*|\b)';  which should have read my$specialchars='\\\\('.join('|',@LetterMacros).')(\{\}|\s+|\b)';


with \s* replaced by \s+ to ensure there's something to separate the \mu from the rest of the word (in the case where it is actually the greek letter).

If you correct this code line in the script, it should work without any need for the work-around.

-
Thank you very much! That solves the prolem. Hope the online script would be updated as well. –  Nikos Papandreou Apr 8 at 21:23
@NikosPapandreou: The script is now updated online at app.uio.no/ifi/texcount for both the web-service and the downloadable Perl script. –  Einar Rødland Apr 11 at 13:52

I am not familiar with texcount. At least I found a workaround:

%TC:macro \tcmulticolumn [ignore,ignore,text]
%TC:subst \multicolumn \tcmulticolumn


Or a little shorter (the number means the number of ignored arguments):

%TC:macro \tcmulticolumn 2
%TC:subst \multicolumn \tcmulticolumn


I do not know, why the direct approach %TC:macro \multicolumn [ignore,ignore,text] is not working.

Full example file:

\documentclass{article}

%TC:group table 0 1
%TC:group tabular 1 1

%TC:macro \specialcell [0,text]

\newcommand{\specialcell}[3][c]{%
\begin{tabular}[#1]{@{}#2@{}}#3\end{tabular}}

%TC:macro \tcmulticolumn 2
%TC:subst \multicolumn \tcmulticolumn

\begin{document}

\begin{table}
\begin{tabular}{lr}
\multicolumn{2}{c}{word1 word2} \\
word3 & \specialcell[t]{l}{word4\\word5} \\
\end{tabular}
\end{table}

\end{document}


Result:

File: test.tex
Encoding: ascii
Words in text: 5