Hi there guys,
is there a simple way not to display a column in a tabular environment?
I thought there must be something like "\begin{tabular}{cccxc}", which would mean do not display the 4th column. But I guess it's not that simple.
I just wanna try how my table looks without that column
Thanks
Marki
\documentclass{article}
\usepackage{color}
\usepackage{array}
\newcolumntype{x}{>{\color{white}}c}
\begin{document}
\begin{tabular}{cccxc}
A & B & C & D & E
\end{tabular}
\end{document}
...
Runaway argument?
! File ended while scanning use of \next.
...
So I guess 'comment' is not allowed within a table (cell).
For the second part... I was just wondering if there was no editor for tables. For small tables just manipulating the source is good enough but for larger ones some WYSIWYG would be great .... :-\
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{array}
\newsavebox{\hiddenbox}
\newcommand{\ZZ}{\hspace{\tabcolsep}}
\newcolumntype{Z}{>{\begin{lrbox}{\hiddenbox}}p{0pt}<{\end{lrbox}}}
\newcolumntype{U}{@{\ZZ}Z@{}}
\newcolumntype{V}{@{\ZZ}Z@{\ZZ}}
\begin{document}
\begin{tabular}{|c|c|c|c|c|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|Uc|c|c|c|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|cU|c|c|c|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|cU|cU|c|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|c|c|c|cU|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
\hline
\end{tabular}
\bigskip
\begin{tabular}{|ccccc|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|Ucccc|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|cVcVc|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
First column & Second column & Third column & Fourth column & Fifth column \\
\hline
\end{tabular}
\bigskip
\begin{tabular}{|ccccU|}
\hline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
First column & Second column & Third column & Fourth column & Fifth column \tabularnewline
\hline
\end{tabular}
\end{document}
If you don't see how it works, ask for an explanation. Please, note the use of \tabularnewline to end rows when the hidden column is the last one. Note also that the column types U and V are almost identical; they only differ in the space after the hidden column.
Edited to simplify the definition of the Z column type