使用横向时如何使表格单元格内容垂直居中?

使用横向时如何使表格单元格内容垂直居中?

我有下表:

\documentclass{article}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage{rotating}

\begin{document}


\begin{table}[htbp]
\begin{adjustbox}{width=\textwidth,totalheight=\textheight,keepaspectratio}
\begin{tabular}{| c | l | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c |}
\hline
A & B & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16\tabularnewline
\hline
\multirow{2}{*}{\begin{sideways}EFGH\end{sideways}} & abaadfgd & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgdfgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgfdagdfgdfg & & & & & & & & & & & & & & & &\tabularnewline
\hline
\multirow{2}{*}{\begin{sideways}XYZ\end{sideways}} & dagdgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& adfgadgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& adfgfadgdafg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgdagdfgdg & & & & & & & & & & & & & & & &\tabularnewline
\hline
\end{tabular}
\end{adjustbox}
\end{table}

\end{document}

这会生成如下表格:

在此处输入图片描述

我想将文本垂直居中在第一列,但我无法做到。我该怎么做?

答案1

使用正确的行数\multirow

\documentclass{article}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{adjustbox}

\begin{document}
\begin{adjustbox}{width=\textwidth,totalheight=\textheight,keepaspectratio}
\begin{tabular}{| c | l | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c |}
\hline
A & B & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16\tabularnewline
\hline
\multirow{3}{*}{\rotatebox{90}{\kern-0.3em EFGH}} & abaadfgd & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgdfgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgfdagdfgdfg & & & & & & & & & & & & & & & &\tabularnewline
\hline
\multirow{4}{*}{\rotatebox{90}{\kern-0.3em XYZ}} & dagdgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& adfgadgadg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& adfgfadgdafg & & & & & & & & & & & & & & & &\tabularnewline
\cline{2-18}
& afgdagdfgdg & & & & & & & & & & & & & & & &\tabularnewline
\hline
\end{tabular}
\end{adjustbox}

\end{document}

在此处输入图片描述

相关内容