5

In the following the first two columns are different in nature from the last two and I wanted to emphasize this by having a break in the horizontal line. I drew lines across columns 1 and 2 and then across 3 and 4 but they connect up. How can I get some space between them so that there are two distinct horizontal line segments? If possible I would like to stick with using tabu.

\documentclass{article}
\usepackage{tabu}
\begin{document}

\begin{center}
\begin{tabu}{XXXX}
1 & 2 & a & b\\
\tabucline{1-2 3-4}
1 & 2 & a & b\\
\end{tabu}
\end{center}

\end{document}

Output (ok except I would like some space in the horizontal line between column 2 and 3):

screenshot

David Carlisle
  • 757,742
user1189687
  • 1,953

1 Answers1

6

You can use \cmidrule from the booktabs package which provides a method of shortening each end:

enter image description here

Notes:

Code:

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabu}
\begin{document}

\begin{center} \begin{tabu}{XXXX} 1 & 2 & a & b\ \cmidrule(r{1.0ex}){1-2}\cmidrule(l{1.0ex}){3-4} 1 & 2 & a & b\ \end{tabu} \end{center} \end{document}

Peter Grill
  • 223,288
  • Thanks. I should have included the fact that the rule is in color since that was part of my \tabucline command before I made the example minimal but it seems that \arrayrulecolor{red} placed before the cmidrule line does work so I am ok after all. – user1189687 Jul 22 '12 at 22:26
  • Is there a solution that does not require booktabs? In another question it was pointed out in http://tex.stackexchange.com/questions/64332/vertical-space-around-horizontal-rules-between-tabu-rows-while-maintaining-color that there is a problem with using booktabs with tables having color. – user1189687 Jul 23 '12 at 03:37
  • @user1189687: I do not know, but I am not an expert on tables by any means... – Peter Grill Jul 23 '12 at 03:55