Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a larger document (book class) which should be typeset double-sided, i.e. with the twopage class option. However, in my appendix I have some technical diagrams which should not be printed double-sided but on an odd page with the following even page of the same sheet being empty, like it would be for a printed one-sided (onepage) document which is printed only on one side. These pages do not include a page number and are inserted using \includepdf (pdfpages package) or an \includegraphics with some extra commands around it.

How can I enable this pseudo-onepage mode? I might need to switch back to the normal mode for a later, different appendix. Basically an empty page must be inserted after every normal page. I don't want to manually add \clearpage\thispagestyle{empty}\cleardoublepage after every real page.

share|improve this question
add comment

4 Answers

This just prints on odd pages shipping out blank pages in between

\documentclass[twoside]{book}


\begin{document}

\makeatletter
\let\ol@outputpage\@outputpage
\def\@outputpage{%
\ifodd\c@page\else\shipout\vbox{}\advance\c@page\@ne\fi
\ol@outputpage}
\makeatother

\fbox{\parbox{3in}{1\vskip .7\textheight}}

\fbox{\parbox{3in}{2\vskip .7\textheight}}

\fbox{\parbox{3in}{3\vskip .7\textheight}}

and back to normal:

\makeatletter
\let\@outputpage\ol@outputpage
\makeatother

\fbox{\parbox{3in}{4\vskip .7\textheight}}

\fbox{\parbox{3in}{5\vskip .7\textheight}}

\fbox{\parbox{3in}{6\vskip .7\textheight}}

\end{document}
share|improve this answer
1  
My instinct was to use atbegshi package for this task. But then I saw David Carlisle's natural and stellar-motion solution. –  Ahmed Musa May 28 '12 at 3:28
    
Very nice solution! Like Ahmed I would have went with a shipout package. For the sake of completeness could you include that you can switch back to normal twoside mode with \let\@outputpage\ol@outputpage. –  Martin Scharrer May 28 '12 at 9:38
    
hooking into \shipout is too late if you want to affect the page number on the deferred page as the way latex sets things up, the header and footer are already boxed up by then, so you need to affect the box that is built before being passed to shipout. –  David Carlisle May 28 '12 at 9:47
    
How can I make the blank pages a different color? –  Nicholas Hamilton Nov 11 '13 at 14:05
add comment

the following example should do what you want. replace "dummyfig" by an actual figure file name of your choice. a similar construction will handle included pdf pages, but they'll have to be inserted one at a time.

\documentclass{book}
\usepackage{graphicx}

\newcommand{\onesidegraphic}[1]{%
  \cleardoublepage
  \includegraphics{#1}}

\begin{document}

some text, with page number

\newpage
some more text; this should be two-sided.

\clearpage
\pagestyle{empty}

\onesidegraphic{dummyfig}

this page and the following ones should be
one-sided and have no page numbers.

\onesidegraphic{dummyfig}
\onesidegraphic{dummyfig}
\end{document}
share|improve this answer
    
Thanks, but like I wrote I'm looking more for an automatic way where I don't have to change the used commands. I guess \afterpage can be used here. –  Martin Scharrer May 27 '12 at 18:52
    
okay. should i withdraw the answer? –  barbara beeton May 27 '12 at 21:54
    
I don't think so. Other people which find this question might prefer a manual approach. –  Martin Scharrer May 28 '12 at 9:35
add comment

David's point about the use of atbegshi in this case is important. This is what at atbegshi does (using the last kern trick, out of many by Heiko):

\shipout :=
  \begingroup
  \setbox\mybox=\hbox\bgroup
    \kern1pt
    \afterassignment\shipouttest
    \global\setbox\mybox=

\shipouttest :=
  \ifdim\lastkern=0pt % we have a 'direct box'
    \aftergroup\egroup
    \aftergroup\endgroup
    \aftergroup\@output
  \else
    \egroup
    \endgroup
    \@output
  \fi

Within \shipouttest it is too late to do what Martin wanted.

By the way, in my own use case, I would like to have a rubric on the blank page. So I did

\documentclass[twoside]{book}
\begin{document}

\makeatletter
\def\blankpage@hook{}
\protected\def\addtoblankpage{\g@addto@macro\blankpage@hook}
\let\old@outputpage\@outputpage
\protected\def\@outputpage{%
  \ifodd\c@page\else
    \shipout\vbox{%
      \begingroup
      \setbox\z@=\vbox{\blankpage@hook}%
      \ifdim\ht0>\dimexpr\vsize-\baselineskip\relax
        \@latexerr{The content of `blank page' is too high}\@ehd
      \else
        \box\z@
      \fi
      \endgroup
    }%
    \advance\c@page\@ne
  \fi
  \old@outputpage
}

\makeatother

\addtoblankpage{%
  \vskip.5\textheight
  \textbf{Page \thepage.}
  This page was intentionally left blank.
}

% Content too high:
% \addtoblankpage{\fbox{\parbox{3in}{1\vskip .9\textheight}}}

\fbox{\parbox{3in}{1\vskip .9\textheight}}

\fbox{\parbox{3in}{3\vskip .9\textheight}}

\fbox{\parbox{3in}{5\vskip .9\textheight}}

\fbox{\parbox{3in}{7\vskip .9\textheight}}

\fbox{\parbox{3in}{9\vskip .9\textheight}}

\end{document}
share|improve this answer
add comment

FWIW, here is how you switch to singlesided layout in ConTeXt.

\setuppagenumbering[alternative=doublesided, location=outermargin]

\starttext
\dorecurse{3}{ \chapter{Test \recurselevel} \input knuth \page }

\page[right] % Start with a right page
\setuppagenumbering[alternative=singlesided] %switch to singlesided

\dorecurse{3}{ \chapter{Test \recurselevel} \input knuth \page }
\stoptext
share|improve this answer
add comment

Your Answer

 
discard

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.