[Tex/LaTex] Multi-column problem

horizontal alignmentmulticolumntables

Consider the following table. First I have troubles to get the multicolumn-elements in the first row of the table limited to a maximum width (I tried it here with the command C{0.75} but obviously it does not work). The second issue: I would like to have the column-pair "orig." and "norm." centered to each of its multicolumn-elements.

\documentclass{article}
\usepackage{multirow}
\usepackage[ngerman]{babel}
\usepackage{booktabs}
\usepackage{colortbl}

\definecolor{LightGray}{gray}{.8}


\begin{document}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}


\begin{table}[htbp]
   \centering
   \begin{tabular}{C{1.7cm}C{0.75cm}C{0.75cm}C{0.75cm}C{0.75cm}C{0.75cm}C{0.75cm}C{0.75cm}}

      \toprule
    &
    \multicolumn{2}{c}{This is a long text for two rows} &
    \multicolumn{2}{c}{This is a long text for three rows} &
    \multicolumn{2}{c}{This is a long Text} \\

    \multirow{-2}{*}{Row 1} &
    org. & norm. &
    org. & norm. &
    org. & norm. &
    \multirow{-2}{*}{Result}\\

     \midrule

    1   &   0   &   0   &   1   &   0.14    &   7360    &   1   &   0.58    \\
    2   &   0.42    &   0.97    &   7   &   1   &   3420    &   0.46    &   0.85    \\
    3   &   0.42    &   0.97    &   7   &   1   &   3420    &   0.46    &   0.85    \\
    4   &   0.42    &   0.98    &   6   &   0.86    &   3610    &   0.49    &   0.80    \\
    5   &   0.43    &   0.99    &   6   &   0.86    &   4100    &   0.56    &   0.82    \\
    6   &   0.36    &   0.83    &   5   &   0.71    &   4280    &   0.58    &   0.71    \\
    7   &   0.36    &   0.83    &   5   &   0.71    &   4520    &   0.61    &   0.73    \\
    8   &   0.43    &   1   &   6   &   0.86    &   4000    &   0.54    &   0.82    \\
    9   &   0.27    &   0.63    &   3   &   0.43    &   3920    &   0.53    &   0.54    \\
    10  &   0.32    &   0.74    &   5   &   0.71    &   100 &   0.01    &   0.59    \\

      \bottomrule

   \end{tabular}
   \caption{caption}
   \label{tab:Example}
\end{table}

\end{document}

Best Answer

I'm not entirely sure I understood your question (in part because there are some references to rows that may actually be columns). Notice that I've chosen to dispense with the \multirow statements as they result in their arguments being place in somewhat odd locations (in my view, that is). I've also added some \cmidrule instructions in the header area of the table. Anyway, here's what I've come up with:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{multirow,booktabs,colortbl,tabularx}
\definecolor{LightGray}{gray}{.8}


\begin{document}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\begin{table}[htbp]
\centering
   \begin{tabular}{C{1.7cm} *{7}{C{0.75cm}} }
\toprule
    Column 1 &
    \multicolumn{2}{p{2cm}}{This is a long text for two columns} &
    \multicolumn{3}{p{3cm}}{This is a long text for three columns} &
    This is a long text & 
    Result\\
\cmidrule(lr){2-3} \cmidrule(lr){4-6} \cmidrule(lr){7-7}
    &
    org. & norm. &
    org. & norm. &
    org. & norm. &\\
\midrule
  1   &   0   &   0   &   1   &   0.14        & 7360  &   1   &   0.58    \\        
  2   &   0.42    &   0.97    &   7   &   1   & 3420  & 0.46  &   0.85    \\        
  3   &   0.42    &   0.97    &   7   &   1   & 3420  & 0.46  &   0.85    \\         
  4   &   0.42    &   0.98    &   6   & 0.86  & 3610  & 0.49  &   0.80    \\        
  5   &   0.43    &   0.99    &   6   & 0.86  & 4100  & 0.56  &   0.82    \\        
  6   &   0.36    &   0.83    &   5   & 0.71  & 4280  & 0.58  &   0.71    \\        
  7   &   0.36    &   0.83    &   5   & 0.71  & 4520  & 0.61  &   0.73    \\        
  8   &   0.43    &   1   &   6   &   0.86    & 4000  & 0.54  &   0.82    \\        
  9   &   0.27    &   0.63    &   3   & 0.43  & 3920  & 0.53  &   0.54    \\        
  10  &   0.32    &   0.74    &   5   & 0.71  &  100  & 0.01  &   0.59    \\    
\bottomrule
\end{tabular}
   \caption{caption}
   \label{tab:Example}
\end{table}

\end{document}

enter image description here

Related Question