![makecell 內垂直均勻分佈的線條](https://rvso.com/image/392342/makecell%20%E5%85%A7%E5%9E%82%E7%9B%B4%E5%9D%87%E5%8B%BB%E5%88%86%E4%BD%88%E7%9A%84%E7%B7%9A%E6%A2%9D.png)
我有一張帶有旋轉標題的表格,然後還有一些表格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}