LaTeX.org

LaTeX forum ⇒ Page Layout ⇒ Remove empty Page after ToC

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).

9 posts • Page 1 of 1 Gregory Posts: 3 Joined: Wed May 11, 2011 4:39 pm

Remove empty Page after ToC

Post by Gregory » Wed May 11, 2011 4:48 pm

I have the following problem: after the table of contents, there appears an extra empty page which is numbered and has the header "Content". I want to get rid of this page but I cannot find any solution for it. Does someone have any idea?

I use the following:

\documentclass[11pt, onside, a4paper, openany] \usepackage \pagestyle \renewcommand[1]<\markright<\thesection~#1>> \newcommand<\headerfmt>[1]>> \newcommand<\headerfmtpage>[1]> \fancyhf<> \fancyhead[R]<\headerfmtpage<\thepage>> \fancyhead[L]<\headerfmt<\rightmark>> \renewcommand<\headrulewidth> \renewcommand \begin \frontmater . \tableofcontents \mainmatter . \backmatter . \end

Recommended reading 2024:

LaTeX Beginner LaTeX Cookbook LaTeX TikZ graphics

meho_r Posts: 823 Joined: Tue Aug 07, 2007 5:28 pm

Remove empty Page after ToC

Post by meho_r » Wed May 11, 2011 5:26 pm

fancyhdr package manual, section 15. Gregory Posts: 3 Joined: Wed May 11, 2011 4:39 pm

Re: Remove empty Page after ToC

Post by Gregory » Wed May 11, 2011 5:43 pm

I tried it but this doesn't work (thanks anyhow).
The solution described in this manual is for the case when the option "openany" is NOT given, using documentclass book. In my code it IS given. Hence I do not have any white pages after each chapter. I only have one white page after the table of contents. But it is in fact not really empty, because it contains the header "CONTENTS" and a page number. And it is this useless page that I want to remove.
Other suggestions?

meho_r Posts: 823 Joined: Tue Aug 07, 2007 5:28 pm

Remove empty Page after ToC

Post by meho_r » Wed May 11, 2011 11:49 pm

I cannot reproduce the problem, the code you provided works fine. I added some chapters, but no empty page after TOC.

\documentclass[11pt, onside, a4paper, openany] \usepackage \pagestyle \renewcommand[1]<\markright<\thesection~#1>> \newcommand<\headerfmt>[1]>> \newcommand<\headerfmtpage>[1]> \fancyhf<> \fancyhead[R]<\headerfmtpage<\thepage>> \fancyhead[L]<\headerfmt<\rightmark>> \renewcommand<\headrulewidth> \renewcommand \begin \frontmatter \chapter \tableofcontents \mainmatter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter \chapter %\chapter %\chapter \backmatter \chapter \end woj-k Posts: 15 Joined: Wed Jul 28, 2010 7:25 pm

Remove empty Page after ToC

Post by woj-k » Wed May 11, 2011 11:52 pm

The empty page isn't put there by the ToC, but by \mainmatter. If you look inside the file "book.cls", you will find a definition that goes

\newcommand\mainmatter>

All you need is redefine \mainmatter with \clearpage instead of \cleardoublepage (in the preamble, say). That way \mainmatter will simply start a new page, without bothering if it's recto or verso (odd- or even-numbered). Put the following in your .tex file:

\renewcommand\mainmatter>
Gregory Posts: 3 Joined: Wed May 11, 2011 4:39 pm

Remove empty Page after ToC

Post by Gregory » Thu May 12, 2011 10:15 pm

Thank you very much. This solution indeed removes the extra white page.
But I want to make a note on it. If you insert the code like this in your .tex file you will get the following error:

You can't use `\spacefactor' in vertical mode \mainmatter

To fix this you must make a .sty file (let's say "something.sty") and copy the following code into it:

\renewcommand\mainmatter>

Save "something.sty" into the same directory as your .tex file and load up the file in your .tex file:

\usepackage

Normally this will do it!

Stefan Kottwitz Site Admin Posts: 10208 Joined: Mon Mar 10, 2008 9:44 pm

Remove empty Page after ToC

Post by Stefan Kottwitz » Thu May 12, 2011 11:11 pm

\makeatletter should work directly:

\makeatletter \renewcommand\mainmatter> \makeatother
LaTeX.org admin Vilietha Posts: 7 Joined: Sun Sep 25, 2011 9:13 pm

Remove empty Page after ToC

Post by Vilietha » Wed Oct 12, 2011 11:03 am

I have exactly the same problem, but I don't use the book class. I use the report class instead, and the above solution does not work for me because then I get the error "\mainmatter undefined".

% Preamble % ************************************************* \documentclass[10pt,a4paper,final] \usepackage[utf8] \usepackage \usepackage \usepackage \usepackage \usepackage \usepackage \usepackage \usepackage[acronym,nonumberlist] \usepackage[intoc] \usepackage \usepackage[top=2.5cm, bottom=2.5cm, left=3cm, right=2cm] \usepackage \usepackage %\usepackage %\usepackage \usepackage \usepackage \usepackage \usepackage[T1] \usepackage \makeglossaries \makenomenclature \graphicspath> \include % Body % ************************************************ \begin \input \tableofcontents \include \input \end

I look foward to your answers,
Vilietha