Take the 2-minute tour ×
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.

I'm trying to copy this table into TeX:

Table

I have problems with the horizontal lines under "Gaussian" etc. When I specify three \cmidrule's, they are not separated but are combined into one big \midrule or \cline.

It would be great if someone could show me how to narrow down such a \cmidrule. Thanks in advance!

Here's the (spaghetti) code I use:

\documentclass[bibtotoc,liststotoc,BCOR5mm,DIV12]{scrbook} 
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{colortbl,array} % für farbige cells
\usepackage{multirow,bigdelim}
\usepackage{booktabs}

\begin{document}

\begin{table}[htb]
\resizebox{\textwidth}{!}{
\begin{tabular}{lr rrrrrr rrrrrr rrrr}
\toprule
$f$ & $n$ & \multicolumn{6}{l}{Gaussian} &  \multicolumn{6}{l}{Binomial Logit} & \multicolumn{4}{l}{Survival} \\ \cmidrule{3-8} \cmidrule{9-14} \cmidrule{15-18}
 & & \multicolumn{2}{l}{FP}  & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & AIC & REML \\ 
 &  & \makebox[1cm][l]{FP2}
 & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS}
 & \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{PS} \\ \midrule
 & 100 & \cellcolor[gray]{0.8} 0.012 & \cellcolor[gray]{0.8} 0.012 & 0.021 & 0.025 & 0.018 & 0.018 & 0.043 & \cellcolor[gray]{0.8} 0.042 & 0.146 & 0.194 & 0.074 & 0.076 & \cellcolor[gray]{0.8} 0.015 & 0.016 & 0.427 & 0.019 \\ 
$f_1$ & 500 & 0.004 & \cellcolor[gray]{0.8} 0.002 & 0.006 & 0.006 & 0.004 & 0.004 & 0.014 & \cellcolor[gray]{0.8} 0.011 & 0.030 & 0.034 & 0.028 & 0.028 & 0.020 & 0.007 & 0.024 & \cellcolor[gray]{0.8} 0.005

\end{tabular}
}
\end{table}

\end{document}
share|improve this question

1 Answer 1

up vote 16 down vote accepted

The \cmidrule command of booktabs allows for an optional argument using parentheses ( ) to specify on which side it should be reduced:

\cmidrule(r){3-8} \cmidrule(r){9-14} \cmidrule{15-18}

would shorten the right end of the first two rules. You can also add an amount in braces, i.e. (r{10pt}) and select both sides (lr), (l{5pt}r{10pt}). See the description of \cmidrule in the booktabs manual on page 4 for more details.

share|improve this answer
    
Like a charm. Thanks a lot :) –  Alexx Hardt May 20 '11 at 13:58

Your Answer

 
discard

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.