如上图所示,当我使用命令 \rotatebox{90} 旋转表格时,表格的标题不会旋转。如何让标题随表格旋转?请注意,下面的 MWE 并不包含整个表格。
documentclass[12pt]{report}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{booktabs}
\usepackage{rotating}
\begin{document}
\begin{table}[htbp]
\centering
\caption{17 oldest associations of the Zurich gymnastics organization 1871 - 1911}
\tiny
\rotatebox{90}{ \begin{tabular}{lccc|ccccc|cc|cc}
\hline
\textbf{} & \multicolumn{3}{c|}{\textbf{1871}} & \multicolumn{5}{c|}{\textbf{1886}} & \multicolumn{2}{c|}{\textbf{1907}} & \multicolumn{2}{c}{\textbf{1911}} \bigstrut\\
\hline
Association & Active & Passive & Total & Active & Passive & Honorary & Mitturner & Total & Active & Total & Active & Total \bigstrut\\
\hline
Total & 556 & 89 & \multicolumn{1}{c}{645} & 507 & 519 & 284 & 19 & \multicolumn{1}{c}{1'329} & 675 & \multicolumn{1}{c}{4'246} & 729 & 5'101 \bigstrut\\
\hline
\end{tabular}
}%
\label{tab:addlabel}%
\end{table}%
\end{document}
答案1
由于您已经加载了rotating
包,因此您可以使用该包的sidewaystable
环境而不是基本table
环境。请确保不是\rotatebox
除了使用环境之外还要使用宏sidewaystable
。
我还建议您省略所有垂直线并使用包的规则绘制命令booktabs
来获得间距良好的水平线。
\documentclass[12pt]{report}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{caption}
\begin{document}
\begin{sidewaystable}
\footnotesize
\centering
\caption{17 oldest associations of the Zurich gymnastics organization, 1871--1911} \label{tab:addlabel}%
\begin{tabular}{@{} lccc ccccc cc cc @{}}
\toprule
Association
& \multicolumn{3}{c}{\textbf{1871}}
& \multicolumn{5}{c}{\textbf{1886}}
& \multicolumn{2}{c}{\textbf{1907}}
& \multicolumn{2}{c}{\textbf{1911}} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-9}
\cmidrule(lr){10-11} \cmidrule(l){12-13}
& Active & Passive & Total & Active & Passive & Honorary
& Mitturner & Total & Active & Total & Active & Total \\
\midrule
Total & 556 & 89 & 645 & 507 & 519 & 284 & 19
& 1'329 & 675 & 4'246 & 729 & 5'101 \\
\bottomrule
\end{tabular}
\end{sidewaystable}%
\end{document}