1

I am trying to vertically center the 'test' in the first column which is a multirow of the table. The code is as following:

\begin{table}[]
\tiny
\caption{a}

\begin{tabular}{|M{0.1in}|p{0.7in}|p{1.4in}|p{2in}|}
  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
   & \textbf{Factor Name} & \textbf{Explanation} & \textbf{Rationale} \\
  \hline
  \multirow{4}{*}{\rotatebox[origin=c]{90}{test}}& body1 &body2 &\multirow{2}{*}{\parbox{2in}{body3}}  \\
  \hhline{~--~}
   & 1 & 2 \newline & \\
     \hhline{~---}
   & 3& 3 & \multirow{2}{*}{5}  \\
     \hhline{~--~}
   & 6 & 7 & \\
   \hhline{----}


   \hline
\end{tabular}
\end{table}

any idea to do this.

Wang Shaowei
  • 115
  • 1
  • 1
  • 9

1 Answers1

3

test should span 5 rows, not 4; the row containing 1 and 2 spans two lines for which you should accommodate in your \multirow statement:

enter image description here

\documentclass{article}

\usepackage{multirow,hhline,graphicx,array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}

\begin{tabular}{|M{0.1in}|p{0.7in}|p{1.4in}|p{2in}|}
  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
   & \textbf{Factor Name} & \textbf{Explanation} & \textbf{Rationale} \\
  \hline
  \multirow{5}{*}{\rotatebox[origin=c]{90}{test}}& body1 &body2 &\multirow{2}{*}{\parbox{2in}{body3}} \\
  \hhline{~--~}
   & 1 & 2 \newline & \\
   \hhline{~---}
   & 3 & 3 & \multirow{2}{*}{5} \\
   \hhline{~--~}
   & 6 & 7 & \\
   \hhline{----}
\end{tabular}

\end{document}
Werner
  • 14,324
  • 7
  • 55
  • 77