# Evenly vertically spaced lines inside makecell

I have a table with a rotated header, and some makecells afterwards to fit the rotated header on one line:

\documentclass{article}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}

\begin{document}
\begin{table}[t]
\centering
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{\textbf{Condition A}} \\
& & A1 & A2 \\
\cmidrule{3-4}
\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}


I'd like the text in the makecells to be evenly vertically spaced in the cell, rather then centred in the middle. Is there an easy way to do this?

• What do you mean with ‘vertically distributed’? – Bernard Mar 18 '19 at 14:34
• As in, so they fill the cell with the same amount of space above, between and below the two lines of text rather than being clustered in the center. – Kris Mar 18 '19 at 14:46

If I've well understood what you want, \rotatebox[origin=c] does the job:

\documentclass{article}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}

\begin{document}

\begin{table}[t]
\centering
\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}


• Ah, sorry, I meant I wanted the lines B1 // B2 etc to be evenly spaced inside the box created by the rotatebox. – Kris Mar 18 '19 at 14:57
• @Kris: I've updated my code. The value of \arraystretch was found by trial and error (so you can't change it within the same table). – Bernard Mar 18 '19 at 15:08