2

I am using TexCount to do word counts on my document. I am using a \cmt command to write inline comments so anything in \cmt{} does not get printed.

I am using the texcount command %TC: macro \cmd [1] to try and ignore these comments

%TC: macro \cmd [1]

\documentclass[]{article}
\immediate\write18{texcount.pl -total \jobname.tex -out=\jobname.sum}

\newcommand{\cmt}[1]{}

\usepackage{verbatim}
\newcommand\wordcount{\verbatiminput{\jobname.sum}}

\begin{document}


One
\wordcount
\cmt{Two Three Four Five}

\end{document}

I should be getting Words in Text: 1 but it's coming out as 5.

0
3

The syntax is %TC:macro \cmt [state1] if there is only one argument.

The state1 can have a specific value, if the argument should be ignored, use %TC:macro \cmt [ignore]

\documentclass[]{article}

%TC:macro \cmt [ignore]

\immediate\write18{texcount -total \jobname.tex -out=\jobname.sum}


\usepackage{verbatim}
\newcommand\wordcount{\verbatiminput{\jobname.sum}}

\newcommand{\cmt}[1]{}

\begin{document}


One
\wordcount
\cmt{Two Three Four Five}

\end{document}

enter image description here

1
  • Perfect. That's solved it. Tnks – Munki Fisht Nov 4 '15 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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