Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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
Words in headers: 0
Words outside text (captions, etc.): 0
Number of headers: 0
Number of floats/tables/figures: 0
Number of math inlines: 0
Number of math displayed: 0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.