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}

MS-SPO
  • 11,519

2 Answers2

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}

alper
  • 1,389
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.