旋转多行文本

旋转多行文本

我正在尝试构建一个基本表格,并想出了以下代码。我的问题是旋转后的框排列得很奇怪: 在此处输入图片描述

理想情况下,所有小的旋转框都应左右居中,跨行旋转框应左右居中。我尝试将 origin=c 与 rotatebox 一起使用,但没有任何变化。

\begin{table}
\begin{tabularx}{\textwidth}{X|X|X|X|X|X|X}
\multirow{2}{*}{\rotatebox[]{90}{Tool}} & \multicolumn{2}{c|}{\makecell{Usability,\\ Consistency,\\Reuse}} & \multicolumn{3}{c|}{Support for \ac{UCSD}} & \multirow{2}{*}{\rotatebox[]{90}{\makecell{Structured\\Storage}}} \\
& \rotatebox[origin=c]{90}{\makecell{Shape\\Recognition}} & \rotatebox[origin=c]{90}{\makecell{Similarity\\Search}} & \rotatebox[origin=c]{90}{\makecell{Real-Time\\Collaboration}} & \rotatebox[origin=c]{90}{\makecell{Low- \& High\\Fidelity\\Prototypes}} & \rotatebox[origin=c]{90}{\makecell{Interactive\\Testing}} & \\ \hline
\end{tabularx}

\caption{Comparison}
\label{tab:existing_tools}
\end{table}

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{rotating}
\usepackage{makecell, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
    \begin{table}
    \settowidth\rotheadsize{Recogniti}
\begin{tabularx}{\textwidth}{C|C|C|C|C|C|C}
    & \multicolumn{2}{c|}{\makecell[b]{Usability,\\ Consistency,\\Reuse}}
        & \multicolumn{3}{c|}{Support for UCSD}
            &                                           \\
\rothead{Tool}
    & \rothead{Shape\\Recognition}
        & \rothead{Similarity\\Search}
            & \rothead{Real-Time\\Collaboration}
                & \rothead{Low- \& High\\Fidelity\\Prototypes}
                    & \rothead{Interactive\\Testing}
                        & \rothead{Structured\\Storage} \\
    \hline
\end{tabularx}

\caption{Comparison}
\label{tab:existing_tools}
\end{table}
\end{document}

相关内容