2

I'm getting some little problems when using \multirow:

Here is my code:

\documentclass[a4paper,10pt]{article} % Default font size and paper size
\usepackage{multirow}
\begin{document}
\begin{tabular}{ |l| c| c| } \hline
  \textbf{1} & \textbf{2} & \textbf{3} \\ \hline
  \multirow{4}{*}{A} & 1 & 1 \\
   & 2 & 2 \\
   & 3 & 3 \\ \hline
   \multirow{4}{*}{B}  & 1 & 1 \\
      & 2 & 2 \\
     \hline
\end{tabular} 
\end{document}

Here is the preview:

enter image description here

Problems:

  1. As you can see, in cell (2,1), the B is not properly positioned in the middle of the cell
  2. How is it possible to separate only multirows in Row 1?
  • 5
    The first argument to \multirow is the number of rows spanned: it should be 3 in the first case, 2 in the second case. The second question is not clear. – egreg Oct 27 '13 at 13:28
  • I just want an \hline between all rows in Column 2 and 3 – Noor Oct 27 '13 at 14:04
3

You probably want an output like this:

enter image description here

MWE:

\documentclass[a4paper,10pt]{article} % Default font size and paper size
\usepackage{multirow}
\begin{document}
\begin{tabular}{|l|c|c|} \hline
  \textbf{1} & \textbf{2} & \textbf{3} \\ \hline
  \multirow{3}{*}{A} & 1 & 1 \\ \cline{2-3}
   & 2 & 2 \\ \cline{2-3}
   & 3 & 3 \\ \hline
  \multirow{2}{*}{B} & 1 & 1 \\ \cline{2-3}
  & 2 & 2 \\ \hline
\end{tabular}
\end{document}
  1. Use the right number of rows when using \multirow.
  2. Use \cline{<start column>-<end column>} to get partial horizontal lines.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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