# LaTeX table header with split horizontal lines

I've seen the following table in paper and would like to reproduce it in LaTeX. The one thing that I'm struggling with is the broken horizontal lines between the two different "Dep. Var." columns (gap between model "(5)" and "(6)". What is a good way to achieve a similar effect in LaTeX? I can thing only of adding a narrow, empty "dummy" column. Any other ideas?

-

## migrated from stackoverflow.comJul 20 '12 at 17:58

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jul 21 '12 at 5:01

Here is one way following your idea of inserting a narrow, empty "dummy" column @{}p{...}@{}:

\documentclass{article}
\usepackage[margin=.5in]{geometry}% http://ctan.org/pkg/geometry
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\begin{document}
\noindent\small
\begin{tabularx}{\linewidth}{
>{\raggedleft\arraybackslash}X% column 1
*{5}{>{\centering\arraybackslash}p{.08\linewidth}}% columns 2-6
@{}p{1em}@{}% column 7
*{3}{>{\centering\arraybackslash}p{.08\linewidth}}}% columns 8-10
\toprule
Dependent Variable: &
\multicolumn{5}{c}{Dep.\ Var.\ =\ \textit{HoursWorked}} &&
\multicolumn{3}{c}{Dep.\ Var.\ =\ \textit{NumCommunications}} \\
\cmidrule{2-6}\cmidrule{8-10}
Model: &
(1) & (2) & (3) & (4) & (5) &&
(6) & (7) & (8) \\
\cmidrule{2-6}\cmidrule{8-10}
&&&&&&&&& \\
\bottomrule
\end{tabularx}

\end{document}


Here is another where you specify the column separation as a gap @{...}, and cut horizontal line a bit short:

\documentclass{article}
\usepackage[margin=.5in]{geometry}% http://ctan.org/pkg/geometry
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\begin{document}
\noindent\small
\begin{tabularx}{\linewidth}{
>{\raggedleft\arraybackslash}X% column 1
*{5}{>{\centering\arraybackslash}p{.08\linewidth}}% columns 2-6
@{\hspace{1em}}% column 6-7 gap
*{3}{>{\centering\arraybackslash}p{.08\linewidth}}}% columns 7-9
\toprule
Dependent Variable: &
\multicolumn{5}{c}{Dep.\ Var.\ =\ \textit{HoursWorked}} &
\multicolumn{3}{c}{Dep.\ Var.\ =\ \textit{NumCommunications}} \\
\cmidrule(r{1em}){2-6}\cmidrule{7-9}
Model: &
(1) & (2) & (3) & (4) & (5) &
(6) & (7) & (8) \\
\cmidrule(r{1em}){2-6}\cmidrule{7-9}
&&&&&&&& \\
\bottomrule
\end{tabularx}

\end{document}


In both instances I've used booktabs and tabularx to draw and stretch the table. geometry was added to fit the table inside the margins. It may not be necessary for your end-use document.

-
This is awesome. Thank, Werner. –  Chris Jul 20 '12 at 14:56