5

I'm trying to create a table with underlined column groupings. I have an extra space between the groupings using @{\hskip 1cm}, but I don't want the underlining to extend over this extra space. Is there an easy way to fix this? I'd prefer not to add an extra column to my table as a work-around?

Also, second question - how does one do multiple lines with \cline?

\documentclass[authoryear,letterpaper,english,11pt]{article}

\RequirePackage{amsthm,amsmath,amsfonts,amssymb,color,graphicx,babel,natbib,booktabs,geometry,comment, import,rotating,array}
\begin{document}

\begin{sidewaystable}[htbp]\centering \small
\caption{Ranking by parameters \label{stats_rank}}
\begin{tabular*}{\hsize}{@{\hskip\tabcolsep\extracolsep\fill}r*{4}{>{\raggedleft\arraybackslash}m{1cm}} @{\hskip 1cm} *{4}{>{\raggedleft\arraybackslash}m{1cm}} @{\hskip 1cm} *{4}{>{\raggedleft\arraybackslash}m{1cm}} }\hline
 & \multicolumn{4}{c}{Alpha} & \multicolumn{4}{c}{Epsilon} & \multicolumn{4}{c}{Nu} \\ \cline{2-5}
   Year &    Q1 &    Q2 &    Q3 &    Q4 &    Q1 &    Q2 &    Q3 &    Q4 &    Q1 &    Q2 &    Q3 &    Q4\\ \hline
   1994 &    0.33 &    0.49 &    0.64 &    1.00 &    2.04 &     4.25 &      9.28 &     29.77 &    0.68 &    0.92 &    1.22 &    1.77\\
   1995 &    0.35 &    0.50 &    0.67 &    1.00 &    1.96 &     3.91 &      8.32 &     29.21 &    0.66 &    0.93 &    1.23 &    1.82\\
   1996 &    0.34 &    0.49 &    0.64 &    1.00 &    2.01 &     4.56 &     10.55 &     33.16 &    0.66 &    0.94 &    1.24 &    1.83\\
\hline
\end{tabular*}
\end{sidewaystable}
\end{document}

1 Answer 1

5

Since you are using booktabs, I suggest using its rules as well. In fact, the \cline alternative - \cmidrule - provides a means to shorten rules, which seems to be what you're after:

enter image description here

\documentclass{article}
\usepackage[landscape,paper=legalpaper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{array,booktabs}% http://ctan.org/pkg/{array,booktabs}
\begin{document}

\begin{tabular}{@{\hskip\tabcolsep\extracolsep\fill}r*{4}{>{\raggedleft\arraybackslash}m{1cm}} @{\hskip 1cm} *{4}{>{\raggedleft\arraybackslash}m{1cm}} @{\hskip 1cm} *{4}{>{\raggedleft\arraybackslash}m{1cm}} }
  \toprule
   & \multicolumn{4}{c}{Alpha} & \multicolumn{4}{c}{Epsilon} & \multicolumn{4}{c}{Nu} \\ 
   \cmidrule(lr{5mm}){2-5}
   Year &    Q1 &    Q2 &    Q3 &    Q4 &    Q1 &    Q2 &    Q3 &    Q4 &    Q1 &    Q2 &    Q3 &    Q4\\ \midrule
   1994 &    0.33 &    0.49 &    0.64 &    1.00 &    2.04 &     4.25 &      9.28 &     29.77 &    0.68 &    0.92 &    1.22 &    1.77\\
   1995 &    0.35 &    0.50 &    0.67 &    1.00 &    1.96 &     3.91 &      8.32 &     29.21 &    0.66 &    0.93 &    1.23 &    1.82\\
   1996 &    0.34 &    0.49 &    0.64 &    1.00 &    2.01 &     4.56 &     10.55 &     33.16 &    0.66 &    0.94 &    1.24 &    1.83\\
  \bottomrule
\end{tabular}
\end{document}

The interface of \cmidrule allows for shortening the rules on the left or right, and can even take an argument (like r{<len>}) which would shorten the rule by the desired length.

Regarding the second question: I don't think you need double \clines. However, such things are provided by hhline. It would not fit well with a booktabs approach though, in my opinion.

1
  • Works perfectly - thanks very much!
    – Kevin
    Jul 16, 2013 at 17:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .