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.

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

share|improve this question
add comment

3 Answers

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

share|improve this answer
    
\begin{tabular}{@{}lccccccc@{}} –  Herbert 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" ... –  Herbert Jan 11 '11 at 10:51
    
@Herbert: Yep. You got me there. =) –  TH. Jan 11 '11 at 10:53
add comment

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}
share|improve this answer
add comment

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
share|improve this answer
add comment

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.