禁忌环境中的多行、多列和垂直居中

禁忌环境中的多行、多列和垂直居中

我有一张使用tabu环境的表格,其中我想要多行和多列单元格。在单元格内,任何未垂直填充单元格的内容都应垂直居中。

但是,我似乎无法让它表现得合理——一切看起来都有些混乱和不舒服,而且一些文本溢出了单元格边界。

我尝试X[-1,m]对列描述符中的每一列都使用它,但没有成功。

\documentclass{article}

\usepackage{tabu}
\usepackage{multirow}

\begin{document}
    \begin{table}
        \centering
        \caption{Recommendations for treatment }

        \begin{tabu} {X[-1]|X[-1]|X[-1]|X}
            \hline
            T1 & \multicolumn{2}{l|}{N0}  & Radiotherapy or surgery to the primary tumour.\\
            \cline{2-4}
            & N+ & $ <2{cm}$ & Radiotherapy or surgery to the primary tumour and neck.\\
            \cline{3-4}
            &  & $ >2{cm}$ & Radiotherapy or surgery to the primary tumour. Surgery to neck.\\
            \cline{1-4}
            T2 & \multicolumn{2}{l|}{N0}  &  \multirow{3}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\
            \cline{2-3}
            & N+ & $ <2{cm}$ & \\
            \cline{3-4}
            &  & $ >2{cm}$ & Surgery to the primary tumour and neck.\\
            \cline{1-4}
            T3 & \multicolumn{2}{l|}{N0}  & \multirow{3}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\
            \cline{2-3}
            & N+ & $ <2{cm}$ & \\
            \cline{3-4}
            &  & $ >2{cm}$ & Surgery to the primary tumour and neck. Postoperative radiotherapy in selected cases.\\
            \cline{1-4}
            T4 & \multicolumn{2}{l|}{N0} & \multirow{3}{*}{\vbox{Surgery to the primary tumour and neck with planned postoperative radiotherapy to primary site, and to neck if indicated.}}\\
            \cline{2-3}
            & N+ & $ <2 {cm}$ & \\
            & & $>2 {cm}$ &\\
            \hline
        \end{tabu}
    \end{table}

\end{document}

结果是:

上述代码的结果

在环境中实现这种结果的“正确”方法是什么tabu?或者我应该使用不同的环境?

答案1

有一种可能性是,tabu我用的是tabularx包;我将最后一列设置为\RaggedRight来自ragged2e包;为了改善垂直间距,我还重新定义了\arraystretch。对于某些单元格,第二个可选参数\multirow用于微调位置:

\documentclass{article}
\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{multirow}

\begin{document}

\begin{table}
\centering
\caption{Recommendations for treatment}
\renewcommand\arraystretch{1.4}
\begin{tabularx}{\textwidth} {l|l|l|>{\RaggedRight}X}
            \hline
            \multirow{5}{*}[-1ex]{T1} & \multicolumn{2}{l|}{N0}  & Radiotherapy or surgery to the primary tumour.\\
            \cline{2-4}
            & \multirow{3}{*}[-1ex]{N+} & $ <2{cm}$ & Radiotherapy or surgery to the primary tumour and neck.\\
            \cline{3-4}
            &  & $ >2{cm}$ & Radiotherapy or surgery to the primary tumour. Surgery to neck.\\
            \cline{1-4}
            \multirow{3}{*}[-2ex]{T2} & \multicolumn{2}{l|}{N0}  &  \multirow{2}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\
            \cline{2-3}
            & \multirow{2}{*}{N+} & $ <2{cm}$ & \\
            \cline{3-4}
            &  & $ >2{cm}$ & Surgery to the primary tumour and neck.\\
            \cline{1-4}
            \multirow{4}{*}[-2ex]{T3} & \multicolumn{2}{l|}{N0}  & \multirow{2}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\
            \cline{2-3}
            & \multirow{3}{*}{N+} & $ <2{cm}$ & \\
            \cline{3-4}
            &  & $ >2{cm}$ & Surgery to the primary tumour and neck. Postoperative radiotherapy in selected cases.\\
            \cline{1-4}
            \multirow{3}{*}[-2ex]{T4} & \multicolumn{2}{l|}{N0} & \multirow{3}{*}{\vbox{Surgery to the primary tumour and neck with planned postoperative radiotherapy to primary site, and to neck if indicated.}}\\
            \cline{2-3}
            & \multirow{2}{*}{N+} & $ <2 {cm}$ & \\
            & & $>2 {cm}$ &\\
            \hline
        \end{tabularx}
\end{table}

\end{document}

在此处输入图片描述

相关内容