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 need to typeset a two-column document (conference paper) & use the multicol package. I wish to insert a table & usually use the booktabs package as it gives nice spacing. However, in this case, the horizontal rules are truncated. Would anybody know what the problem is?

MWE:

\documentclass[pdftex,10pt]{article}
\usepackage[letterpaper,margin=2.5cm,pdftex,showframe]{geometry}
\usepackage{booktabs}
\usepackage{multicol}
\pagestyle{empty}
\begin{document}
\begin{multicols}{2}
\begin{table*}
   \begin{tabular}{@{}ll rrrrr rrrrr@{}}
   \toprule
   \multicolumn{2}{@{}l}{Penalty} &\multicolumn{5}{c}{100 xx} &      \multicolumn{5}{c}{1000 xxx} \\
   \cmidrule(rl){3-7}\cmidrule(rl){8-12}
    & $s$ & $\nu$& G & E & P & D & G& E & P & D \\
   \midrule
   \multicolumn{12}{c}{\it abcd } \\
   P40 &2&  10&  -62&  -23&   -6& -13.15&     22&   -5&    0&  -0.84\\
   P41   &   1&   --&   55&   28&    1&  -4.94&  34&    7&    0&  -1.23\\
  \bottomrule
  \end{tabular}
  \end{table*}
  \end{multicols}
  \end{document}

and here is what I get - the lines seem to be truncated before the right edge of column 1: screenshot of offending table

share|improve this question

3 Answers 3

As far as I can tell, your tabular environment has 11 rather than 12 columns. Getting rid of the \multicolumn wrapper around the header item "Penalty" and adjusting the column counts on some of the other items fixes this issue.

Separately, in view of the fact that most of the columns would appear to contain numerical data, some with negative values, you may want to use a more suitable column type than r to align the numbers. For instance, you could use the D column type provided by the dcolumn package, as is done in the example below. (An alternative to the dcolumn package would be the siunitx package and its S column type.)

enter image description here

\documentclass[letterpaper]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}  % shortcut macro
\begin{document}
\begin{multicols}{2}
\begin{table*}[t]
   \centering
   \begin{tabular}{@{} l *{2}{d{2.0}} *{2}{d{3.0}} d{2.0}
        d{3.2} *{3}{d{2.0}} d{2.2} @{}}
   \toprule
   Penalty 
   & \multicolumn{5}{c}{100 xx} 
   & \multicolumn{5}{c}{1000 xxx} \\
   \cmidrule(rl){2-6}\cmidrule(l){7-11}
    & s & \nu & \mc{G} & \mc{E} & \mc{P} & 
     \mc{D} & \mc{G}& \mc{E} & \mc{P} & \mc{D} \\
   \midrule
   \multicolumn{11}{c}{\itshape abcd } \\
   P40 &2& 10& -62&  -23&   -6& -13.15& 22& -5& 0&  -0.84\\
   P41   &   1&   -&   55& 28&  1& -4.94& 34& 7& 0&  -1.23\\
  \bottomrule
  \end{tabular}
  \end{table*}
  \end{multicols}
  \end{document}
share|improve this answer
    
thank you VERY much - can't believe I didn't spot this; normally I'd expect to get an error about too few columns on compilation in this scenario –  prettygully Feb 11 at 22:05

enter image description here

An & is missing in the first column

\documentclass[10pt]{article}
\usepackage[letterpaper,margin=1.5cm,showframe]{geometry}
\usepackage{booktabs}
\usepackage{multicol}
\pagestyle{empty}
\begin{document}
\begin{multicols}{2}
\begin{table*}
   \begin{tabular}{@{}ll rrrrr rrrrr@{}}
   \toprule
   \multicolumn{2}{@{}l}{Penalty} &\multicolumn{5}{c}{100 xx} &  \multicolumn{5}{c}{1000 xxx} \\
   \cmidrule(rl){3-7}\cmidrule(rl){8-12}
    & & $s$ & $\nu$& G & E & P & D & G& E & P & D \\
   \midrule
   \multicolumn{12}{c}{\it abcd } \\
   & P40 &2&  10&  -62&  -23&   -6& -13.15&     22&   -5&    0&  -0.84\\
   & P41   &   1&   --&   55&   28&    1&  -4.94&  34&    7&    0&  -1.23\\
  \bottomrule
  \end{tabular}
  \end{table*}
  \end{multicols}
  \end{document}
share|improve this answer

Changing the number of columns from 12 to 11, solves the problem. Here is the modified file:

\documentclass[pdftex,10pt]{article}
\usepackage[letterpaper,margin=2.5cm,pdftex,showframe]{geometry}
\usepackage{booktabs}
\usepackage{multicol}
\pagestyle{empty}
\begin{document}
\begin{multicols}{2}
\begin{table*}
   \begin{tabular}{@{}ll rrrrr rrrrr@{}}
   \toprule
   \multicolumn{2}{@{}l}{Penalty} &\multicolumn{5}{c}{100 xx} & \multicolumn{4}{c}{1000 xxx} \\
   \cmidrule(rl){3-7}\cmidrule(rl){8-11}
    & $s$ & $\nu$& G & E & P & D & G& E & P & D \\
   \midrule
   \multicolumn{11}{c}{\it abcd } \\
   P40 &2&  10&  -62&  -23&   -6& -13.15&     22&   -5&    0&  -0.84\\
   P41   &   1&   --&   55&   28&    1&  -4.94&  34&    7&    0&  -1.23\\
  \bottomrule
  \end{tabular}
\end{table*}
\end{multicols}
\end{document}

enter image description here

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.