Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
Not related to your question, but check out the booktabs package and the discussion regarding vertical lines in its manual. –  You Jan 8 '13 at 0: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 8 '13 at 0:05
add comment

marked as duplicate by hpesoj626, Kurt, Werner, Guido, lockstep Jan 8 '13 at 6:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
add comment