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.

I have a table like this:

sample table

\documentclass{article}
\usepackage{ctable}
\begin{document}
\ctable
 [caption=Sample]
 {|p{2cm}|c|}
 {}
 {
  \hline
  some multiline (2 or 3 fields) field & need to vertically center this \\ \hline
  one more field & and this \\ \hline
 }
\end{document}

I want cells at the second column to be vertically center aligned. Which is the simplest and best method?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Use an m{2in} column type rather than p{2in} (which centres its contents vertically). This is provided by the array package, already loaded by ctable:

\ctable
 [caption=Sample]
 {|m{2cm}|c|}

Alternatively, the multirow can also do this:

enter image description here

\documentclass{article}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{multirow}% http://ctan.org/pkg/multirow
\begin{document}
\ctable
 [caption=Sample]
 {|p{2cm}|c|}
 {}
 {
  \hline
  some multiline (2 or 3 fields) field & \multirow{3}*{need to vertically center this} \\ \hline
  one more field & \multirow{2}*{and this} \\ \hline
 }
\end{document}
share|improve this answer
    
Thanks, m{2cm} works perfect! –  Drakmail May 31 '12 at 17:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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