Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Gregory
Posts: 3 Joined: Wed May 11, 2011 4:39 pm
Post
by Gregory » Wed May 11, 2011 4:48 pm
Hello,
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:
Code: Select all
\documentclass[11pt, onside, a4paper, openany]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}}
\newcommand{\headerfmt}[1]{\textsl{\textsf{#1}}}
\newcommand{\headerfmtpage}[1]{\textsf{#1}}
\fancyhf{}
\fancyhead[R]{\headerfmtpage{\thepage}}
\fancyhead[L]{\headerfmt{\rightmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\begin{document}
\frontmater
...
\tableofcontents
\mainmatter
...
\backmatter
...
\end{document}
Gregory
Posts: 3 Joined: Wed May 11, 2011 4:39 pm
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?
Gregory
meho_r
Posts: 823 Joined: Tue Aug 07, 2007 5:28 pm
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.
Code: Select all
\documentclass[11pt, onside, a4paper, openany]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}}
\newcommand{\headerfmt}[1]{\textsl{\textsf{#1}}}
\newcommand{\headerfmtpage}[1]{\textsf{#1}}
\fancyhf{}
\fancyhead[R]{\headerfmtpage{\thepage}}
\fancyhead[L]{\headerfmt{\rightmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\begin{document}
\frontmatter
\chapter{Front}
\tableofcontents
\mainmatter
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
\chapter{Main}
%\chapter{Main}
%\chapter{Main}
\backmatter
\chapter{Back}
\end{document}
woj-k
Posts: 15 Joined: Wed Jul 28, 2010 7:25 pm
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
Code: Select all
\newcommand\mainmatter{%
\cleardoublepage
\@mainmattertrue
\pagenumbering{arabic}}
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:
Code: Select all
\renewcommand\mainmatter{%
\clearpage
\@mainmattertrue
\pagenumbering{arabic}}
Gregory
Posts: 3 Joined: Wed May 11, 2011 4:39 pm
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:
Code: Select all
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:
Code: Select all
\renewcommand\mainmatter{%
\clearpage
\@mainmattertrue
\pagenumbering{arabic}}
Save "something.sty" into the same directory as your .tex file and load up the file in your .tex file:
Normally this will do it!
Stefan Kottwitz
Site Admin
Posts: 10290 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Thu May 12, 2011 11:11 pm
Hi Gregory,
\makeatletter should work directly:
Code: Select all
\makeatletter
\renewcommand\mainmatter{%
\clearpage
\@mainmattertrue
\pagenumbering{arabic}}
\makeatother
Stefan
LaTeX.org admin
Vilietha
Posts: 7 Joined: Sun Sep 25, 2011 9:13 pm
Post
by Vilietha » Wed Oct 12, 2011 11:03 am
Hello,
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".
Code: Select all
% Preamble
% *************************************************
\documentclass[10pt,a4paper,final]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{enumerate}
\usepackage{bbding}
\usepackage[acronym,nonumberlist]{glossaries}
\usepackage[intoc]{nomencl}
\usepackage{graphicx}
\usepackage[top=2.5cm, bottom=2.5cm, left=3cm, right=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
%\usepackage{natlib}
%\usepackage{cite}
\usepackage{lastpage}
\usepackage{titlesec}
\usepackage{epigraph}
\usepackage[T1]{fontenc}
\usepackage{calligra}
\makeglossaries
\makenomenclature
\graphicspath{{../Images/}}
\include{-1.0-preamble}
% Body
% ************************************************
\begin{document}
\input{0.1-title}
\tableofcontents
\include{0.6-abbrev}
\input{0.8-preface}
\end{document}
I look foward to your answers,
Vilietha
Vilietha
Posts: 7 Joined: Sun Sep 25, 2011 9:13 pm
Post
by Vilietha » Sat Oct 15, 2011 7:26 am
Hello again,
I solved the problem.
It is somewhat trivial.
I accidently used "\include" instead of "\input" for the abbreviations...
Best wishes,
Vilietha