2

Possible Duplicate:
How to vertically-center the text of the cells?

I am using multicolumn to create a table. The code that I have is here:

   \documentclass[10pt]{article} 
    \usepackage{multicol}
    \begin{document}
     \begin{table}
       \centering
      \begin{tabular}{|c|c|c|}
       \hline
       \multicolumn{2}{|c|}{Data A} & Data B \\\cline{1-2}
       Set A1 & Set A2 &  
       \\\hline
       a & b & c \\
       \hline
       \end{tabular}
       \caption{List of test cases.}
       \label{tab:Tests}
     \end{table}
\end{document}

This results in a table where the entry 'Data B' is aligned with the top hline of the table as in this.

I would like to know how I can vertically center the entry ''Data B''. Any ideas would help a lot!

David Carlisle
  • 757,742
  • Not related to your question, but check out the booktabs package and the discussion regarding vertical lines in its manual. – You Jan 08 '13 at 00:04
  • You are loading but not using the multicol package in your MWE (it is unrelated to tables and is for making multi-column pages) the \multicolumn command doesn't require a package. – David Carlisle Jan 08 '13 at 00:05

1 Answers1

2

Use multirow.

   \documentclass[10pt]{article} 
    \usepackage{multirow}
    \begin{document}
     \begin{table}
       \centering
      \begin{tabular}{|c|c|c|}
       \hline
       \multicolumn{2}{|c|}{Data A} & \multirow{2}{*}{Data B} \\\cline{1-2}
       Set A1 & Set A2 &  
       \\\hline
       a & b & c \\
       \hline
       \end{tabular}
       \caption{List of test cases.}
       \label{tab:Tests}
     \end{table}
\end{document}

enter image description here

David Carlisle
  • 757,742