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 created a table, but it is a little skewed to the right. Any idea how to fix it? The code is :

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{lllllll}

\toprule
\multicolumn{1}{l}{Parameters} &
\multicolumn{2}{c}{Model $A$}    &
\multicolumn{2}{c}{Model $B$}    \\ 
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}

 &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% Bayesian Interval}     &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% Bayesian Interval}     \\
\midrule



concern &0.006     & (  -0.036, 0.047) & 0.010 & (-0.029,0.050) \\
\bottomrule
\end{tabular}


\end{document}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The simplest fix is to just add one more row to the header:

enter image description here

Notes:

  • You should really use math mode for numbers -- This is especially important if they are negative, as the number is not correctly displayed otherwise. Note how the negative numbers are displayed without math mode:

enter image description here

Code:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\noindent
\begin{tabular}{lllllll}

\toprule
\multicolumn{1}{l}{Parameters} &
\multicolumn{2}{c}{Model $A$}    &
\multicolumn{2}{c}{Model $B$}    \\ 
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}

 &
\multicolumn{1}{c}{} &
\multicolumn{1}{c}{95\% Bayesian}     &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{95\% Bayesian}     \\
 &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{Interval}     &
\multicolumn{1}{c}{Coefficient} &
\multicolumn{1}{c}{Interval}     \\\midrule

concern &0.006     & $(  -0.036, 0.047)$ & 0.010 & $(-0.029,0.050)$ \\
\bottomrule
\end{tabular}
\end{document}
share|improve this answer
    
Thank you very much @Peter. –  Günal Jan 17 '13 at 6:46
1  
I'd also replace \cmidrule(lr){4-5} with \cmidrule(l){4-5}, i.e., I would not trim the rule on the right-hand end. –  Mico Jan 17 '13 at 7:26
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.