3

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.

enter image description here

4
  • 2
    Remove \topskip0pt and you are on track.
    – user11232
    Commented Sep 27, 2014 at 8:11
  • I've just edited to add a picture with the difference when removing it. I'd prefer not to use tikz as you answered here, if possible. If not, I'll go for it.
    – umarcor
    Commented Sep 27, 2014 at 19:31
  • Use \topskip=0pt only locally for the selected page. I. e. enclose the body of \mycentered to braces: \newcommand\mycentered[1]{{\topskip0pt\vspace*{\fill}{\centering#1\par}\vspace*{\fill}}}
    – wipet
    Commented Sep 29, 2014 at 21:27
  • I tried, but it won't compile. Anyway, I found a solution (see answer below).
    – umarcor
    Commented Sep 29, 2014 at 21:46

1 Answer 1

1

Explicitly compensating the \topskip, instead of setting it to 0pt, solved the problem and no extra space is put at the top.

\newcommand\th@centered[1]{\hbox{}\vspace*{-\topskip}\vspace*{\fill}{\centering#1\par}\vspace{\fill}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .