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 wanted to create table but the following problem occurred:

Problem on Table

The problem is that the lines are not long enough.

Code:

\begin{table}[htp]
\caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32] }
    \label{tab:gr}
\centering
\footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{l@{\hspace{6pt}} *{22}{c}}
\toprule
\bfseries Type & \multicolumn{22}{c}{\bfseries Node name} \\
\cmidrule(l){3-23}
& 25 & 28 & 29 & 31 & 32                 \\
\midrule
\bfseries A
& 20276 & 20302 & 20267 & 20263 & 20257    \\
\bfseries B
& 1376 & 1321 & 83 & 1329 & 1502             \\
\bfseries C
& 0 & 0 & 0 & 0 & 0                           \\
\bottomrule
\addlinespace
\multicolumn{23}{l}{A: Total number of observations}\\
\multicolumn{23}{l}{B: Number of faults}
\multicolumn{23}{l}{C: Number of faults in 2007-09-29}
\end{tabular}
\end{table}
share|improve this question
1  
Is there a reason you have 22 columns but do not use all of them? The way that \multicolumn works means that 'unused' columns can cause some odd output: my first guess would be that this may be the issue. –  Joseph Wright Dec 14 '12 at 8:52
add comment

2 Answers

up vote 7 down vote accepted

It works fine after fixing the errors and adjusting the number of columns.

  • Six columns are used (probably the real world case has 23).
  • \cmidrule adjusted to 2-6.
  • \\ is missing after \multicolumn{...}{l}{B: ...}.
  • Using 6 in the \multicolum of the legend.

Full example:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{table}[htp]
  \centering
  \caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32]}
  \label{tab:gr}
  \footnotesize
  \setlength{\tabcolsep}{2.5pt}%
  \begin{tabular}{l@{\hspace{6pt}} *{5}{c}}
    \toprule
    \bfseries Type & \multicolumn{5}{c}{\bfseries Node name} \\
    \cmidrule(l){2-6}
    & 25 & 28 & 29 & 31 & 32 \\
    \midrule
    \bfseries A
    & 20276 & 20302 & 20267 & 20263 & 20257 \\
    \bfseries B
    & 1376 & 1321 & 83 & 1329 & 1502 \\
    \bfseries C
    & 0 & 0 & 0 & 0 & 0 \\
    \bottomrule
    \addlinespace
    \multicolumn{6}{l}{A: Total number of observations}\\
    \multicolumn{6}{l}{B: Number of faults}\\
    \multicolumn{6}{l}{C: Number of faults in 2007-09-29}
  \end{tabular}
\end{table}
\end{document}

Result

share|improve this answer
add comment
\begin{table}[htp]
\caption{Gross errors found using plausible value check for ambient temperature in Nodes [25-28-29-31-32] }
    \label{tab:gr}
            \centering
                \footnotesize\setlength{\tabcolsep}{2.5pt}
                    \begin{tabular}{l@{\hspace{6pt}} *{5}{c}}
                        \toprule
                        \bfseries Type & \multicolumn{5}{c}{\bfseries Node name} \\
                        \cmidrule(l){3-5}
                        & 25 & 28 & 29 & 31 & 32                 \\
                        \midrule
                        \bfseries A
                        & 20276 & 20302 & 20267 & 20263 & 20257    \\
                        \bfseries B
                        & 1376 & 1321 & 83 & 1329 & 1502             \\
                        \bfseries C
                        & 0 & 0 & 0 & 0 & 0                           \\
                    \bottomrule
                \addlinespace
            \multicolumn{23}{l}{A: Total number of observations}\\
        \multicolumn{23}{l}{B: Number of faults}
    \multicolumn{23}{l}{C: Number of faults in 2007-09-29}
    \end{tabular}
\end{table}
share|improve this answer
    
Welcome to TeX.sx! –  lockstep Dec 14 '12 at 9:17
    
Welcome! Most people don't indent their codes, but I think this is an overindentation example). If you inden't you code you should do it by a reason, in this case, I see a lot of unnecessary indents. –  Manuel Dec 14 '12 at 9:56
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.