TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My document has a table of content in it. As i found out, after inserting one (\tableofcontents) LaTeX does a \clearpage by default.

A method to ignore \clearpage is the command \let\clearpage\relax, witch ignores it till the end of the document. Although i have no other command in my doc, my last page got erased. So i want to reactive \clearpage right after the toc was generated.

I am searching for something like:

\*reactive it*

One try to do it with \begingroup failed.


Any ideas?

share|improve this question
the group version you have should have worked – David Carlisle May 8 '14 at 17:46
Any idea why it did not? – Gary Klasen May 8 '14 at 17:47
Given your extensive test case and minimal working example:-) ? no idea at all. – David Carlisle May 8 '14 at 17:51
@DavidCarlisle: I am afraid, but using a minimally possible example (class book, just a dummy chapter and grouping as the OP proposed) -- it really fails :-( – Christian Hupfer May 8 '14 at 17:54
@ChristianHupfer "fails" meaning what? This puts aaa th etable of contents and bbb on the same page: \documentclass{book} \begin{document} aaa aaaaaaaaaaaaaaaaa \begingroup \let\clearpage\relax \tableofcontents \endgroup bbb bbbbbbbbbbbbbbbb \chapter{xx} 111 \chapter{yy} 222 \end{document} – David Carlisle May 8 '14 at 18:04
up vote 6 down vote accepted

At least with the document class book, quick testing suggests that \tableofcontents doesn't insert a \clearpage, but \chapter does. Thus, you have to put your group with \let\clearpage\relax around the first \chapter command (or whatever you have that's similar) after your \tableofcontents. The following example, for instance, typesets on one page:




\chapter{Hello, world!}
And goodbye.


The above document rendering on one page (without the page number).

The old answer, which answers the asked question but doesn't solve the problem (and anyway, you should usually use \begingroup\endgroup instead).

You can save and restore \clearpage:


\let just defines a command to be a duplicate of an existing one, so:

  1. \let\oldclearpage\clearpage makes \oldclearpage equivalent to \clearpage.
  2. \let\clearpage\relax makes \clearpage equivalent to \relax, which is a do-nothing command.
  3. \tableofcontents runs, with its \clearpages doing nothing.
  4. Finally, \let\clearpage\oldclearpage makes \clearpage equivalent to \oldclearpage, which is equivalent to the original \clearpage.
share|improve this answer
I dont know why, but this did not work... – Gary Klasen May 8 '14 at 17:47
@GaryKlasen: I should have realized that, since your \begingroup\endgroup version should have worked. Perhaps some command after the \tableofcontents is the one issuing the \clearpage – have you tried making the group enclose more commands? – Antal Spector-Zabusky May 8 '14 at 17:49
@AntalS-Z: I had the same idea you and Przemyslaw had, but if there is no restore to the old \clearpage command, a call to eventuall second chapters fails... – Christian Hupfer May 8 '14 at 17:51
does including external .tex-data causing one? – Gary Klasen May 8 '14 at 17:52
Okay, solved. Just followed your instructions, but used \let\clearpage\oldclearpage a lot later. – Gary Klasen May 8 '14 at 18:01
%\*reactive it*
share|improve this answer
I'm afraid Antal S-Z got there first, with a more detailed explanation. – Jubobs May 8 '14 at 17:51

Your Answer


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.