I'm using a tabular*
with rubber spacing to fill the complete width of the page. This works fine, except that when I use \cline
, the line is not complete. It seems that \cline
does not cover the spacing. I'm using pdflatex
. Below you will find a code example. Any ideas on how to fix this?
\usepackage{array} % for defining a new column type
\usepackage{varwidth} %for the varwidth minipage environment
%...
\newcolumntype{M}{>{\begin{varwidth}{6cm}}l<{\end{varwidth}}} %M is for Maximal column
%...
\begin{tabular*}{15.5cm}{@{\extracolsep{\fill}} | M | r | r | r | r |}
\hline
\bf Omschrijving & \bf Hoeveelheid & \bf Prijs & \bf SubTotaal & \bf BTW\\
\hline
Armband 2 & 1 & 256.00 & 256.00 & 19.00\% \\
\hline
\multicolumn{3}{c |}{} & SubTotaal & 256.00\\
\multicolumn{3}{c |}{} & BTW (19.0) & 48.64\\
\multicolumn{3}{c |}{} & \bf Totaal & \bf 304.64\\
\cline{4-5}
\end{tabular*}
Best Answer
That's caused by
\extracolsep{\fill}
which produces the space that\cline
doesn't fill. You could verify that by removing@{\extracolsep{\fill}}
.Besides removing that rubber length, you could repair it by
\begin{tabular*}{15.5cm}{@{\extracolsep{\fill}}| M | r | r |@{\extracolsep{0pt}}r | r |}
tabularx
. This would be my choice.Further I strongly recommend to omit all these vertical lines which obstruct the reading. Good tables don't need to be grids! Have a look at the
booktabs
package and its documentation. I would use perhaps a top line, a seperation line below the header and a bottom line, but no vertical line at all. Compare tables in good books, you're able to typeset fine tables too.