1

As a LaTeX newbie I am completely at loss when it comes to editing the Table of Contents and the List of Tables in my dissertation.

I need to do two things

  1. I need all Chapters to have dotted lines. Currently, my TOC has dotted lines only for subsections. I tried using tocstyle package with the allwithdots style but that changes the font to Sans Serif and I want the font to remain unchanged.
  2. The formatting guidelines also require that the first page of the TOC have a 2 inch top margin while all subsequent pages have a 1 inch top margin. I have been using the geometry package to manage my margins but I can't figure out how to have different margins on the second page of my TOC.
  3. My school's formatting requirements require the List of Tables to be of the following format

List of Table Sample

I used this code, that was suggested in another thread but this adds all chapters including those that do not have Tables in them to the list. My school requires only those Chapters that have Tables to show up in this list with the Table and Page headings over the respective sections. Unfortunately my school does not provide a template for this.

\makeatletter
\xapptocmd{\@chapter}{\addtocontents{lot}   {{\protect\centering\large\normalfont\thechapter~#1\par\addvspace{10pt}}}}{}{}
\makeatother

How can I achieve this?

Thanks!

  • Please post some compilable code, which is as minimal as possible. "Currently, my TOC has dotted lines only for subsections"... so you already have something to show. I would need minutes to reproduce this by guessing around. Thank you. – LaRiFaRi Jul 16 '15 at 7:56
  • Your requesting again a bunch of features. – user31729 Jul 16 '15 at 8:05
  • @LariFari I am trying to make a MWE with the TOC that would work, but finding it hard to do so. If it helps, This was the template that was used – user3228698 Jul 16 '15 at 8:15
  • @ChristianHupfer My apologies for doing so, my only intention is not to spam the board with multiple questions/posts. – user3228698 Jul 16 '15 at 8:15
  • @user3228698: I've deleted my answer since it was waste of time for me to provide an answer to some (probably) ill-designed template. – user31729 Jul 16 '15 at 19:32
2
\documentclass[10pt,oneside]{book}
\usepackage[margin=1in]{geometry}
\usepackage{tocloft}            % this package styles ToC, LoT and LoF           

%=========     Customizing ToC

% Z represents all three ToC, LoT an LoF respectively
% adding 1in vertical space to make total 2 inch space from top for Z
\setlength{\cftbeforetoctitleskip}{1in}
\setlength{\cftbeforelottitleskip}{1in}
\setlength{\cftbeforeloftitleskip}{1in}

\setlength{\cftaftertoctitleskip}{0pt}

% making titles of Z respectively centered and fontsize is
% \Large which can be changed to any value desired
\renewcommand{\cfttoctitlefont}{{~}\hfill\Huge}
\renewcommand{\cftaftertoctitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}

\renewcommand{\cftlottitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterlottitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}

\renewcommand{\cftloftitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterloftitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}

% reducing dot separation to make it look like a dotted line
\renewcommand{\cftdotsep}{1}

% increasing width for page number for Z
\cftsetpnumwidth{1cm}

% increasing right margin which makes width available for titles smaller
% hence grater the value smaller the title width
\cftsetrmarg{3cm}


% these commands sets leaders for part and chapter which by default
% are not shown, to make them disappear again replace dotsep value by
% \cftnodot
% e.g. \renewcommand{\cftpartdotsep}{\cftnodot}
\renewcommand{\cftpartdotsep}{1}
\renewcommand{\cftpartleader}{\cftdotfill{\cftpartdotsep}}

\renewcommand{\cftchapdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}

\begin{document}

\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures


\part{Part One}
\chapter{Chapter One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One}

\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}


\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection C}

\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}



\chapter{Chapter Two}


\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}

\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}


\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection B}
\subsection{Subection C}

\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}

\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection C}


\chapter{Chapter Three}


\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}


\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}

\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}

\subsection{Subection C}

\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}

\subsection{Subection C}

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


\part{Appendix}
% Use starred version of chapters, section etc which do not appear in table of contents

\chapter*{A}
\chapter*{B}

\part{Index}

\end{document}
  • 1
    This works perfectly with few exceptions. The title of the "Table of contents" is not centered. Same is true for "List of tables" I needed it to be normal size non-bold typeface so I changed \Huge\bfseries to \normalfont. I tried adding \centering before \normalfont but that did not center the title. Also, do I have to use the fontenc and lmodern packages? At this point my font is the default Serif font in LaTeX, using the two packages makes characters like apostrophes show up weird. – user3228698 Jul 21 '15 at 23:43
  • 1
    Try the new solution, I have made titles centered and removed package fontenc and lmodern. You can include your package for fonts. – Jitendra Kumar Jul 22 '15 at 3:35
  • That is just what i needed. Thanks for your help! I needed chapter titles in the table of contents but only selective chapters for the list of tables so I added \cftaddtitleline{lot}{chapter}{\protect\centering{} Title of Chapter One}{} to the beginning of each Chapter. However I also need to remove the dotted lines and using \renewcommand{\cftchapdotsep}{\cftnodot} doesn't help. What am I doing wrong there? – user3228698 Jul 22 '15 at 8:06
  • 1
    Correction: adding \renewcommand{\cftchapleader}{\cftnodots} before the List of Tables removes the dotted lines but now I see the number 5000 where there were lines. So now the list shows up as Chapter Title5000 – user3228698 Jul 22 '15 at 8:28

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.