当行标题为垂直时单元格垂直对齐

当行标题为垂直时单元格垂直对齐

请考虑下表:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c|cc}
\cmidrule{2-3}
 & \textbf{Column 1} & \textbf{Column 2}\\
\midrule
\begin{sideways} \textbf{Row 1} \end{sideways} & \multirow{2}{*}{Text row 1 - 2} & Text row 1\\
\cmidrule{1-1}\cmidrule{3-3}
\begin{sideways} \textbf{Row 2} \end{sideways} &  & Text row 2\\
\midrule
\begin{sideways} \textbf{Row 3} \end{sideways} & Text row 3 & Text row 3\\
\midrule
\end{tabular}
\end{table}
\end{document}

如何使行文本垂直集中?

在此处输入图片描述

答案1

使用这个答案:高度可变的表格单元格中的垂直对齐

并根据bigstruts论点进行调整multirow

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{multirow}

\begin{document}
\begin{table}
  \centering
  \begin{tabular}{c|cc}
    \cmidrule{2-3}
    & \textbf{Column 1} & \textbf{Column 2}\\
    \midrule
    \noindent\parbox[c]{12pt}{\begin{sideways} \textbf{Row 1} \end{sideways}} & \multirow{2}[12]{*}{Text row 1 - 2} & Text row 1\\
    \cmidrule{1-1}\cmidrule{3-3}
    \noindent\parbox[c]{12pt}{\begin{sideways} \textbf{Row 2} \end{sideways}} &  & Text row 2\\
    \midrule
    \noindent\parbox[c]{12pt}{\begin{sideways} \textbf{Row 3} \end{sideways}} & Text row 3 & Text row 3\\
    \midrule
  \end{tabular}
\end{table}

\end{document}

在此处输入图片描述

相关内容