![垂直对齐表格中的旋转文本](https://linux22.com/image/338100/%E5%9E%82%E7%9B%B4%E5%AF%B9%E9%BD%90%E8%A1%A8%E6%A0%BC%E4%B8%AD%E7%9A%84%E6%97%8B%E8%BD%AC%E6%96%87%E6%9C%AC.png)
我有下表(请参阅下面的工作示例代码)。第 5 列有两个单元格包含一些旋转的文本。我希望此旋转的文本居中或对齐在单元格底部,而不是向上移动。我查看了论坛中的示例,但到目前为止找不到解决方案。有什么提示吗?谢谢。
\begin{table}\caption{ bababalbablab}
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}p{0.25cm}}
\multicolumn{1}{c}{\bf{XXX}} & \multicolumn{3}{c}{\bf{XXX}} & \\
\emph{Monday} & \emph{Monday} & \emph{Monday} & \emph{Monday} & \emph{Tuesday} \\
{\bf July} (i.e. Monday, tuesday thursday) & {\bf August} (i.e. Tuesday Saturday Sunday) & {\bf September} (i.e. Sunday sunday sunday)& {\bf October} (i.e. Wednesday Wednesday Wednesday )& {\rotatebox{90}{\emph {December}}} \\
{\bf February} (i.e. Sunday Sunday Sunday Sunday )& {\bf January } (i.e. Friday Friday Friday)& {\bf March} (i.e. Thursday Thursday Thursday) & {\bf November} (i.e. Tuesday Tuesday Tuesday ) & {\rotatebox[origin=l]{90}{\emph {December}}} \\
\hline
\end{tabular}
\end{table}
答案1
使用方便的\raisebox
,您可以使旋转的文本垂直居中。请不要使用已弃用的\bf
。使用\bfseries
或\textbf{…}
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{tabularx, booktabs, rotating, caption}
\begin{document}
\begin{table}
\caption{ bababalbablab}
\setlength{\extrarowheight}{.5ex}
\begin{tabularx}{\linewidth}{*{4}{>{\raggedright\arraybackslash}X}c}%>{\raggedright\arraybackslash}p{3cm}|}
\toprule
\multicolumn{1}{c}{\bf{XXX}} & \multicolumn{3}{c}{\bf{XXX}} \\
\cmidrule(lr){1-1}\cmidrule(lr){2-4}
\emph{Monday} & \emph{Monday} & \emph{Monday} & \emph{Monday} & \emph{Tuesday} \\
%
\textbf{July} (i.e. Monday, Tuesday Thursday) & \textbf{August} (i.e. Tuesday Saturday Sunday) & \textbf{September} (i.e. Sunday Sunday Sunday)%
& \textbf{October} (i.e. Wednesday Wednesday Wednesday)& \raisebox{-0.85\height}{\rotatebox{90}{{\emph {December}}}}
\\\addlinespace
\textbf{February} (i.e. Sunday Sunday Sunday Sunday )& \textbf{January} (i.e. Friday Friday Friday)& \textbf{March} (i.e. Thursday Thursday Thursday) %
& \textbf{November} (i.e. Tuesday Tuesday Tuesday) & \raisebox{-0.85\height }{\rotatebox[origin=l]{90}{\emph {December}}} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}