Creating special table [duplicate]

How can I create a table such as following: I do not know how can I have A and B in the middle of four rows ?

marked as duplicate by Paul Gessler, user31729, Thorsten, barbara beeton, MicoJul 24 '14 at 13:46

\usepackage{multirow}
\begin{document}

\begin{table}[h]
\begin{tabular}{|l|l|l|l|l|}
\hline
X                  & xx & x & x & x \\ \hline
\multirow{4}{*}{A} & x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \hline
\multirow{4}{*}{B} & x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \cline{2-5}
& x  & x & x & x \\ \hline
\end{tabular}
\end{table}

\end{document}


Edit: If you don't like the lines:

\begin{table}[h]
\begin{tabular}{lllll}
X                  & xx & x & x & x \\ \hline
\multirow{4}{*}{A} & x  & x & x & x \\
& x  & x & x & x \\
& x  & x & x & x \\
& x  & x & x & x \\[1ex]
\multirow{4}{*}{B} & x  & x & x & x \\
& x  & x & x & x \\
& x  & x & x & x \\
& x  & x & x & x
\end{tabular}
\end{table}

• Is the OP asking for all those horizontal and vertical lines? – Mico Jul 24 '14 at 13:45
• Well, they can be very easily removed from the code provided (see my edit above). I thought the focus of the question was more about having "A and B in the middle of four rows". – roschu Jul 24 '14 at 13:56
• In my view, all those extra lines simply create clutter and thus actually make it harder to find the two crucial parts, which are the \multirow instructions. – Mico Jul 24 '14 at 13:58
• Check my edit above. – roschu Jul 24 '14 at 13:59
• Much better... :-) I've taken the liberty of editing your second example to make it approximate the OP's sketch more closely. – Mico Jul 24 '14 at 13:59