表格中使用多行竖排文本

表格中使用多行竖排文本

我想在 AE 中使用垂直文本(见图)。我尝试使用多行命令,但不知何故它不起作用"\multirow{2}{*}{\RotText{标准}}"。 我究竟做错了什么??

\documentclass[twocolumn]{article}
\usepackage{tabularx}
\usepackage{array}
\usepackage{rotating}
\usepackage{lipsum}

\renewcommand\tabularxcolumn[1]{>{\small}m{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\newcommand\RotText[1]{\rotatebox{90}{\parbox{3.5cm}{\centering#1}}}

%\newlength{\arrayrulewidthOriginal}
\newcommand{\Cline}[2]{%
\noalign{\global\setlength{\arrayrulewidthOriginal}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\global\setlength{\arrayrulewidth}{\arrayrulewidthOriginal}}}

\begin{document}

{
\setlength\tabcolsep{1pt}
\begin{tabularx}{\columnwidth}{|Y|l|Y|Y|Y|Y|Y|Y|Y|Y|Y|}
\cline{3-9}
\multicolumn{1}{c}{}& & &\multicolumn{6}{c|}{text}\\
\cline{4-9}
\multicolumn{1}{c}{} & & &
\multicolumn{3}{c|}{text}  & 
\multicolumn{3}{c|}{text} \\
\cline{4-9}

\multicolumn{1}{c}{}&
\multicolumn{1}{c|}{} & 
\RotText{some text} &
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text}  \\ \hline
%\noalign{\hrule height 1pt}


 \RotText{Text across A-E} & A & 21 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
& B & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
& C & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
& D & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
& E & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
\end{tabularx}
}

\end{document}

在此处输入图片描述

答案1

代码如下:

\documentclass[twocolumn]{article}
\usepackage{tabularx}
\usepackage{array}
\usepackage{rotating}
\usepackage{lipsum}
\usepackage{multirow}
\renewcommand\tabularxcolumn[1]{>{\small}m{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\newcommand\RotText[1]{\rotatebox{90}{\parbox{3.5cm}{\centering#1}}}

%\newlength{\arrayrulewidthOriginal}
\newcommand{\Cline}[2]{%
\noalign{\global\setlength{\arrayrulewidthOriginal}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\global\setlength{\arrayrulewidth}{\arrayrulewidthOriginal}}}

\begin{document}

{
\setlength\tabcolsep{1pt}
\setlength\extrarowheight{1.8pt} %new code
\begin{tabularx}{\columnwidth}{|Y|l|Y|Y|Y|Y|Y|Y|Y|Y|Y|}
\cline{3-9}
\multicolumn{1}{c}{}& & &\multicolumn{6}{c|}{text}\\
\cline{4-9}
\multicolumn{1}{c}{} & & &
\multicolumn{3}{c|}{text}  & 
\multicolumn{3}{c|}{text} \\
\cline{4-9}

\multicolumn{1}{c}{}&
\multicolumn{1}{c|}{} & 
\RotText{some text} &
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text} & 
\RotText{Some really long text}  \\ \hline
%\noalign{\hrule height 1pt}


 \multirow{-2}{*}{\RotText{Text across A-E}} & A & 21 & 11 & 44 & 11 & 54 & 34 & 54 \\ \cline{2-9}
& B & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \cline{2-9}
& C & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \cline{2-9}
& D & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \cline{2-9}
& E & 11 & 11 & 44 & 11 & 54 & 34 & 54 \\ \hline
\end{tabularx}
}

\end{document}

在此处输入图片描述

我增加了一些额外的行高,因为文本对于可用空间来说太长了。如果你的实际文本较短,你可以删除额外的行高

相关内容