I'm working on an assignment and need to use longtable for some data, but it counts towards the overleaf word count. How can I do this with texcount?
TeXcount does not come with a predefined rule for handling
longtable environments, and therefore uses the default handling rules which is to treat the contents as the surrounding text.
However, you can easily add a rule to your document by adding this line
%TC:envir longtable [ignore] ignore
somewhere before the environment is used. What this does is add an environment handling rule for
longtable which specifies that the
longtable environment takes one argument (the column specification) which should be ignored, and that the contents should be ignored.
If the table contains code that confuses TeXcount, you might have to use stronger exclusion rules than
ignore such as
If all else fails, there is also the option of excluding portions of the document by surrounding them with
%TC:ignore ... %TC:endignore
but that should normally not be necessary.
If you wish to see how TeXcount interprets your code, you can test it (or snippets of TeX/LaTeX code) on the web service.