TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 |}
   \bf Omschrijving & \bf Hoeveelheid & \bf Prijs & \bf SubTotaal & \bf BTW\\
   Armband 2 & 1 & 256.00 & 256.00 & 19.00\% \\
   \multicolumn{3}{c |}{} & SubTotaal & 256.00\\
   \multicolumn{3}{c |}{} & BTW (19.0) & 48.64\\
   \multicolumn{3}{c |}{}  & \bf Totaal & \bf 304.64\\
share|improve this question
up vote 6 down vote accepted

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

  • inserting another one such as

\begin{tabular*}{15.5cm}{@{\extracolsep{\fill}}| M | r | r |@{\extracolsep{0pt}}r | r |}

  • or by using a width-fitting tabular environment which adjust the columns width instead of the column separation: 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.

share|improve this answer
I actually tried using "@{\extracolsep{0pt}" but that did not work. Was I doing something wrong? Did this work for you? However, I strongly second the "tabularx" and "booktabs" suggestions. Those are my preferred packages anyday. – Jimi Oke Dec 10 '10 at 2:38
@Jimi: It worked for me, I tested it. In your comment, a closing brace is missing. Could this be the reason? Otherwise I could post a minimal working example. – Stefan Kottwitz Dec 10 '10 at 12:36
This works, but it also removes the spacing. The longest text is against the left line. I guess this is logical as @{\extracolsep{0pt}} removes the spacing. I will look into tabularx for a better solution. – Stephan Dec 10 '10 at 17:31
@Stephan: spacing could be done within the column, by \makebox or \hspace for instance. But tabularx is better because that already adjusts column inner width. – Stefan Kottwitz Dec 10 '10 at 17:35
I had the closing brace but my problem was I placed @{\extracolsep{0pt}} in the wrong column. Thanks. – Jimi Oke Dec 10 '10 at 19:15

As mentioned before (without example), this is provided by the tabularx package. More specifically, it provides the X column specifier that stretches that specific column as needed to fill the width of the table. Common usage has the format:

\usepackage{tabularx}% http://ctan.org/pkg/tabularx

Here is your minimal example:

%\usepackage{array}% http://ctan.org/pkg/array
\usepackage[margin=1cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
%\newcolumntype{M}{>{\begin{varwidth}{6cm}}l<{\end{varwidth}}} %M is for Maximal column

\begin{tabularx}{\linewidth}{| p{6cm} | X | X | X | X |}
  \textbf{Omschrijving} & \textbf{Hoeveelheid} & \textbf{Prijs} & \textbf{SubTotaal} & \textbf{BTW} \\
  Armband 2 & 1 & 256.00 & 256.00 & 19.00\% \\
  \multicolumn{3}{c |}{} & SubTotaal & 256.00 \\
  \multicolumn{3}{c |}{} & BTW (19.0) & 48.64 \\
  \multicolumn{3}{c |}{} & \textbf{Totaal} & \textbf{304.64} \\

Tabularx example

share|improve this answer

This isn't really an answer, but I would like to say that the from a bit of fiddling around it would seem that \extracolsep doesn't play very nicely with \cline regardless of the rubberlength


results in alt text

There are a few things that are wrong:

  • Why is the first column so squished?
  • Why isn't there space added to the right and left of every column?
  • Why are the clines not going all the way to the verticals?

I know that this is not an answer...and I apologize, if people think that I should repost this as a question, I'd happily do that. Just to appease the gods, I've marked this answer CW so that people can convert the question into a real answer, as I think that there are issues here that are very relevant to the original question.

share|improve this answer
\extracolsep affects subsequent columns but will not insert space before the first column. Leslie Lamport wrote this in his book "A Document Preparation System" which is kind of a reference manual. However, for the first column a @{\hspace{1cm} would work. – Stefan Kottwitz Dec 10 '10 at 12:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.