1

I want to improve my table of contents so that I have larger writing (but with different sizes for section, subsection etc..), better spacing between lines and to add 'page' above the numbers.., maybe also removing the dots.

I have tried playing with the tocloft package and I managed to add 'page' below the 1st number but not above...

Can someone help me?

Here is my code and preamble.

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{fixltx2e}
\usepackage{grffile}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{floatrow}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{ragged2e}
%\usepackage[justification=centering]{caption}
\usepackage[titles]{tocloft}
\usepackage{caption}
\usepackage{tocloft}

\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

\titleformat{\section}
  {\normalfont\fontsize{14}{12}\bfseries}{\thesection}{1em}{}
\makeatletter
\renewcommand{\paragraph}{%
  \@startsection{paragraph}{4}%
  {\z@}{1.2ex \@plus 1ex \@minus .2ex}{-1em}%
  {\normalfont\normalsize\bfseries}%
}
\renewcommand{\baselinestretch}{1.0}
\makeatother
\setcounter{secnumdepth}{3}
\begin{document}
\sloppy

{\newgeometry{left=0.98in,right=0.98in,top=0.98in,bottom=0.78in}
%\addtocontents{toc}{~\hfill\textbf{Page}\par}
\setcounter{tocdepth}{3}
\tableofcontents\thispagestyle{empty}\setlength{\cftbeforechapskip}{2ex}\setlength{\cftbeforesecskip}{0.5ex}
\newpage
\setcounter{page}{1}
\renewcommand{\thesection}{\arabic{section}}
3
  • 2
    You mention trying out a few things with the tocloft package; please show what you've tried so far. Please also provide more specific information as to what you mean by "larger writing" and "better spacing between lines". Incidentally, almost all of the preamble contents you're showing so far are irrelevant as far as the looks of the Table of Contents go; please consider providing a minimal working example.
    – Mico
    Commented Jul 2, 2014 at 19:00
  • This is all the code I currently have related to the table of contents. I just tried adding lines from the tocloft's manual to the document but I guess I didn't properly understand where to put it. I wrote something like \renewcommand{insert tocloft code here} on the line after \tableofcontents\thispagestyle{empty}\setl.......
    – Michael
    Commented Jul 2, 2014 at 20:13
  • I basically just want the writing bigger than it is set at the moment...but so that the subsection is smaller than the section and the subsubsection is smallest. So maybe that the subsubsection is the size of the writing currently presented. As to the spacing, I just want a wider space between each line so it looks neater. I added all my preamble in case other packages somehow overwrite what I write for tocloft..
    – Michael
    Commented Jul 2, 2014 at 20:15

1 Answer 1

4

What you want to achieve can be done using tocloft and the families of commands \cftXfont (for the font attributes of the title and numbering of the entries), and \cftXpagefont (for the font attributes of the page numbers of the entries).

The code below shows an example in which I used \Large and bold-face for chapter entries, \Large for section entries, \large for subsection entries, and \normalsize (the default) for subsubsection entries.

I also used the family \cftbeforeXskip of lenghts to add some spacing before the chapter, section and subsection entries. If you want to modify also the spacing between lines in a group of entries (this is not clear from the description given in the question), then consider using the features provided by the setspace package.

Please, feel free to modify the settings in my example to suit your needs.

The code:

\documentclass{report}
\usepackage[titles]{tocloft}

% change the font for chapter, section and subsection titles and numbers
\renewcommand\cftchapfont{\Large\bfseries}
\renewcommand\cftsecfont{\Large}
\renewcommand\cftsubsecfont{\large}

% change the font for chapter, section and subsection page numbers
\renewcommand\cftchappagefont{\Large\bfseries}
\renewcommand\cftsecpagefont{\Large}
\renewcommand\cftsubsecpagefont{\large}

% change the spacing before chapter, section and subsection entries
\setlength\cftbeforechapskip{2ex}
\setlength\cftbeforesecskip{1ex}
\setlength\cftbeforesubsecskip{0.8ex}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\renewcommand{\thesection}{\arabic{section}}

\begin{document}

\tableofcontents

\chapter{A test chapter}
\section{A test section}
\subsection{A test subsection}
\subsubsection{A test subsubsection}

\chapter{A test chapter}
\section{A test section}
\subsection{A test subsection}
\subsubsection{A test subsubsection}

\end{document}

The result:

enter image description here

From the code in the original post, I suppressed all packages and settings that were not relevant to the problem discussed here.

As a final remark, please reconsider this decision; the different levels of indentation used in the ToC are more than enough to distinguish between different sectional units, a change in the font size might be superfluous. In any case, this is just a suggestion; your document's layout is, of course, up to you.

You must log in to answer this question.

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