0

I have a dissertation with lots of longtable and tabu environments.

longtable are on their own, while tabu are wrapped inside table environments.

I want something to put in the preamble of the document that makes the tables (both longtable and tabu) invisible. That suppresses them, like those environments were not there.

I have to do that because I have to give the dissertation to a person that needs to edit it, and I have to convert to Word

Surronding every table with the comment environment is not an option, because I have tons of tables.

I tried the solution here but it doesn't work. That solution is to put

\usepackage[figuresonly,nolists,nomarkers]{endfloat}
\renewcommand{\processdelayedfloats}{}

in the preamble. I tried with:

\renewenvironment{tabu}[1]{}{}  

But the text of the table is still there unformatted. I assume because that command substitute \begin{tabu} with nothing and \end{tabu} with nothing, leaving the text inside

then I tried:

\renewenvironment{tabu}[1]{\comment}{\endcomment}  

After loading the commentpackage, and the file does not compile

Can you help me please?

  • 1
    After \usepackage{comment} do \excludecomment{longtabu} – egreg Nov 24 '17 at 18:28
6

Package comment

The comment package offers \excludecomment. It can be (mis)used to disable an environment. However, it does not overwrite the \end{...} part, thus the following example clears the end code part of the environment explicitly:

\documentclass{article}
\usepackage{longtable}

\usepackage{comment}
\excludecomment{longtable}
\let\endlongtable\relax

\begin{document}
Text
\begin{longtable}{ll}
  Answer: & 42
\end{longtable}
\end{document}

Result

Package version

Macro \excludeversion of package version also redefines the \end part of the environment:

\documentclass{article}
\usepackage{longtable}

\usepackage{version}
\excludeversion{longtable}

\begin{document}
Text
\begin{longtable}{ll}
  Answer: & 42
\end{longtable}
\end{document}

However, the documentation of package version (inside version.sty) warns:

Very long sections of excluded text might cause a `TeX capacity exceeded' error.

Package versions

Package versions (with suffix s) claims to have solved some of the problems of version, including the memory issue:

· Large passages don't fill main memory when excluded. (s in versions means safe!)

\documentclass{article}
\usepackage{longtable}

\usepackage{versions}
\let\longtable\relax % Removes warning
\excludeversion{longtable}

\begin{document}
Text
\begin{longtable}{ll}
  Answer: & 42
\end{longtable}
\end{document}

The package is more verbose (messages on the console). \longtable is disabled explicitly before \excludeversion to avoid a warning, that environment table was previously defined.

| improve this answer | |

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.