0

I am trying to format my table of contents, list of figures, and list of tables. I need to center the titles of all but when I do this extra spacing is added to the list of figures and list of tables within the table of contents.

Here is my code (I removed parts that were unnecessary):

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{dissertation}
[2015/06/05 v0.2 Dissertation Class]
\newif\if@endorse

\DeclareOption{endorse}{\@endorsetrue}
\DeclareOption{noendorse}{\@endorsefalse}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{noendorse, 12pt, letterpaper}
\ProcessOptions
\LoadClass{report}
\RequirePackage[hmargin={1.5in,1in},vmargin=1in,foot=0.5in]{geometry}
\RequirePackage[nottoc]{tocbibind}
\RequirePackage{needspace}
\RequirePackage{tocloft}

\newcommand\makefrontmatter{%
  \maketitle 
  \pdfbookmark[chapter]{\contentsname}{toc}
  \tableofcontents \newpage \listoftables \newpage \listoffigures
  \clearpage
  \pagenumbering{arabic} \global\let\thanks\relax
  \global\let\maketitle\relax \global\let\title\relax
  \global\let\author\relax \global\let\date\relax
  \global\let\and\relax \global\let\abstract\relax
  \global\let\dedication\relax}

\renewcommand{\contentsname}{\hfill \normalfont Table of Contents \hfill}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand\cftsecfont{\normalsize \normalfont}
\renewcommand\cftsecpagefont{\normalsize \normalfont}

\renewcommand\cftsubsecfont{\normalsize \normalfont}
\renewcommand\cftsubsecpagefont{\normalsize \normalfont}
\renewcommand\cftloftitlefont{\normalsize \normalfont}

\renewcommand{\listfigurename}{\hfill \normalfont List of Figures \hfill}
\renewcommand{\listtablename}{\hfill \normalfont List of tables \hfill}

\renewcommand{\cfttoctitlefont}{\normalfont} 
\renewcommand{\cftloftitlefont}{\normalfont} 
\renewcommand{\cftlottitlefont}{\normalfont}
\renewcommand{\cftfigfont}{\normalfont} 
\renewcommand{\cftfigpagefont}{\normalfont} 

Here is what I am getting:

TOC

lof

1

1 Answer 1

0

Does this help?

% tocloftcenteringprob.tex  SE 573019
\documentclass{report}
\usepackage{tocloft}
%%% center ToC, etc titles
\renewcommand{\cfttoctitlefont}{\hfil\Large\bfseries} \renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftloftitlefont}{\hfill\Large\bfseries} \renewcommand{\cftafterloftitle}{\hfill}
\begin{document}
\tableofcontents
\listoffigures \addcontentsline{toc}{chapter}{\listfigurename}
\chapter{A chapter}
\begin{figure}
\centering
A FIGURE
\caption{A figure}
\end{figure}
\end{document}

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.