Using a report
class with the twoside
and openright
options, I've defined a function, \mycentered[1]
, to display a vertically and horizontally aligned (at the center of the page) quote before the table of contents.
The text gets correctly displayed, and when \cleardoublepage
is used before \tableofcontents
just a blank page is inserted. But, if I use \newgometry
(provided by the geometry
package) between the page clearing and the table of contents, three blank pages are inserted. However, if I replace \mycentered
with some text, those pages are not inserted. How can avoid those two extra pages being added?
In the following MWE the pagestyle is also changed just to show that the aditional blank pages are introduced after the explicit \cleardoublepage
.
\documentclass[a4paper,twoside,openright]{report}
\usepackage[top=2cm,bottom=2cm]{geometry}
\newcommand\mycentered[1]{\topskip0pt\vspace*{\fill}{\centering#1\par}\vspace*{\fill}}
\def\mytextblock{
This is some text
with several paragraphs
}
\begin{document}
\pagestyle{empty}
\mycentered{\mytextblock}
\cleardoublepage
\pagestyle{plain}
\newgeometry{top=3cm,bottom=3cm}
\tableofcontents
\chapter{First}
\end{document}
I've tried removing \topskip0pt
and the blank pages issue is solved. But the content is not really centered, since some space is put in the top. It is not noticeable with not very long quotes, but the following image shows the difference if used to vertically center bigger blocks. On the left hand side the result with \topskip0pt
is shown, and on the right hand side the result without it is overlaid.
Best Answer
Explicitly compensating the
\topskip
, instead of setting it to0pt
, solved the problem and no extra space is put at the top.