我有一张带有旋转标题的表格,之后还有一些内容makecells
以使旋转的标题适合一行:
\documentclass{article}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}
\renewcommand\theadfont{\normalsize}
\begin{document}
\begin{table}[t]
\centering
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{\textbf{Condition A}} \\
& & A1 & A2 \\
\cmidrule{3-4}
\settowidth\rotheadsize{\theadfont \textbf{Condition B}}
\rothead{\textbf{Sampling}} & \makecell{B1 \\ B2} & \makecell{xx/xx \\ xx/xx} & \makecell{xx/xx \\ xx/xx} \\
\bottomrule
\end{tabular}
\caption{Results under different conditions}
\end{table}
\end{document}
我希望makecells
单元格中的文本垂直间距均匀,而不是居中。有没有简单的方法可以做到这一点?
答案1
如果我很清楚你想要什么,那么\rotatebox[origin=c]
可以这样做:
\documentclass{article}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}
\renewcommand\theadfont{\normalsize}
\begin{document}
\begin{table}[t]
\centering
\renewcommand{\cellset}{\renewcommand{\arraystretch}{1.6}}
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{\textbf{Condition A}} \\
& & A1 & A2 \\
\cmidrule{3-4}
\rotatebox[origin=c]{90}{\textbf{Sampling}} & \makecell{B1 \\ B2} & \makecell{xx/xx \\ xx/xx} & \makecell{xx/xx \\ xx/xx} \\
\bottomrule
\end{tabular}
\caption{Results under different conditions}
\end{table}
\end{document}