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 ?
Asked
Active
Viewed 791 times
0
rose
- 347
- 1
- 3
- 9
1 Answers
1
How about:
\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}
-
-
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
-
1In my view, all those extra lines simply create clutter and thus actually make it harder to find the two crucial parts, which are the
\multirowinstructions. – Mico Jul 24 '14 at 13:58 -
-
1Much 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
multirowpackage is done for that. It may require some adjustment. – Bernard Jul 24 '14 at 13:02