Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am required to typeset a ToC that is narrower than the \textwdith or \linewidth. I use the \adjustwidth from the changepage package for this and it almost works except that it introduces a blank page before the actual ToC page.

I simplified this into a minimal example so you can see what is happening here (please copy & paste these two code blocks into two named files and compile the narrowtoc.tex):

narrow-toc.cls

\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesClass{narrow-toc}

\DeclareOption*{
 \PassOptionsToClass{\CurrentOption}{report}
}
\ProcessOptions\relax

\LoadClass[12pt,letterpaper,oneside]{report}

\RequirePackage{changepage}

\let\cleardoublepage\clearpage
\renewcommand{\contentsname}{Table of Contents}

\let\oldtableofcontents = \tableofcontents
\renewcommand{\tableofcontents}{
%\clearpage % even after comment out this, there is still a blank page before the toc
    \pagestyle{plain}
    \begin{adjustwidth}{1cm}{1cm}
        \oldtableofcontents
    \end{adjustwidth}
}

narrowtoc.tex

\documentclass{narrow-toc}

\title{A normal title}
\author{My name}
\begin{document}

\maketitle
\tableofcontents

\chapter{My first chapter}
Texts

\end{document}

The produced pdf file has 4 pages: its "Table of Contents" is in page 3, while page 2 is blank and page 1 is the title page.

How can I remove this blank page 2? Here the report document class is used, so this is not a problem solved by "oneside" option.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The environment adjustwidth starts a list and then \oldtableofcontents issues a \clearpage (from \chapter*); add \let\clearpage\relax to the definition.

\renewcommand{\tableofcontents}{%
  \pagestyle{plain}
  \begin{adjustwidth}{1cm}{1cm}
     \let\clearpage\relax
     \oldtableofcontents
  \end{adjustwidth}
  \clearpage
}
share|improve this answer
    
I did not know the default \tableofcontents issues a \clearpage.. This works. Thanks a lot, egreg! –  YIchun Oct 22 '11 at 18:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.