16

I am writing a thesis, and as long as it's a draft, I would like to keep the amount of non-content to a minimum. That said, I would like my title page to be just a heading with the name of the thesis, a short abstract and the ToC.

The ToC itself is problematic for me. Using report, the ToC does reserve a full page for itself, probably given the chapter-style heading. I have tried several packages (like minitoc, titletoc, ...) to no avail, I have tried redefining the command, but that only worked in article mode.

So I only need the contents of the ToC, without the heading (or without the heading forcing a new page), to be generated.

19

Use the internal command \@starttoc{toc} to typeset the contents of the ToC. Additionally, use the notitlepage class option.

\documentclass[notitlepage]{report}

\makeatletter
\newcommand*{\toccontents}{\@starttoc{toc}}
\makeatother

\begin{document}

\author{(Author)}
\title{(Title)}
\maketitle

\toccontents

\chapter{foo}

\end{document}

enter image description here

  • Strange, I tried 'starttoc' before, but it did not work, now it works like a charm! Guess I forgot something... thanks! – Ondrej Feb 26 '12 at 18:27
  • 1
    What about the title of ToC? Do you know how to have it back? – GiuTeX Sep 2 '17 at 11:05
6

A trick might be to use the notitlepage option, so \maketitle will not produce a page with the data. Then we can make LaTeX into thinking that \chapter does nothing (note that this is inside an environment, where redefining a command is safe since the redefinition will disappear at the end of the environment; don't do this without enclosing the \renewcommand in a group; it certainly qualifies as a hack):

\documentclass[notitlepage]{report}

\usepackage{lipsum}
\begin{document}

\begin{titlepage}
\thispagestyle{empty}

\title{A draft of my thesis}
\author{A. U. Thor}
\maketitle

\vfill

\begin{abstract}
\lipsum[2]
\end{abstract}

\vfill

\renewcommand{\chapter}[2]{}
\tableofcontents

\vfill

\end{titlepage}

\chapter{Intro}
\lipsum[1]
\end{document}

This works because \tableofcontents does \chapter*{...} and so, redefining \chapter with two arguments to do nothing will ignore the * and the real argument. You'll get no heading for the table of contents; you can add one by

\begin{center}
\bfseries\contentsname
\end{center}

just before \tableofcontents, so that the result will be similar to the abstract's heading.

For a cleaner version one should either use \makeatletter and \makeatother to access \@starttoc (as in lockstep's) answer or patching \tableofcontents with etoolbox. Being this for a quick hack to be used only in preliminary versions, I believe that this is the simplest trick.

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.