调整图片列表中数字和标题之间的间距不起作用

调整图片列表中数字和标题之间的间距不起作用

我在我的文章文档中对我的 tocloft 包进行了以下调整。

\documentclass[11pt]{article}
\usepackage{indentfirst,tocloft,blindtext,caption,}
\usepackage{graphicx}
\usepackage[a4paper, margin=1in]{geometry} 
\usepackage[labelfont=bf,labelsep=period]{caption} 
\DeclareCaptionListFormat{myListFormat}{(#2)}
\usepackage[list=true, listformat=myListFormat]{subcaption}

%%%%%%%%%%%% ToC, LoF, LoT ADJUSTMENTS %%%%%%%%%%%%%%%%%%%%
% Formatting ToC
\renewcommand*\contentsname{\centerline{TABLE OF CONTENTS}}
\setcounter{tocdepth}{3}
% Adjust spacing between number and title in ToC
\advance\cftsecnumwidth 1em\relax
\advance\cftsubsecindent 1em\relax
\advance\cftsubsubsecindent 1em\relax

\cftsetindents{figure}{0em}{2.55em}
\cftsetindents{table}{0em}{2.55em}

% Adjust dots in ToC, LoF, LoT
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother

% Formatting LoF
\renewcommand{\listfigurename}{\section*{LIST OF FIGURES}}
\setcounter{lofdepth}{2}
\cftpagenumbersoff{subfigure}

\makeatletter
\renewcommand\cftfigfont{\bfseries}
\makeatother

\makeatletter
\newcommand\cftsubtabdotsep{\cftdotsep}
\newcommand\cftsubfigfont{\normalfont}
\newcommand\cftsubfigpresnum{}
\newcommand\cftsubfigaftersnum{}
\newcommand\cftsubfigaftersnumb{}
\newcommand\cftsubfigleader{\hfill}
\newcommand\cftsubfigpagefont{\normalfont}
\newcommand\cftsubfigafterpnum{}
\providecommand{\toclevel@subfigure}{1}
\renewcommand*\l@subfigure[2]{%
  \ifnum \c@lofdepth > \toclevel@subfigure
    \vskip \cftbeforesubfigskip
    {\leftskip \cftsubfigindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftsubfigindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftsubfignumwidth\relax
     \let\@cftbsnum \cftsubfigpresnum
     \let\@cftasnum \cftsubfigaftersnum
     \let\@cftasnumb \cftsubfigaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftsubfigfont #1}\nobreak
     \cftsubfigfillnum{#2}}%
  \fi
  }%
\newlength\cftbeforesubfigskip
  \setlength\cftbeforesubfigskip{\z@ \@plus.2\p@}
\newlength\cftsubfigindent
  \setlength\cftsubfigindent{5em}
\newlength\cftsubfignumwidth
  \setlength\cftsubfignumwidth{2.5em}
\renewcommand{\cftsubfigfillnum}[1]{%
  {\cftsubfigleader\hfill}\par
}
\makeatother

% Formatting LoT
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\setcounter{lotdepth}{1}
\makeatletter
\renewcommand\cfttabfont{\bfseries}
\makeatother

\begin{document}

\tableofcontents
\clearpage
{%
\renewcommand{\cftfigpresnum}{Figure~}
\setlength{\cftfignumwidth}{5em}
\listoffigures%
}
%\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\clearpage
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\listoftables
}
\addcontentsline{toc}{section}{List of Tables}

\clearpage

\section{Introduction}
\blindtext

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{example-image}
    \parbox{0.5\textwidth}{\subcaption[Issuer credit rating]{Issuer credit rating}}\hfill
    \parbox{0.5\textwidth}{\subcaption[Purpose]{Purpose}}
    \caption[Issuer credit rating and purpose for deals]
    {{\bf Issuer credit rating and purpose for deals} 
    \\{\small \blindtext}}
\end{figure}

\begin{table}
    \small
    \captionsetup{singlelinecheck = false, justification=justified}
    \caption[Summary statistics]{{\bf Summary statistics}
    \blindtext}
\centering
 \begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 2 & 7 & 78 & 5415 \\
 3 & 545 & 778 & 7507 \\
 4 & 545 & 18744 & 7560 \\
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
 \end{tabular}
\end{table}

\end{document}

不幸的是,当我调整图表列表中的数字和标题之间的间距时,间距保持不变。我使用相同的命令来调整图表列表和表格列表中的间距,但在后者中它可以完美运行。我的调整代码:

\cftsetindents{figure}{0em}{2.55em}
\cftsetindents{table}{0em}{2.55em}

虽然它可以正确地移动表格列表的标题,但无法移动图表列表的标题。我认为这与我所做的调整有关,我调整了子图的显示,但没有虚线和编号。我该如何修复代码?

答案1

感谢 LaTeXable MWE。

我尝试注释掉所有子图调整,但 LoF 中没有任何变化,所以这不是问题所在。下面是 MWE 的修改版本,我认为它符合您的要求。

% loffignumprob.tex  SE 548006

\documentclass[11pt]{article}
\usepackage{indentfirst,tocloft,blindtext,caption,}
\usepackage{graphicx}
\usepackage[a4paper, margin=1in]{geometry} 
\usepackage[labelfont=bf,labelsep=period]{caption} 
\DeclareCaptionListFormat{myListFormat}{(#2)}
\usepackage[list=true, listformat=myListFormat]{subcaption}

\usepackage{comment}

%%%%%%%%%%%% ToC, LoF, LoT ADJUSTMENTS %%%%%%%%%%%%%%%%%%%%
% Formatting ToC
\renewcommand*\contentsname{\centerline{TABLE OF CONTENTS}}
\setcounter{tocdepth}{3}
% Adjust spacing between number and title in ToC
\advance\cftsecnumwidth 1em\relax
\advance\cftsubsecindent 1em\relax
\advance\cftsubsubsecindent 1em\relax

%\cftsetindents{figure}{0em}{2.55em}
\cftsetindents{figure}{0em}{10em}   % PW sets the figure numwidth to 10em
\cftsetindents{table}{0em}{2.55em}

% Adjust dots in ToC, LoF, LoT
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother

% Formatting LoF
\renewcommand{\listfigurename}{\section*{LIST OF FIGURES}}
%\begin{comment}
\setcounter{lofdepth}{2}
\cftpagenumbersoff{subfigure}
%\end{comment}

%\makeatletter
\renewcommand\cftfigfont{\bfseries}
%\makeatother

%\begin{comment}
\makeatletter
\newcommand\cftsubtabdotsep{\cftdotsep}
\newcommand\cftsubfigfont{\normalfont}
\newcommand\cftsubfigpresnum{}
\newcommand\cftsubfigaftersnum{}
\newcommand\cftsubfigaftersnumb{}
\newcommand\cftsubfigleader{\hfill}
\newcommand\cftsubfigpagefont{\normalfont}
\newcommand\cftsubfigafterpnum{}
\providecommand{\toclevel@subfigure}{1}
\renewcommand*\l@subfigure[2]{%
  \ifnum \c@lofdepth > \toclevel@subfigure
    \vskip \cftbeforesubfigskip
    {\leftskip \cftsubfigindent\relax
     \rightskip \@tocrmarg
     \parfillskip -\rightskip
     \parindent \cftsubfigindent\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima \cftsubfignumwidth\relax
     \let\@cftbsnum \cftsubfigpresnum
     \let\@cftasnum \cftsubfigaftersnum
     \let\@cftasnumb \cftsubfigaftersnumb
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\cftsubfigfont #1}\nobreak
     \cftsubfigfillnum{#2}}%
  \fi
  }%
\newlength\cftbeforesubfigskip
  \setlength\cftbeforesubfigskip{\z@ \@plus.2\p@}
\newlength\cftsubfigindent
  \setlength\cftsubfigindent{5em}
\newlength\cftsubfignumwidth
  \setlength\cftsubfignumwidth{2.5em}
\renewcommand{\cftsubfigfillnum}[1]{%
  {\cftsubfigleader\hfill}\par
}
\makeatother
%\end{comment}

% Formatting LoT
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\setcounter{lotdepth}{1}
\makeatletter
\renewcommand\cfttabfont{\bfseries}
\makeatother

\begin{document}

\tableofcontents
\clearpage
{%
\renewcommand{\cftfigpresnum}{Figure~}
%\setlength{\cftfignumwidth}{5em}   % PW don't use this here after the
\listoffigures%
}
%\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\clearpage
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\listoftables
}
\addcontentsline{toc}{section}{List of Tables}

\clearpage

\section{Introduction}
\blindtext

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{example-image}
    \parbox{0.5\textwidth}{\subcaption[Issuer credit rating]{Issuer credit rating}}\hfill
    \parbox{0.5\textwidth}{\subcaption[Purpose]{Purpose}}
    \caption[Issuer credit rating and purpose for deals]
    {{\bf Issuer credit rating and purpose for deals} 
    \\{\small \blindtext}}
\end{figure}

\begin{figure}
\centering
AN ILLUSTRATION
\caption{A figure}
\end{figure}

\begin{table}
    \small
    \captionsetup{singlelinecheck = false, justification=justified}
    \caption[Summary statistics]{{\bf Summary statistics}
    \blindtext}
\centering
 \begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 2 & 7 & 78 & 5415 \\
 3 & 545 & 778 & 7507 \\
 4 & 545 & 18744 & 7560 \\
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
 \end{tabular}
\end{table}

\end{document}

我修改了你的\cftsetindents{figure}...,为图形编号提供了非常宽的空间(减少它以适应),并\setlength{\cftfignumwidth}...在之前注释掉了你的\listoffigures

相关内容