7

In the following table, why does the double line before the diff column not go through? I guess all the multicolumn{1} are wrong? How can I fix it?

\begin{table}
\centering
\begin{tabular}{|l||c|c|c|c|c|c||r|}\hline

\multicolumn{1}{|c||}{} &
\multicolumn{3}{c|}{Model 1} &
\multicolumn{3}{c|}{Model 2}  &
\multicolumn{1}{||r|}{}\\

\multicolumn{1}{|c||}{Task} &
\multicolumn{1}{c}{(a)} &
\multicolumn{1}{c}{(b)} &
\multicolumn{1}{c|}{(c)} &
\multicolumn{1}{c}{(a)} &
\multicolumn{1}{c}{(b)} &
\multicolumn{1}{c}{(c)} &
\multicolumn{1}{||r|}{diff}\\\hline

Foo     & 1 & 2 & 3 & A & B & C & + \\
Bar     & 1 & 2 & 3 & A & B & C & + \\\hline

\end{tabular}
\caption{whatever}\label{tab:whatever}
\end{table}

fugly table

7

A \multicolumn overwrites the right line setting of its cell(s) defined by the tabular header, except of the first cell, there it overwrites the right and left line setting.

\begin{tabular}{|l||c|c|c|c|c|c||r|}\hline

\multicolumn{1}{|c||}{} &
\multicolumn{3}{c|}{Model 1} &
\multicolumn{3}{c||}{Model 2}  &
\multicolumn{1}{r|}{}\\

\multicolumn{1}{|c||}{Task} &
\multicolumn{1}{c}{(a)} &
\multicolumn{1}{c}{(b)} &
\multicolumn{1}{c|}{(c)} &
\multicolumn{1}{c}{(a)} &
\multicolumn{1}{c}{(b)} &
\multicolumn{1}{c||}{(c)} &
\multicolumn{1}{r|}{diff}\\\hline

Foo     & 1 & 2 & 3 & A & B & C & + \\
Bar     & 1 & 2 & 3 & A & B & C & + \\\hline

\end{tabular}
5

This is not an answer to your question (others did that). However, I think you can make a better looking table by following the advice in the booktabs package.

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{lccccccc}
\toprule
&\multicolumn{3}{c}{Model 1}&\multicolumn{3}{c}{Model 2}&\\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}
Tack & (a) & (b) & (c) & (a) & (b) & (c) & diff\\
\midrule
Foo & 1 & 2 & 3 & A & B & C & $+$\\
Bar & 1 & 2 & 3 & A & B & C & $+$\\
\bottomrule
\end{tabular}
\end{document}

alt text

  • \begin{tabular}{@{}lccccccc@{}} – user2478 Jan 11 '11 at 10:45
  • @Herbert: Only if you don't want the rules to extend. I'd only use that if I needed the extra space. I think it looks better with the longer rules. – TH. Jan 11 '11 at 10:48
  • @TH: it was you who wrote: "following the advice in the booktabs" ... – user2478 Jan 11 '11 at 10:51
  • @Herbert: Yep. You got me there. =) – TH. Jan 11 '11 at 10:53
0

One way to solve your problem is to change some of your code as the following lines.

\multicolumn{1}{|c||}{} &
\multicolumn{3}{c|}{Model 1} &
\multicolumn{3}{c||}{Model 2}  &
\\

and

\multicolumn{1}{c||}{(c)} &
\multicolumn{1}{r|}{diff}\\\hline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.