【问题标题】:How to vertically center text in multirow in table [closed]如何在表格的多行中垂直居中文本[关闭]
【发布时间】:2016-11-10 02:41:20
【问题描述】:

我正在尝试将“测试”垂直居中在第一列中,该列是表格的多行。代码如下:

\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}

任何想法都可以做到这一点。

【问题讨论】:

    标签: latex multirow


    【解决方案1】:

    test 应该跨越 5 行,而不是 4;包含 12 的行跨越两行,您应该在 \multirow 语句中容纳它们:

    \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}
    

    【讨论】:

      猜你喜欢
      • 2015-09-10
      • 1970-01-01
      • 2015-02-25
      • 2016-09-19
      • 1970-01-01
      • 2013-10-15
      • 2018-05-26
      • 2011-02-15
      • 1970-01-01
      相关资源
      最近更新 更多