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.

Here is the code:

\begin{table}
\centering
\begin{tabular}{rrrrr}
    \toprule
    \multirow{2}{*}{b} & \multicolumn{2}{c}{QCDH} & Single & \multirow{2}{*}{$\frac{\pi_{q1}}{\pi_{s1}}$} \\
    \cmidrule{2-4} \\
 & $\pi_{q1}$ & $\pi_{q1}$ & $\pi_{s1}$ & \\
\midrule \\
0.1 & 0.0055 & 0.0018 & 0.0018 & 3.0555\\
0.5 & 0.1218 & 0.0830 & 0.0074 & 16.4594\\
2.5 & 0.7325 & 0.6771 & 0.3561 & 2.0570\\
\bottomrule
\end{tabular}
\caption{Pickup rates from QCDH and single SNP approach}
\end{table}

Here is the result:

enter image description here

As you can see, the first \cmidrule seems to take too much space.

share|improve this question
1  
Not a direct answer to your question, but simply don't use multirow. The idea is nice, but completely unnecessary. Just leave your b and \frac{\pi}{\pi} in the top row, maybe just smash the bottom of the fraction as in \smash[b]{$\frac{\pi_{q1}}{\pi_{s1}}$. You'll realize that the output is nicely looking, decent and completely comprehesive :) –  tohecz Dec 12 '13 at 15:51
1  
Btw, you speak about "first \cmidrule", but your example contains only one \cmidrule. However, if you want to remove the extra line, just remove the \\ after your \cmidrule –  tohecz Dec 12 '13 at 15:53
    
This works. I am also trying to get some space between 2-3 and 4, I have tried this: ` \cmidrule{2-3}\morecmidrules\cmidrule{4} `, but it will not compile. –  qed Dec 12 '13 at 15:59

2 Answers 2

up vote 5 down vote accepted

For having some space between two \cmidrules at the same level, you never want \morecmidrules. Just use the () optional argument to shorten the line, as in the following:

\begin{table}
\centering
\begin{tabular}{rrrrr}\toprule
  $b$ & \multicolumn{2}{c}{QCDH} & Single & \smash[b]{$\frac{\pi_{q1}}{\pi_{s1}}$} \\
  \cmidrule(r){2-3}\cmidrule(l){4-5} % notice there's no \\ here
  & $\pi_{q1}$ & $\pi_{q1}$ & $\pi_{s1}$ & \\
  \midrule[\heavyrulewidth] % notice there's no \\ here
0.1 & 0.0055 & 0.0018 & 0.0018 & 3.0555\\ \midrule
0.5 & 0.1218 & 0.0830 & 0.0074 & 16.4594\\ \midrule
2.5 & 0.7325 & 0.6771 & 0.3561 & 2.0570\\ \bottomrule
\end{tabular}
\caption{Pickup rates from QCDH and single SNP approach}
\end{table}
share|improve this answer
    
Very nice. I used \cmidrule(l){4-4}. But there is still no space between those two cmidrules. –  qed Dec 12 '13 at 16:15
    
My bad, it was a typo, everything is perfect now. –  qed Dec 12 '13 at 16:17

Integrating the functionality of the multirow package with that of the booktabs package is tricky: \midrule and \cmidrule add extra vertical spacing, but this extra spacing isn't taken into account when a \multirow instruction is executed. Thus, lining up the material in a 2-row multirow that also features \midrule or \cmidrule between those two rows is rarely satisfactory.

Moreover, I'd say your table neither requires nor benefits from applying a \multirow to the contents of columns 1 and 5 of the header. Just place those items in the very first row, and make the \cmidrule span just columns 2 and 3.

I think it's in general a good idea to center the items in the header even if the material in the body of the table isn't (or shouldn't be) centered. Finally, since the data are numeric, it's probably also a good idea to align them on their decimal points.

enter image description here

\documentclass{article}
\usepackage{amsmath,booktabs,siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{S[table-format=1.1]
           *{3}{S[table-format=1.4]}
                S[table-format=2.4]}
\toprule
    {b} & \multicolumn{2}{c}{QCDH} & {Single} & {$\dfrac{\pi_{q1}}{\pi_{s1}}$} \\
    \cmidrule(lr){2-3}  
 & {$\pi_{q1}$} & {$\pi_{q1}$} & {$\pi_{s1}$}  \\
\midrule 
0.1 & 0.0055 & 0.0018 & 0.0018 &  3.0555\\
0.5 & 0.1218 & 0.0830 & 0.0074 & 16.4594\\
2.5 & 0.7325 & 0.6771 & 0.3561 &  2.0570\\
\bottomrule
\end{tabular}
\caption{Pickup rates from QCDH and single SNP approach}
\end{table}
\end{document}
share|improve this answer

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.