3

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?

6

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}

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.