我的表格列表中的额外间距

我的表格列表中的额外间距

Latex 在我的表格列表中的两个条目之间添加了额外的空格。

间距出现在附录中实际找到的第一个表格之前。

附录中未找到的最后一张表是长表。

代码:

\begin{longtable} {l c | p{1.4cm}  p{1.4cm} p{1.4cm} p{1.4cm} }
\centering
Stuff & Stuff & Stuff & Stuff & Stuff & Stuff \\
\caption{Stuffcaption}
\end{longtable}

附录中的第一个条目被放在一个小页面中,因为否则就不可能使用 \caption,而 \captionof 也不是合适的替代方案。

代码:

\section{AppendixStuff}
\begin{minipage} {\linewidth}
\captionsetup{type=table}
\begin{tabularx} {\linewidth} { p{4cm} p{5cm} c}
\toprule 
\textbf{AppendixStuff} & \textbf{AppendixStuff} & \textbf{AppendixStuff}\\
\midrule
AppendixStuff & AppendixStuff & AppendixStuff \\
\bottomrule
\end{tabularx}
\caption{AppendixStuff}
\end{minipage}

我的表格列表中多了一个空行。我该如何去掉它?

答案1

如果您想删除不同章节的表格之间的垂直空间,如下所示:

有章节间隙的表格列表

KOMA-Script 类scrbook并提供删除此scrreprt选项listof=nochaptergap章节间隙

\documentclass[listof=nochaptergap]{scrbook}

\begin{document}
\listoftables
\chapter{First}
\captionof{table}{First table in first chapter}
\captionof{table}{Second table in first chapter}
\chapter{Second}
\captionof{table}{First table in second chapter}
\captionof{table}{Second table in second chapter}
\appendix
\chapter{First}
\captionof{table}{First table in first appendix}
\captionof{table}{Second table in first appendix}
\end{document}

无章节间隙的表格列表

您甚至可以仅为附录设置此选项:

\documentclass{scrbook}
\usepackage{xpatch}
\xapptocmd{\appendix}{\KOMAoptions{listof=nochaptergap}}{}{}
\begin{document}
\listoftables
\chapter{First}
\captionof{table}{First table in first chapter}
\captionof{table}{Second table in first chapter}
\chapter{Second}
\captionof{table}{First table in second chapter}
\captionof{table}{Second table in second chapter}
\appendix
\chapter{First}
\captionof{table}{First table in first appendix}
\captionof{table}{Second table in first appendix}
\end{document}

但我建议这样做,因为结果很丑陋并且不一致:

仅附录无章节间隙的表格列表

KOMA-Script 还提供了更改间隙距离或通过选项将章节标题添加chapteratlists到图表列表和表格列表(以及其他类似列表)的选项。请参阅KOMA-Script 手册或者德语 KOMA-Script 手册了解更多信息。

答案2

(评论太长,因此作为答案发布)

您的帖子包含相当多的断言 - 例如“Latex 在我的表格列表中的两个条目之间添加了一个额外的空格”和“附录中的第一个条目被放在里面,minipage因为否则就不可能使用\caption” - 但提供了没有依据复制您所面临的问题。

以下 MWE(最小工作示例)尝试基于您提供的代码片段和其他信息进行构建,但它并未重现您遇到的任何问题。

请更具体地说明您实际在做什么。

在此处输入图片描述

\documentclass{article}
\usepackage{longtable,tabularx,booktabs,ragged2e}

\begin{document}

\tableofcontents
\listoftables

\bigskip\hrule

\section{A normal section}

\begin{longtable}{lll}
\caption{A longtable}\\
\toprule
aaa & bbb & ccc \\
\bottomrule
\end{longtable}

\appendix

\section{Appendix with a tabularx table}

\begin{table}[h!]
\begin{tabularx}{\linewidth}{@{} XXX @{}}
\toprule 
\textbf{Appendix Stuff} & \textbf{Appendix Stuff} &  \textbf{Appendix Stuff}\\
\midrule
Appendix Stuff & Appendix Stuff & Appendix Stuff \\
\bottomrule
\end{tabularx}
\caption{Appendix Stuff, Take 1}
\end{table}


\section{Appendix with a tabular* table}

\begin{table}[h!]
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} lcr @{}}
\toprule 
\textbf{Appendix Stuff} & \textbf{Appendix Stuff} & \textbf{Appendix Stuff}\\
\midrule
Appendix Stuff & Appendix Stuff & Appendix Stuff \\
\bottomrule
\end{tabular*}
\caption{Appendix Stuff, Take 2}
\end{table}

\end{document}

相关内容