6

I need to do a wordcount of my thesis that excludes tables, but not their legends. I need to remove all of my tables, ideally with a command in the preamble. I am currently using Foxit reader's wordcount tool.

MWE:

\documentclass{article}
\usepackage{multirow}

\begin{document}

        \begin{table}[h!]
            \centering
            \begin{tabular}{l l l l}
                \hline
                Foo & Bar \\ bar bar bar & Sum & Foo \\ \hline
                Foo & Bar & Sum & Foo \\
                Foo & Bar & Sum & Foo \\
                Foo & Bar & Sum & Foo  \\ \hline
            \end{tabular}
            \caption[Contexts]{Le Table}
            \label{table:tisch}
        \end{table} 

The table is Table \ref{table:tisch}.
        
\end{document} 
3
  • 6
    Just an idea: How about using the comment package and redefining the tabular environment to act as a comment environment? Commented Aug 22, 2016 at 13:47
  • Yes that works. If you would like to submit this as answer I will accept it, otherwise I will answer my own question incorporating your suggestion. Commented Aug 22, 2016 at 15:34
  • Thanks for asking! But please add an answer yourself, I would have to create an example first and you seem to already have the code. Commented Aug 22, 2016 at 15:39

2 Answers 2

6

As suggested in the comments tabular environments are now ignored through redefinition of this command with the comment package. This is based on this answer.

\documentclass{article}
\usepackage{multirow}
\usepackage{comment}
\excludecomment{tabular}
\let\endtabular\relax

\begin{document}
\begin{table}[h!]
    \centering
    \begin{tabular}{l l l l}
      \hline
      Foo & Bar \\ bar bar bar & Sum & Foo \\ \hline
      Foo & Bar & Sum & Foo \\
      Foo & Bar & Sum & Foo \\
      Foo & Bar & Sum & Foo  \\ \hline
    \end{tabular}
    \caption[Contexts]{Le Table}
    \label{table:tisch}
\end{table}
The table is Table \ref{table:tisch}.
\end{document}
4

One solution is to use TeXcount, which should most likely come along with your TeX installation, which defaults to ignoring tables but counting their captions. By default, headlines, regular text, and caption texts are counted separately, but this can be modified if desired.

It is possible to call TeXcount from the TeX/LaTeX document, and include the word count: see details in the FAQ, or StackExchanges questions here and here.

You must log in to answer this question.

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