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 want to build a table like this:

enter image description here

I have tried a code but it doesn't work properly:

  \begin{table}[htp]
\caption{The temporal outlier detection accuracy of hourly mean values with respect to the Mos in 2007-09-30}
    \label{tab:todh30}
            \centering
                \footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
Node ID   & \multicolumn{2}{c|}{Density-based} & \multicolumn{2}{c|}{Mahalanobis distance-based}    & \multicolumn{2}{c|}{Running average-based} \\ 
    & DR\%  &  FPR\%     & DR\%  &  FPR\%      & DR\%  &  FPR\% \\ \hline
25   & 100    & 14            & 100    & 14           & 66   & 20      \\ \hline

    \end{tabular}
\end{table}
share|improve this question
1  
You got too many `\\`. –  Yiannis Lazarides Jan 25 '13 at 1:05
    
@YiannisLazarides, I have tried the code by omitting the two first "\\" of each row. Still it doesn't appear properly. –  ali amidi Jan 25 '13 at 1:16
    
Please post a minimal with only one line of data with corrections. –  Yiannis Lazarides Jan 25 '13 at 1:17
    
@YiannisLazarides The question is updated. –  ali amidi Jan 25 '13 at 1:20
    
@HarishKumar It is updated, but there is problem with first row. –  ali amidi Jan 25 '13 at 1:25
show 1 more comment

closed as too localized by doncherry, Werner, Guido, T. Verron, Stefan Kottwitz Feb 1 '13 at 7:04

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

You had too many mistakes with \\, \cline and \hline try this:

\documentclass{article}
\begin{document}
\begin{table}[htp]
  \centering
  \footnotesize\setlength{\tabcolsep}{2.5pt}
  \renewcommand*{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
Node ID   & \multicolumn{2}{c|}{Density-based} & \multicolumn{2}{c|}{Mahalanobis distance-based}    & \multicolumn{2}{c|}{Running average-based} \\ 
\cline{2-7} 
     & DR\%   &  FPR\%      & DR\%   &  FPR\%     & DR\%   &  FPR\% \\ \hline 
25   & 100    & 71          & 100    & 71         & 100    & 60      \\ \hline
    \end{tabular}
\end{table}
\end{document}

Also it is always easier to post a full MWe including documentclass etc, as I did.

share|improve this answer
    
The line below the running average and Mahalanobis-distance and Density-based is missed. –  ali amidi Jan 25 '13 at 1:42
    
Prints fine on my computer. Try adding some more data and getting a bit more familiar with tables. –  Yiannis Lazarides Jan 25 '13 at 1:52
    
I have updated the question, and new problem. –  ali amidi Jan 25 '13 at 2:20
add comment

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