2

I am using tocloft for the first time, and I want to make the "List of Figures" and "List of Tables" font smaller and appear on the same page, directly after the table of contents. I want list titles to be the same size as the chapter entries in the Table of Contents. For example, in the MWE below, I want the text "List of Tables" and "List of Figures" to have the same formatting as the text "1 Stuff" and "2 More Stuff", and to appear on page 1, immediately after the table of contents.

    \documentclass[10pt,oneside]{book}
    \usepackage[titles]{tocloft} % To adjust the typography of the List of Figures and List of Tables
    \usepackage{lipsum}
    \usepackage{xcolor} % To change color of hyperlinks

    \usepackage{helvet}
    \usepackage{titlesec}

    \titleformat{\chapter}[display]
    {\color{teal}\normalfont\sffamily\huge\bfseries}
    {\color{teal}\chaptertitlename\ \thechapter}{20pt}{\Huge}

    \titleformat{\section}
    {\color{teal}\normalfont\sffamily\Large\bfseries}
    {\color{teal}\thesection}{1em}{}

    \usepackage{hyperref}
    \hypersetup{colorlinks=true,linkbordercolor=red,linkcolor=teal,citecolor=teal,urlcolor=teal}

    \begin{document}


    \tableofcontents
    \addcontentsline{toc}{section}{Table of Contents}

    \listoftables
    \addcontentsline{toc}{section}{List of Tables}

    \listoffigures
    \addcontentsline{toc}{section}{List of Figures}


    \chapter{Stuff}
    \section{A section}

    \lipsum[65]

    \begin{table}[h!]
    \centering
    \caption{This is my first table.}
    \begin{tabular}{c c}
    \hline
    \hline
    Names & Ages \\
    \hline
    Margaret & 26 \\
    John & 45 \\
    Mary & 34 \\
    \hline
    \end{tabular}
    \end{table}

    \begin{table}[h!]
    \centering
    \caption{This is my second table.}
    \begin{tabular}{c c}
    \hline
    \hline
    Names & Ages \\
    \hline
    Paul & 85 \\
    George & 13 \\
    Stephanie & 56 \\
    \hline
    \end{tabular}
    \end{table}

    \section{Another section}

    \lipsum[65]

    \chapter{More Stuff}
    \section{A section again}
    \lipsum[65]

    \begin{figure}[h!]
    \caption{Figure caption here.}
    \end{figure}

    \end{document}

enter image description here

1

I want list titles to be the same size as the chapter entries in the Table of Contents.

Then add the elements to the ToC using a chapter type, not section.

I want to make the "List of Figures" and "List of Tables" [...] appear on the same page, directly after the Table of Contents.

Since you're using titlesec as well, it overrides the way tocloft manages the ToC/LoF/LoT title construction. You'll have to revert back to using titlesec's \titlespacing{\chapter}{<left>}{<before>}{<after>}[<right>] to set the way \chapters are spaced; note that the ToC/LoF/LoT are all set as \chapters (the starred version).

Additionally, you'll have to set \clearpage to \relax to avoid a page break. See How to show \listoffigures and \listoftables on one page and in the ToC?


Here is your minimal example:

enter image description here

\documentclass{book}

\usepackage[titles]{tocloft} % To adjust the typography of the List of Figures and List of Tables

\usepackage{lipsum}
\usepackage{xcolor} % To change color of hyperlinks

\usepackage{helvet}
\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\color{teal}\normalfont\sffamily\huge\bfseries}
  {\color{teal}\chaptertitlename\ \thechapter}{20pt}{\Huge}

\titleformat{\section}
  {\color{teal}\normalfont\sffamily\Large\bfseries}
  {\color{teal}\thesection}{1em}{}

\usepackage{hyperref}
\hypersetup{colorlinks=true,linkbordercolor=red,linkcolor=teal,citecolor=teal,urlcolor=teal}

\begin{document}

\begingroup
\titlespacing*{\chapter}{0pt}{20pt}{5pt}

\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}

\let\clearpage\relax
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

\endgroup

\chapter{Stuff}
\section{A section}

\lipsum[65]

\begin{table}[h!]
  \centering
  \caption{This is my first table.}
  \begin{tabular}{c c}
    \hline \hline
    Names    & Ages \\
    \hline
    Margaret & 26 \\
    John     & 45 \\
    Mary     & 34 \\
    \hline
  \end{tabular}
\end{table}

\begin{table}[h!]
  \centering
  \caption{This is my second table.}
  \begin{tabular}{c c}
    \hline \hline
    Names     & Ages \\
    \hline
    Paul      & 85 \\
    George    & 13 \\
    Stephanie & 56 \\
    \hline
  \end{tabular}
\end{table}

\section{Another section}
\lipsum[65]

\chapter{More Stuff}
\section{A section again}
\lipsum[65]

\begin{figure}[h!]
  \caption{Figure caption here.}
\end{figure}

\end{document}
  • Thanks for the help. However, I was unclear in my original post. I want to change the size of the "List of Tables" heading at the start of the table list (not the "List of Tables" entry in the TOC). Right now, the "List of Tables" and "List of Figures" headings are the same size as "Contents", but I would like to make them much smaller, preferably the same size as "1 Stuff" in the TOC. You may have hinted at the problem when you said that "note that the ToC/LoF/LoT are all set as \chapters (the starred version)." Is there a way to have them set to \section* instead? – Elizabeth J. Aug 14 '18 at 13:03
  • Update: I just found this post that almost answers the question (tex.stackexchange.com/questions/396963/…). There, they use "\setuptoc{lof}{leveldown}" to change the LoF to a section instead of a chapter. Is it possible to level it down again, to change it to a subsection? – Elizabeth J. Aug 14 '18 at 13:42
  • @ElizabethJ.: Instead of \let\clearpage\relax, try using \renewcommand{\chapter}{\subsection} to switch the traditional setting of the LoF/LoT as \chapter* being set as \subsection*. You can also try with \subsubsection. Note that you'll have to update the formatting of that sectional unit display as well, even if it's just temporarily for the LoF/LoT. – Werner Aug 14 '18 at 15:40
  • '@Werner': Thank you, that worked perfectly! – Elizabeth J. Aug 14 '18 at 21:05
1

Here is a suggestion using package tocbasic, but note that this package can not be used together with package tocloft.

\documentclass[10pt,oneside]{book}
\usepackage{lipsum}
\usepackage{xcolor} % To change color of hyperlinks

\usepackage{helvet}
\usepackage{titlesec}

\titleformat{\chapter}[display]
{\color{teal}\normalfont\sffamily\huge\bfseries}
{\color{teal}\chaptertitlename\ \thechapter}{20pt}{\Huge}

\titleformat{\section}
{\color{teal}\normalfont\sffamily\Large\bfseries}
{\color{teal}\thesection}{1em}{}

\usepackage{tocbasic}

\addtotoclist[\jobname]{toc}
\renewcommand\tableofcontents{\listoftoc[{\contentsname}]{toc}}
\setuptoc{toc}{totoc}% TOC entry for TOC
\addtotoclist[float]{lof}
\renewcommand\listoffigures{\listoftoc[{\listfigurename}]{lof}}
\addtotoclist[float]{lot}
\renewcommand\listoftables{\listoftoc[{\listtablename}]{lot}}

\doforeachtocfile[float]{%
  \deftocheading{#1}{\section*{##1\addxcontentsline{toc}{chapter}{##1}}}%
}

\usepackage{hyperref}
\hypersetup{colorlinks=true,linkbordercolor=red,linkcolor=teal,citecolor=teal,urlcolor=teal}

\begin{document}


\tableofcontents
\listoftables
\listoffigures


\chapter{Stuff}
\section{A section}

\lipsum[65]

\begin{table}[h!]
\centering
\caption{This is my first table.}
\begin{tabular}{c c}
\hline
\hline
Names & Ages \\
\hline
Margaret & 26 \\
John & 45 \\
Mary & 34 \\
\hline
\end{tabular}
\end{table}

\begin{table}[h!]
\centering
\caption{This is my second table.}
\begin{tabular}{c c}
\hline
\hline
Names & Ages \\
\hline
Paul & 85 \\
George & 13 \\
Stephanie & 56 \\
\hline
\end{tabular}
\end{table}

\section{Another section}

\lipsum[65]

\chapter{More Stuff}
\section{A section again}
\lipsum[65]

\begin{figure}[h!]
\caption{Figure caption here.}
\end{figure}

\end{document}

Result:

enter image description here

If LOF and LOT should get section headings, use

\doforeachtocfile[float]{%
  \deftocheading{#1}{\subsection*{##1\addxcontentsline{toc}{chapter}{##1}}}
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.