表格清單中章節之間的間距

表格清單中章節之間的間距

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}

由於您使用的是非標準類,因此上述解決方案可能不適合您;在這種情況下,我們需要看看你們的班級如何添加這個空間。

相關內容