表格列表中章节之间的间距

表格列表中章节之间的间距

tocloft 似乎会自动在不同章节的表格条目之间添加额外的空格。我希望表格列表中的所有条目之间都有一个空格。目前,同一章节的条目之间有一个空格,不同章节的条目之间有两个空格。这是我所拥有的 MWE。

\documentclass[11pt, letterpaper]{thesis}

\usepackage[lmargin=1.5in, rmargin=1.0in, tmargin=2.0in, bmargin=1.0in]{geometry}


\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}} 

\usepackage{tocloft}
\addtocontents{lot}{Table \hfill\ {Page} \par}

\usepackage{titlesec}
\usepackage{caption}
\usepackage{ctable}
\usepackage{tabularx}


\begin{document}


% List of Tables

\renewcommand{\cftlottitlefont}{\normalfont}
\renewcommand\listtablename{\centerline{TABLES}}
\renewcommand{\cfttabaftersnum}{.}
\setlength{\cfttabindent}{0pt}
\setlength\cftbeforechapskip{0pt}
\setlength\cftbeforetabskip{11pt}

\listoftables

% End List of Tables


\chapter{Chapter One}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 1.1.}
\end{table}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 1.2.}
\end{table}


\chapter{Chapter Two}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 2.1.}
\end{table}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 2.2.}
\end{table}

\end{document}

我使用\setlength\cftbeforechapskip{0pt},但这似乎没有效果。我确实发现了这一点:如何更改图表列表中的行距?并尝试了一些建议,但似乎对我都不起作用。有什么想法吗?

答案1

该空间不是由产生的,tocloft而是由所使用的类产生的,通常在定义中\@chapter(至少在标准类中);一个可能的解决方案是重新定义此命令以抑制额外的间距;下面的代码显示了标准类的重新定义book(向 LoF 和 LoT 添加空间的行被注释掉并标记为%NEW):

\documentclass[11pt, letterpaper]{book}

\usepackage[lmargin=1.5in, rmargin=1.0in, tmargin=2.0in, bmargin=1.0in]{geometry}


\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}} 

\usepackage{tocloft}
\addtocontents{lot}{Table \hfill\ {Page} \par}

\usepackage{titlesec}
\usepackage{caption}
\usepackage{ctable}
\usepackage{tabularx}

\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
%                    \addtocontents{lof}{\protect\addvspace{10\p@}}% NEW
%                    \addtocontents{lot}{\protect\addvspace{10\p@}}% NEW
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\makeatother

\begin{document}


% List of Tables

\renewcommand{\cftlottitlefont}{\normalfont}
\renewcommand\listtablename{\centerline{TABLES}}
\renewcommand{\cfttabaftersnum}{.}
\setlength{\cfttabindent}{0pt}
\setlength\cftbeforechapskip{0pt}
\setlength\cftbeforetabskip{11pt}

\listoftables

% End List of Tables


\chapter{Chapter One}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 1.1.}
\end{table}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 1.2.}
\end{table}


\chapter{Chapter Two}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 2.1.}
\end{table}

\begin{table}[htbp] 
  \centering
    \begin{tabular}{lll}
    \toprule
    & Col 1 & Col 2 \\
    \midrule
    Row 1 & 11 & 12 \\
    Row 2 & 21 & 22 \\
    \bottomrule
    \end{tabular}
  \caption{This is table 2.2.}
\end{table}

\end{document}

由于您使用的是非标准类,上述解决方案可能不适合您;在这种情况下,我们需要看看您的类是如何添加这个空间的。

相关内容