1

This is a follow up question to this discussion: How do I center the table of contents title using tocloft?

I can center the List of Figures as seen below enter image description here

But it shows up in the TOC kinda "funky" as seen below (what it does now and what i would like to change)

enter image description here

I would LIKE the output to look like this

enter image description here

The code i am using:

\renewcommand{\contentsname}{\hfill\bfseries\Large Table of Contents\hfill}   
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\listtablename}{\hfill\bfseries\Large List of Tables\hfill} % no \hfill after "List of Tables"...
\renewcommand{\cftafterlottitle}{\hfill}
\renewcommand{\listfigurename}{\hfill\bfseries\Large List of Figures\hfill} % no \hfill after
\renewcommand{\cftafterloftitle}{\hfill}

Is there a fix to this?

I am using Pdflatex with the article document class. I had to include this code after the preamble (the things above are in the preamble) to add the lof,lot to the TOC.

\tableofcontents
\listoffigures
\listoftables

I am using the package

\usepackage[nottoc]{tocbibind}

to add the items to the TOC.

  • Please tell us (a) which document class you employ (it may not be compatible with the tocloft package) and (b) what you had to do, in terms of coding, for the "List of Tables" and "List of Figures" to show up in the ToC. – Mico Mar 23 '22 at 14:55
  • @Mico, done. Made the edits – Austin Benny Mar 23 '22 at 14:57
  • @SimonDispa not sure i understand. I have those lines in my code and it is still producing the output in the second picture. Are you saying remove the \hfill after list of table? – Austin Benny Mar 23 '22 at 15:57
  • without having tried it: what happens if you use \begin{center}List of Figures\end{center} or {\centering List of Figures} (extra {}!). I wouldn't expect a better result but maybe? – flukx Mar 23 '22 at 17:54
  • @flukx error on both :( – Austin Benny Mar 23 '22 at 17:59

1 Answers1

1

This answer is in part taken from center ToC title using tocloft

e

x

z

To have the Table of Contents, List of Figures, and List of Tables as titles centered on their respective pages using tocloft, you can use the solution provided in the answer cited above.

To have "List of Figures' and "List of Tables" in the ToC add \addcontentsline{toc}{section}{List of Figures} and \addcontentsline{toc}{section}{List of Tables} to your document. (see the example)

Do not use \usepackage[nottoc]{tocbibind}

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}    
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tocloft}

%%% \usepackage[nottoc]{tocbibind} % DO NOT USE <<<<<<<

\renewcommand{\contentsname}{\bfseries \hfill Table of Contents\hfill}
\renewcommand{\cftaftertoctitle}{\hfill} \renewcommand{\listtablename}{\hfill\bfseries\Large List of Tables} % no ending \hfill <<<<<< \renewcommand{\cftafterlottitle}{\hfill} \renewcommand{\listfigurename}{\hfill\bfseries\Large List of Figures} % no ending \hfill <<<<<< \renewcommand{\cftafterloftitle}{\hfill}

\begin{document}

\tableofcontents

\newpage
\section*{Signature Block}
\addcontentsline{toc}{section}{Signature Block}
\newpage
\section*{Record of Revision}
\addcontentsline{toc}{section}{Record of Revision}

\newpage
\addcontentsline{toc}{section}{List of Figures} % added &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
\listoffigures

\newpage
\addcontentsline{toc}{section}{List of Tables} % added &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
\listoftables

\newpage        
\section*{Glossary}
\addcontentsline{toc}{section}{Glossary}
\newpage        
\section{Introduction}
\newpage
\section{Methodology}


\begin{figure}[ht!]
    \caption{A}
\end{figure}

\begin{figure}[ht!]
    \caption{B}
\end{figure}

\begin{figure}[ht!]
    \caption{C}
\end{figure}

\newpage

\begin{table}[ht!]
    \caption{A}
\end{table}

\begin{table}[ht!]
    \caption{B}
\end{table}

\begin{table}[ht!]
    \caption{C}
\end{table}

\end{document}

Simon Dispa
  • 39,141