3

I am trying to produce the Table of Contents same as shown in Picture separately. Is there any template for this? I just have "Table of Contents" but no document attached with it.enter image description here

My problems for this Stack exchange template are:

  1. Instead of "Contents" on the top I want "TABLE OF CONTENTS"
  2. I do not want "Acknowledgement" and "List of Table" listed as section but want as shown in picture attached.
  3. I want to manually control the page listing as in my code you can see all of page numbers are 2 but I want them as attached in picture.

minimal example:

\documentclass{article}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\usepackage{titlesec}

\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection.}{1em}{}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsection)}{1em}{}
\titleformat{\paragraph}[runin]{\normalfont\normalsize\bfseries}{\theparagraph)}{1em}{}
\titleformat{\subparagraph}[runin]{\normalfont\normalsize\bfseries}{\thesubparagraph)}{1em}{}

\usepackage{tocloft}

\setlength{\cftsecnumwidth}{1em}
\setlength{\cftsubsecnumwidth}{2em}
\setlength{\cftsubsubsecnumwidth}{2.5em}
\setlength{\cftparanumwidth}{3.8em}
\setlength{\cftsubparanumwidth}{3.8em}

\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecindent}{1.8em}
\setlength{\cftsubsubsecindent}{4.1em}
\setlength{\cftparaindent}{5.9em}
\setlength{\cftsubparaindent}{7.7em}

\begin{document}

\tableofcontents

\section{ACKNOWLEDGMENTS}
\section{LIST OF TABLES}
\section{Introduction}
\subsection{Background}
\subsection{Evolution of Missing Data Estimation Method}
\subsection{Missing Data Mechanism}
\subsubsection{Missing Completely at Random}
\subsubsection{Missing at Random}
\subsubsection{Missing not at Random}

\end{document}
  • what documentclass do you use? – cmhughes Mar 12 '14 at 22:26
4
  1. Use \section* and \addcontentsline. See the code below.

  2. See the code below.

  3. Simply set the page counter to the desired value (see the code below, where a \MyNum command allows you to specify the desired page number).

  4. In a comment it was requested to have 1 inch margins in the page. This can be achieved using

    \usepackage[margin=1in]{geometry} 
    

I suppressed the parts of the original code that were not esential to the question/solution. The easiest way to get the desired result is to use the \cftsetindents command for the sectional units

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tocloft}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\renewcommand\contentsname{\MakeUppercase{Table of Contents}}

\renewcommand\cfttoctitlefont{\hfill\Large\bfseries}
\renewcommand\cftaftertoctitle{\hfill\null\vskip.5\baselineskip}
\renewcommand\cftsecleader{\cftdotfill{\cftdotsep}}
\renewcommand\cftbeforesecskip{2pt}
\renewcommand\cftbeforesubsecskip{2pt}
\renewcommand\cftbeforesubsubsecskip{2pt}

\cftsetindents{section}{0pt}{1em}
\cftsetindents{subsection}{1em}{2em}
\cftsetindents{subsubsection}{2.5em}{2.5em}

\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}

\newcommand\MyNum[1]{%
  \newpage
  \setcounter{page}{#1}%
}

\begin{document}

\tableofcontents

\MyNum{5}
\section*{ACKNOWLEDGMENTS}
\addcontentsline{toc}{section}{ACKNOWLEDGMENTS}
\MyNum{8}
\section*{LIST OF TABLES}
\addcontentsline{toc}{section}{LIST OF TABLES}
\MyNum{9}
\section{Introduction}
\subsection{Background}
\MyNum{10}
\subsection{Evolution of Missing Data Estimation Method}
\MyNum{12}
\subsection{Missing Data Mechanism}
\subsubsection{Missing Completely at Random}
\MyNum{14}
\subsubsection{Missing at Random}
\MyNum{15}
\subsubsection{Missing not at Random}

\end{document}

enter image description here

Remark:

If babel is loaded, the line

\renewcommand\contentsname{\MakeUppercase{Table of Contents}}

will have no effect. In this case, the redefinition will have to be done using

\addto\captions<language>{\renewcommand\contentsname{\MakeUppercase{Table of Contents}}} 

as described elsewhere in some other answers in this site.

  • Excellent Job .. You solved all my problems except for problem (2) where I do not want "Acknowledgement" and "List of Table" listed as section but want as shown in picture attached... – user35571 Mar 13 '14 at 0:56
  • @user35571 Ah, yes. Sorry. I've fixed it in my updated answer. – Gonzalo Medina Mar 13 '14 at 1:00
  • Awesome!! One More thing ...can we have 1" margins on all sides of this page ? This is the last thing I wont bother you anymore – user35571 Mar 13 '14 at 1:06
  • @user35571 Sure. Please see my updated answer. – Gonzalo Medina Mar 13 '14 at 1:10
0

Here is another solution, using the titletoc, titlesec and etoolbox packages. The latter allows to automatically add unnumbered sections to the table of contents if the value of a boolean is "true", incorporating the \addcontentsline… command into the. \titleformat{\section} command. I also added a dot after the section numbers, as in the OP's example.

        \documentclass[11pt, a4paper, twoside]{article}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}
        \usepackage[pagestyles, explicit]{titlesec}%
        \usepackage[leftlabels]{titletoc}%

        \usepackage{etoolbox}
        \newbool{addtoc}%initial value:  false

        \titleformat{\section}[display]%
        {\bfseries\Large\filcenter}
        {\LARGE\thesection}
        {0.5pc}
        {\vspace{0.5pc}\Huge\MakeUppercase{#1}}%

        \titleformat{name=\section, numberless}[display]
        {\bfseries\large\filcenter}
        {}
        {0.5pc}
        {\vspace{0.5pc}\MakeUppercase{#1}}%
        [\ifbool{addtoc}{\addcontentsline{toc}{section}{#1}}{}]%

          \titlecontents{section}[2em]{\smallskip}%\vspace{1cm}
          {\contentslabel[\thecontentslabel.]{1em}}%numbered
          {\hspace*{-1em}}%numberless
          {\dotfill\contentspage}[\medskip]%
        %
         \titlecontents{subsection}[4em]{\smallskip}%
          {\contentslabel[\thecontentslabel.]{2em}}%numbered
          {\hspace*{-1em}}%{-1em}}%numberless
          {\dotfill\contentspage}[\smallskip]%\vspace{-0,25ex}
        %
         \titlecontents{subsubsection}[6.75em]{}%
          {\contentslabel[\thecontentslabel.]{2.75em}}%numbered
          {\hspace*{-1em}}%numberless
          {\dotfill\contentspage}[\smallskip]

        \renewcommand*{\contentsname}{Title of contents}

        \begin{document}

        \tableofcontents

        \booltrue{addtoc}
         \newpage
        \section*{ACKNOWLEDGMENTS}

        Blahblahblah
        \newpage

        \section{INTRODUCTION}

        \subsection{Background}

        \subsection{Evolution of Missing Data Evolution Method Evolution of Missing Data Evolution Method}

        \subsection*{Missing Data Mechanisms}

        \subsubsection{Missing Completely at Random Missing Completely at Random Missing Completely}
        \subsubsection{Missing at Random}

        \subsection{Missing Not at Random}

        \subsection{Strategies for Missing Data}
        \newpage

        \section{LITERATURE REVIEW}

        \end{document}

enter image description here

  • @user35571: I've added another solution using titlesec/titletoc that automates the inclusion of unnumbered sections in the table of contents. – Bernard Mar 15 '14 at 22:11

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.