makecell 內垂直均勻分佈的線條

makecell 內垂直均勻分佈的線條

我有一張帶有旋轉標題的表格,然後還有一些表格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} 

在此輸入影像描述

相關內容