[Tex/LaTex] latex table, divide a column in two columns with multi-row option

multirowtables

I want to create multi-row tables. Here is the baseline table.

documentclass[prodmode,acmtecs]{acmsmall} % Aptara syntax
\usepackage[ruled]{algorithm2e}
\usepackage{multirow}

\begin{document}
\section{Introduction}

\begin{table}[!t]
    \tbl{The caption.\label{cap}}
    {\begin{tabular}{p{2.0cm}p{3.0cm}p{3.5cm}p{1.0cm}p{0.8cm}p{0.8cm}}
        \hline
        \textbf{Workload}   &  \textbf{Description}   &   \textbf{Input}   &   \textbf{Miss Ratio}   &    \textbf{MPKI}    &   \textbf{LPKI} \\
        \hline
           A  &  B  &  C  &  1  &  2  &  3 \\
        \hline
           D  &  E  &  F  &  4  &  5  &  6  \\
        \hline
           G  &  H  &  I  &  7  &  8  &  9 \\
        \hline
           J  &  K  &  L  &  10 &  11 &  12  \\
        \hline
           M  &  N  &  O  &  13 &  14 &  15  \\
        \hline
           P  &  Q  &  R  &  16 &  17 &  18  \\
        \hline\hline
           S  &  T  &  U  &  19 &  20 &  21 \\
        \hline
           V  &  W  &  X  &  22 &  23 &  24  \\
        \hline
           Y  &  Z  & AA  &  25 &  26 &  27 \\
        \hline
          AB  & AC  & AD  &  28 &  28 &  29 \\
        \hline
          AE  & AF  & AG  &  30 &  31 &  32  \\
        \hline
          AH  & AI  & AJ  &  33 &  34 &  35 \\
        \hline\hline
          AK  & AL  & AM  &  36 &  37 &  38  \\
        \hline
          AN  & AO  & AP  &  39 &  40 & 41 \\
        \hline
    \end{tabular}}
\end{table}

\medskip
\end{document}

The output is

enter image description here

Now I want to divide the workload column into two columns. SOmething like this

 +-----------------+---- 
 |     workload    
 +----------+-----------
 |          |  A   
 |          |  D   
 |  group1  |  G   
 |          |  J   
 |          |  M   
 |          |  P   
 -----------------------
 -----------------------
 |          |  S   
 |          |  V   
 |  group2  |  Y   
 |          |  AB   
 |          |  AE  
 |          |  AH   
 -----------------------
 -----------------------
 |          |  AK   
 | group3   |  AN   
 -----------------------  

So I added another column on the tabular line by increasing 6{}p to 7p{} and added these lines

 \multirow{6}{*}{group1}  &  A   &    B  &  C   &   1  &    2  &   3 \\
  ...
 \multirow{6}{*}{group2}  &  S   &   T   &  U   &  19  &   20  & 21 \\
  ...
 \multirow{2}{*}{group3}  &  AK  &   AL  & AM   &  36  &   37  &  38  \\

But the result is far beyond expectation. In fact, I don't see any row span!!

UPDATE

After applying the method in the answer and replacing the A, B, … with real text, I see this output

enter image description here

Instead on \addlinespace, I used \hline. As you can see there is a gap between rows in each group.

Best Answer

Horizontal lines should be used to structure the content, but whitespace on the right place can do the same. Have a look at the table, it looks cleaner. Please note the little white space before/after the rules.

enter image description here

Package siunitx helps us here to align the numbers at the decimal mark.

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
{\begin{tabular}{lcccS[table-format=2]S[table-format=2]S[table-format=2]}
        \toprule
    \multicolumn{2}{c}{Workload} & {Description} & {Input} & {Miss Ratio} & {MPKI} & {LPKI} \\
        \midrule
                   & A          & B             & C       & 1            & 2      & 3 \\
                   & D          & E             & F       & 4            & 5      & 6  \\
       group1      & G          & H             & I       & 7            & 8      & 9 \\
                   & J          & K             & L       & 10           & 11     & 12  \\
                   & M          & N             & O       & 13           & 14     & 15  \\
                   & P          & Q             & R       & 16 &               17     & 18  \\\addlinespace[1.3ex]
                   & S          & T             & U       & 19           & 20     & 21 \\
                   & V          & W             & X       & 22           & 23     & 24  \\
        group2     & Y          & Z             & AA      & 25           & 26     & 27 \\
                   & AB         & AC            & AD      & 28           & 28     & 29 \\
                   & AE         & AF            & AG      & 30           & 31     & 32  \\
                   & AH         & AI            & AJ      & 33 &               34     & 35 \\\addlinespace[1.3ex]
         group3    & AK         & AL            & AM      & 36           & 37     & 38  \\
                   & AN         & AO            & AP      & 39           & 40     & 41 \\
           \bottomrule
    \end{tabular}}
\end{document}

I am not quite sure i get the problem. I tried to construct a situation, but without succes. Right now i cannot reproduce the behaviour. Be aware, that multirow always requires manual labor. Please note, that i used \midrules again for their better spacing.

Please consider the following

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{array}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{2.5cm}}
\begin{document}
{\begin{tabular}{lLLLS[table-format=2]S[table-format=2]S[table-format=2]}
        \toprule
    \multicolumn{2}{c}{Workload}                 & {Description}  & {Input} & {Miss Ratio} & {MPKI} & {LPKI} \\
        \midrule \multirow{15}{*}{\rotatebox{90}{group1}}      & Lions are pretty big              & Every lock has its key       & Canada is a country.             & 1      & 2         & 3 \\
                                               & some useful information here              & E       & F            & 4      & 5         & 6  \\
                                               & Why did the duck cross the road?              & H       & I            & 7      & 8         & 9 \\
                                               & There are footprints on your back              & K        & L            & 10     & 11        & 12  \\
                                               & Did the lion eat the zebra?              & N       & O            & 13     & 14        & 15  \\
                                               & There's a cat on the window sill              & Q       & R            & 16     &
           17                                      & 18  \\\midrule
    & Lions are pretty big              & Every lock has its key       & Canada is a country.             & 1      & 2         & 3 \\
                                               & some useful information here              & E       & F            & 4      & 5         & 6  \\
                                               & Why did the duck cross the road?              & H       & I            & 7      & 8         & 9 \\
   group1                                                  & There are footprints on your back              & K        & L            & 10     & 11        & 12  \\
                                               & Did the lion eat the zebra?              & N       & O            & 13     & 14        & 15  \\
                                               & There's a cat on the window sill              & Q       & R            & 16     &
           17                                      & 18  \\\midrule
           \multirow{6}{*}{\rotatebox{90}{group2}} & S              & T       & U            & 19     & 20        & 21 \\
                                               & V              & W       & X            & 22     & 23        & 24  \\
                                               & Y              & Z       & AA           & 25     & 26        & 27 \\
                                               & AB             & AC      & AD           & 28     & 28        & 29 \\
                                               & AE             & AF      & AG           & 30     & 31        & 32  \\
                                               & AH             & AI      & AJ           & 33     &
           34                                      & 35 \\\midrule
    \multirow{2}{*}{group3}                     & AK             & AL      & AM           & 36     & 37        & 38  \\
                                               & AN             & AO      & AP           & 39     & 40        & 41 \\
           \bottomrule
    \end{tabular}}
\end{document}