我得到了一些建议,\thead
用于强制在表头内换行。这很有效,但到顶部规则和中间规则的距离增加了。我知道这是一个很小的差异,但它决定了整个表格是否适合页面...这是我的带有\thead
和不带有的表格的 MWE。为了举例,我删除了换行符。
\documentclass{scrreprt}
\usepackage{microtype}
\usepackage[sc]{mathpazo}
\usepackage{xfrac}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{table}[htbp]
\caption[Uebersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}]{Uebersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}}
\label{tab:Uebersicht_PV}
\small
\centering
\sisetup{output-decimal-marker = {.}}
\begin{tabular*}{\textwidth}{@{}l @{\extracolsep{\fill}} S @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{}}
\toprule
{\thead{column-1}} & {\thead{column-2}} & {\thead{column-3}} & {\thead{column-4}} & {\thead{column-5}}\\
\midrule
VNBE014220 & 3.69 & 16 & 1 & x\\
VNBE014469 & 11.47 & 16 & 1 & \\
VNBE015412 & 3.51 & 16 & 1 & x\\
\bottomrule
\end{tabular*}
\end{table}
\lipsum[11]
\begin{table}[htbp]
\caption[Uebersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}]{Uebersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}}
\label{tab:Uebersicht_PV}
\small
\centering
\sisetup{output-decimal-marker = {.}}
\begin{tabular*}{\textwidth}{@{}l @{\extracolsep{\fill}} S @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{\extracolsep{\fill}} c @{}}
\toprule
{\textbf{column-1}} & {\textbf{column-2}} & {\textbf{column-3}} & {\textbf{column-4}} & {\textbf{column-5}}\\
\midrule
VNBE014220 & 3.69 & 16 & 1 & x\\
VNBE014469 & 11.47 & 16 & 1 & \\
VNBE015412 & 3.51 & 16 & 1 & x\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
答案1
您想清除宏\theadgape
:
\renewcommand{\theadgape}{}
其最初设置为\gape
在标题周围添加垂直空间。
\documentclass{scrreprt}
\usepackage{microtype}
\usepackage[sc]{mathpazo}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand{\theadgape}{}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{table}[htbp]
\caption{Uebersicht aller PV-Anlagen im Testnetz
\textit{Uniwohngebiet}}
\label{tab:Uebersicht_PV}
\small
\centering
\sisetup{output-decimal-marker = {.}}
\begin{tabular*}{\textwidth}{@{}l @{\extracolsep{\fill}} S
*3{@{\extracolsep{\fill}}c} @{}}
\toprule
{\thead{column-1}} & {\thead{column-2}} & {\thead{column-3}}
& {\thead{column-4}} & {\thead{column-5}}\\
\midrule
VNBE014220 & 3.69 & 16 & 1 & x\\
VNBE014469 & 11.47 & 16 & 1 & \\
VNBE015412 & 3.51 & 16 & 1 & x\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
答案2
我认为没有理由使用\thead
,因为它确实增加了相当大的填充。
您也可以简化输入。
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{microtype}
\usepackage[sc]{mathpazo}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{table}[htbp]
\centering
%\small
\caption{Übersicht aller PV-Anlagen im Testnetz \textit{Uniwohngebiet}}
\label{tab:Uebersicht_PV}
\sisetup{output-decimal-marker = {.}}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}} l S[table-format=2.2] c c c @{}}
\toprule
\textbf{column-1} & {\textbf{column-2}} & \textbf{column-3} & \textbf{column-4} & \textbf{column-5}\\
\midrule
VNBE014220 & 3.69 & 16 & 1 & x\\
VNBE014469 & 11.47 & 16 & 1 & \\
VNBE015412 & 3.51 & 16 & 1 & x\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}