0

I am using the following adjustments to my tocloft package in my article document.

\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}

Unfortunately, when adjusting the space between number and caption in my List of Figures, the space remains the same. I use the same command to adjust the space in my List of Figures and List of Tables, but in the latter it works perfectly. My code for adjusting:

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

While it correctly shifts my caption for List of Tables it does NOT do it for my List of Figures. I assuem it is related to my adjustments I did to have subfigures shown without dottet line and numbering. How can I fix the code?

2
  • 1
    You have provided a lot of code. However, could you please expand it into an MWE (from \documentclass... to \end{document) that we can process. It will need to include the \usepackage{tocloft}, listoffigures, \listoftables, and at least one table and at least one figure and subfigure (how do you get your subfigures?); the figure and table contents can be as simple as the words "AN ILLUSTRATION" and "A TABULATION". Jun 6, 2020 at 17:27
  • Yes, sure. I added my MWE. @Peter Wilson
    – PSA
    Jun 7, 2020 at 14:33

1 Answer 1

1

Thank you for the LaTeXable MWE.

I tried commenting out all of the subfigure adjustments and got no change in the LoF, so that was not the problem. Below is a modified version of your MWE which I think does what you are after.

% 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}

I modified your \cftsetindents{figure}... to give a very wide space for the figure number (reduce this to suit), and commented out your \setlength{\cftfignumwidth}... just before the \listoffigures.

1
  • obviously my 2nd setlength has overwritten my first one and I did not notice it. Thank you!
    – PSA
    Jun 7, 2020 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .