Is there a way to hide a column without adding whitespace to the table?
I have hidden the last column of a table as described here: Easiest way to delete a column?
The problem is that colorised rows with the last column hidden don't align with the table width.
A quick-fix is to change the column order, so that the hidden column is between the first and last column. But this only moves the added whitespace to between the first and last column.
I've hidden the column by defining a new column type. This definition adds colour to the right of the last table line as shown above.
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}}
This definition adds white color to the left of the last table line as shown below: \newcolumntype{H}{>{\setbox0=\hbox\bgroup\cellcolor{white}}c<{\egroup}@{}}
The table is available here: https://github.com/eivinskr/fileTabulator
(cleaned) Code from main.tex:
\documentclass{report}
\usepackage{tabu,booktabs}
\usepackage[table]{xcolor}
\usepackage{color}
\usepackage{pdfpages}
\usepackage{float}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{longtable,tabu}
\usepackage{array}
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}}
\definecolor{lightgrey}{gray}{0.9}
\begin{document}
\title{File list}
\maketitle
\input{sections/FileTable}
\end{document}
Code from FileTable.tex:
\begin{landscape}
\centering
\begin{longtabu} to \linewidth{|X[1,l]|X[2,l]|X[1,l]H|}
\taburowcolors[1]2{lightgrey..white}
\toprule
\caption{File List}\label{tab:file_list}\\
\hline
\textbf{Path} & \textbf{Filename} & \textbf{Description} &
\textbf{Hash} \\
\hline
\endfirsthead
\multicolumn{4}{l}
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{Path} & \textbf{Filename} & \textbf{Description} &
\textbf{Hash} \\
\hline
\endhead
\hline \multicolumn{4}{l}{\textit{Continued on next page}} \\\endfoot
\hline
\endlastfoot
\taburowcolors[1]2{lightgrey..white}
/ & testFile1.txt & & 33918e2384aee6ec78588db2ea6eacc6 \\
/testFolder & testFile2.txt & Try to move, change or edit this file!
I'll still be here! & a3f84bf2a1f0f0b599d51c089c99091e \\
\end{longtabu}
\end{landscape}


