5

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 preable. 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} 
  • 4
    Just an idea: How about using the comment package and redefining the tabular environment to act as a comment environment? – user36296 Aug 22 '16 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. – George Vousden Aug 22 '16 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. – user36296 Aug 22 '16 at 15:39
4

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}
3

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.

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.