# Booktabs table, multicolumn header underline

I have a table for a regression, which has two main parts ("Immigrants" and "Locals"). I would like to put a small line underneath Immigrants that goes from where the first model starts ("Disability") until where the last model ends ("rate"), and another line with the same length underneath "Locals". My intention is to separate better the two parts of the table. Is that a possibility? How can I do it? I am adding my code and a screenshot. Thank you so much!

    \begin{table}[H]\centering
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\caption{Health}
\begin{tabular}{l*{5}{c}}
\toprule
&\multicolumn{2}{c}{Immigrants}  & & \multicolumn{2}{c}{Locals}                                     \\
&\multicolumn{1}{c}{Disability}&\multicolumn{1}{c}{Offspring survival rate}& & \multicolumn{1}{c}{Disability}&\multicolumn{1}{c}{Offspring survival rate}\\
\midrule
Low         &    -0.00190         &    -0.00525         & &     0.00185          &    -0.00186         \\
&     (-0.43)         &     (-0.40)         & &       (0.83)         &     (-0.36)         \\
High        &    -0.00865         &     0.00429         & &    -0.00413         &     -0.0207\sym{*}  \\
&     (-1.21)         &      (0.20)         & &     (-1.01)         &     (-2.24)         \\


etcetera..

(also, as you can tell, I have an extra empty column between them to create more space)

-
protip: replace empty columns with @{\quad} (or @{\qquad}, or @{\hspace{42in}}, or whatever) to insert a constant space between the columns so you don't need the extra ampersands in the body. – wchargin Feb 19 at 1:53
another protip: very often, the documentation for LaTeX packages is quite useful, and booktabs is one of those cases. the \cmidrule command, which is what you seek, is shown on page 2 of the manual (in section 1 "Introduction"), and the command itself is explained on page 4. you can access documentation with texdoc booktabs at a terminal or at texdoc.net/pkg/booktabs. – wchargin Feb 19 at 1:55

Use the \cline equivalent offered by booktabs:

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}%
\begin{tabular}{l*{4}{c}}
\toprule
& \multicolumn{2}{c}{Immigrants}  & \multicolumn{2}{c}{Non-immigrants} \\
\cmidrule(lr){2-3}\cmidrule(lr){4-5}
& \multicolumn{1}{c}{Disability} & \multicolumn{1}{c}{Offspring survival rate} &
\multicolumn{1}{c}{Disability} & \multicolumn{1}{c}{Offspring survival rate} \\
\midrule
Low    &  -0.00190    &  -0.00525    &  0.00185     &  -0.00186       \\
&   (-0.43)    &   (-0.40)    &   (0.83)     &  (-0.36)        \\
High   &  -0.00865    &  0.00429     &  -0.00413    &  -0.0207\sym{*} \\
&   (-1.21)    &   (0.20)     &   (-1.01)    &  (-2.24)        \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


The optional (lr) argument for \cmidrule trims the line on the left and right side so they're separated between columns three and four.

-

Add the \cline command instead of the \midrule or after the first table row (depending on what you actually want). For example

& \multicolumn{2}{c}{Immigrants} & & \multicolumn{2}{c}{Locals} \\ \cline{2-3} \cline{5-6}


The numbers i-j in the \cline{i-j} command specify the columns that should be "underlined", i.e. the line starts at column i and ends at column j.

Edit: If you are using the booktabs package, use the equivalent command \cmidrule instead as suggested by @Werner. Note, however, that the booktabs package modifies the default table appearance and some features of the original tables no longer produce satisfactory results (such as vertical table rules). That being said, using booktabs is usually a better choice.

-
The original table didn't include any vertical rules... yes, I'm talking about this question. – Werner Feb 18 at 23:00

In addition to using some of the line-drawing macros of the booktabs package to give the table an "open" look, you should also

• make the table not exceed the width of the text block; this may be done by using a tabularx environment to insert a line break in the strings Offspring survival rate

• align the numerical data on their respective decimal markers and use proper - (minus) signs rather than dashes for the negative numbers; this can be done by loading the dcolumn package and using the D column types.

\documentclass{article}
\usepackage{booktabs,tabularx,dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand\mc[1]{\multicolumn{1}{C}{#1}} % shortcut macro
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\begin{document}

\begin{table}
\caption{Health}
\begin{tabularx}{\textwidth}{ l *{4}{d{2.5}} }
\toprule
& \multicolumn{2}{c}{Immigrants}  & \multicolumn{2}{c}{Non-immigrants} \\
\cmidrule(lr){2-3}\cmidrule(l){4-5}
& \mc{Disability} & \mc{Offspring survival rate}
& \mc{Disability} & \mc{Offspring survival rate} \\
\midrule
Low   &-0.00190  & -0.00525 &  0.00185 &  -0.00186     \\
& (-0.43)  & (-0.40)  &   (0.83) &  (-0.36)      \\