减小旋转表格单元格的行距

减小旋转表格单元格的行距

我正在尝试减小旋转表格单元格的行距,以减少表格宽度并使其看起来更美观。此外,“材料”单元格看起来有点拥挤。

现在看起来是这样的:

在此处输入图片描述

这是我的 MWE

\documentclass[11pt, a4paper]{scrbook}

\usepackage[left=27.5mm,right=16mm,top=30mm,bottom=30mm]{geometry}
\usepackage[english,main=ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\usepackage{rotating}
\setlength{\tabcolsep}{2.5pt}
\setlength\rotheadsize{2.65cm}


\begin{document}

\begin{table}
\centering
\begin{tabular}{@{}llcccccccccc@{}}
\toprule
\multicolumn{2}{l}{\textbf{Zustand}} & \multicolumn{6}{c}{fest} & \multicolumn{4}{c}{flüssig} \\
\cmidrule(lr){3-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Form}} & \multicolumn{4}{c}{Pulver} & Strang & Folie & \multicolumn{4}{c}{Flüssigkeit} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-7} \cmidrule(lr){8-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Bindung}} & \multicolumn{3}{c}{Verschmelzen} & Binden & Verschmelzen & Verkleben & Aushärten & \multicolumn{3}{c}{UV-licht} \\
\midrule
\multicolumn{2}{l}{\textbf{Verfahren}} &
\rotcell{Selektives lasersintern} & \rotcell{Selektives Laserschmelzen} & \rotcell{Elektronenstrahlschmelzen} & \rotcell{3D Drucken} & \rotcell{Fused \\ Deposition Modelling} & \rotcell{Laminated \\ Object Manufacturing} & \rotcell{Multi-Jet Modelling} & \rotcell{Stereolithographie} & \rotcell{Poly-Jet Modelling} & \rotcell{Digital Light Processing} \\
\midrule
\multicolumn{2}{l}{\textbf{Abkürzung}} & SLS & SLM & EBM & 3DP & FDM & LOM & MJM & SLA & PJM & DLP \\
\midrule
\multirow[c]{3}{*}{\rotatebox{90}{\textbf{Material}}} & Kunststoff & x &  &  & x & x & x & x & x & x & x \\
\cmidrule(l){2-12}
& Metall &  & x & x & x &  & x &  &  &  & x \\
\cmidrule(l){2-12}
& Keramik &  & x & x & x &  & x &  & x &  & x \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

答案1

这是另一种尝试。 而不是\rotcell,我定义了一个使用嵌套表格的命令,其中包含缩小\arraystretch和字体大小(基于@Heiko Oberdiek 的回答)。编译时\small没有出现过满警告。hbox

在示例 2(更好的示例)中,我设置\tabcolsep0pt,使用tabular*和来@{\extrarowcol{\fill}}均匀分布列之间的距离(基于@Mico 的回答)此外,我删除了对(lr)的调整\cmidrules)以对齐规则。

如果您更喜欢不填满整个的表格\linewidth,则可以使用以下序言:

\begin{tabular*}{0.85\linewidth}{@{\extracolsep{\fill}}ll!{\hspace{6pt}}cccccccccc}

依然不过满hbox

在两个表格中,我在最后三行之间添加了 1 pt 的空间,将\multirow单元格移动到最后一行,并用负数将其升高以实现更好的对齐。

示例 1 - 表格

在此处输入图片描述

\documentclass[11pt, a4paper]{scrbook}

\usepackage[left=27.5mm,right=16mm,top=30mm,bottom=30mm]{geometry}
\usepackage[english,main=ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\usepackage{rotating}
\setlength{\tabcolsep}{2.5pt}
\setlength\rotheadsize{2.65cm}

% Multi-line left-aligned text with manual line breaks.
% The base line of the whole is at the top row.
\newcommand*{\rhead}[1]{%
\begingroup
    \begin{sideways}
    \renewcommand*{\arraystretch}{0.7}%
    \small\begin{tabular}[b]{@{}l@{}}#1\end{tabular}%
  \end{sideways}
  \endgroup
}

\begin{document}

\begin{table}
\centering
\begin{tabular}{@{}llcccccccccc@{}}
\toprule
\multicolumn{2}{l}{\textbf{Zustand}} & \multicolumn{6}{c}{\small fest} & \multicolumn{4}{c}{\small flüssig} \\
\cmidrule(lr){3-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Form}} & \multicolumn{4}{c}{\small Pulver} & \small Strang & \small Folie & \multicolumn{4}{c}{\small Flüssigkeit} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-7} \cmidrule(lr){8-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{\small Bindung}} & \multicolumn{3}{c}{\small Verschmelzen} & \small Binden & \small Verschmelzen & \small Verkleben & \small Aushärten & \multicolumn{3}{c}{\small UV-licht} \\
\midrule
\multicolumn{2}{l}{\textbf{Verfahren}} &
\rhead{Selektives\\ lasersintern} & \rhead{Selektives\\ Laserschmelzen} & \rhead{Elektronen-\\strahlschmelzen} & \rhead{3D Drucken} & \rhead{Fused  Deposition\\ Modelling} & \rhead{Laminated Object\\ Manufacturing} & \rhead{Multi-Jet Modelling} & \rhead{Stereolithographie} & \rhead{Poly-Jet Modelling} & \rhead{Digital Light\\ Processing} \\
\midrule
\multicolumn{2}{l}{\textbf{Abkürzung}} & SLS & SLM & EBM & 3DP & FDM & LOM & MJM & SLA & PJM & DLP \\
\midrule\addlinespace[1pt]
& Kunststoff & x &  &  & x & x & x & x & x & x & x \\\addlinespace[1pt]
\cmidrule{2-12}
& Metall &  & x & x & x &  & x &  &  &  & x \\\addlinespace[1pt]
\cmidrule{2-12}
\multirow{-3.6}{*}{\rhead{\bfseries Material}} & Keramik &  & x & x & x &  & x &  & x &  & x \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

示例 2 - tabular* 和 \extracolsep

在此处输入图片描述

\documentclass[11pt, a4paper]{scrbook}

\usepackage[left=27.5mm,right=16mm,top=30mm,bottom=30mm]{geometry}
\usepackage[english,main=ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\usepackage{rotating}
\setlength{\tabcolsep}{0pt}
\setlength\rotheadsize{2.65cm}

% Multi-line left-aligned text with manual line breaks.
% The base line of the whole is at the top row.
\newcommand*{\rhead}[1]{%
\begingroup
    \begin{sideways}
    \renewcommand*{\arraystretch}{0.85}%
    \small\begin{tabular}[b]{@{}l@{}}#1\end{tabular}%
  \end{sideways}
  \endgroup
}

\begin{document}

\begin{table}
\centering
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}llcccccccccc}
\toprule
\multicolumn{2}{l}{\textbf{Zustand}} & \multicolumn{6}{c}{\small fest} & \multicolumn{4}{c}{\small flüssig} \\
\cmidrule(lr){3-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Form}} & \multicolumn{4}{c}{\small Pulver} & \small Strang & \small Folie & \multicolumn{4}{c}{\small Flüssigkeit} \\
\cmidrule{3-6} \cmidrule{7-7} \cmidrule{8-8} \cmidrule{9-12}
\multicolumn{2}{l}{\textbf{\small Bindung}} & \multicolumn{3}{c}{\small Verschmelzen} & \small Binden & \small Verschmelzen & \small Verkleben & \small Aushärten & \multicolumn{3}{c}{\small UV-licht} \\
\midrule
\multicolumn{2}{l}{\textbf{Verfahren}} &
\rhead{Selektives\\ lasersintern} & \rhead{Selektives\\ Laserschmelzen} & \rhead{Elektronen-\\strahlschmelzen} & \rhead{3D Drucken} & \rhead{Fused  Deposition\\ Modelling} & \rhead{Laminated Object\\ Manufacturing} & \rhead{Multi-Jet\\ Modelling} & \rhead{Stereolitho-\\graphie} & \rhead{Poly-Jet\\ Modelling} & \rhead{Digital Light\\ Processing} \\
\midrule
\multicolumn{2}{l}{\textbf{Abkürzung}} & SLS & SLM & EBM & 3DP & FDM & LOM & MJM & SLA & PJM & DLP \\
\midrule\addlinespace[1pt]
& Kunststoff & x &  &  & x & x & x & x & x & x & x \\\addlinespace[1pt]
\cmidrule{2-12}
& Metall &  & x & x & x &  & x &  &  &  & x \\\addlinespace[1pt]
\cmidrule{2-12}
\multirow{-3.6}{*}{\rhead{\bfseries Material}} & Keramik &  & x & x & x &  & x &  & x &  & x \\
\bottomrule
\end{tabular*}
\end{table}

\end{document}

答案2

您可以使用否定论点\addlinespace

\documentclass[11pt, a4paper]{scrbook}

\usepackage[left=27.5mm,right=16mm, vmargin=30mm]{geometry}
\usepackage[english, main=ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\usepackage{rotating}
\setlength{\tabcolsep}{2.5pt}
\setlength\rotheadsize{2.65cm}

\begin{document}

\begin{table}
\centering
\begin{tabular}{@{}ll*{10}{c}@{}}
\toprule
\multicolumn{2}{l}{\textbf{Zustand}} & \multicolumn{6}{c}{fest} & \multicolumn{4}{c}{flüssig} \\
\cmidrule(lr){3-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Form}} & \multicolumn{4}{c}{Pulver} & Strang & Folie & \multicolumn{4}{c}{Flüssigkeit} \\
\cmidrule(lr){3-6} \cmidrule(lr){7-7} \cmidrule(lr){8-8} \cmidrule(lr){9-12}
\multicolumn{2}{l}{\textbf{Bindung}} & \multicolumn{3}{c}{Verschmelzen} & Binden & Verschmelzen & Verkleben & Aushärten & \multicolumn{3}{c}{UV-licht} \\
\midrule
\addlinespace[-\belowrulesep]
\multicolumn{2}{l}{\textbf{Verfahren}} &
\rotcell{Selektives lasersintern} & \rotcell{Selektives Laserschmelzen} & \rotcell{Elektronenstrahlschmelzen} & \rotcell{3D Drucken} & \rotcell{Fused \\ Deposition Modelling} & \rotcell{Laminated \\ Object Manufacturing} & \rotcell{Multi-Jet Modelling} & \rotcell{Stereolithographie} & \rotcell{Poly-Jet Modelling} & \rotcell{Digital Light Processing} \\
\addlinespace[-\aboverulesep]
\midrule
\multicolumn{2}{l}{\textbf{Abkürzung}} & SLS & SLM & EBM & 3DP & FDM & LOM & MJM & SLA & PJM & DLP \\
\midrule
\multirow[c]{4}{*}{\rotatebox{90}{\textbf{Material}}} & Kunststoff & x & & & x & x & x & x & x & x & x \\
\cmidrule(l){2-12}
& Metall & & x & x & x & & x & & & & x \\
\cmidrule(l){2-12}
& Keramik & & x & x & x & & x & & x & & x \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

在此处输入图片描述

相关内容