The following code typesets a 12 page document; text only appears on every other page and there's an empty page between two text pages:
\documentclass{article}
\usepackage{atbegshi}
\usepackage{lipsum}
\makeatletter
\AtBeginShipout{%
\ifodd\c@page
\begingroup
\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox
\global\AtBegShi@Discardedtrue
\mbox{}\thispagestyle{empty}\clearpage
\endgroup
\else
\fi%
}
\makeatother
\begin{document}
\lipsum[1-30]
\end{document}
Now I am trying to number sequentially the pages with text in them; with the code above pages with text are numbered 1,3,5,... but I would like them to be 1,2,3,... I did some attempts but none of them produced the desired result. How can I achieve the consecutive numbering?
The idea is to wrap this into a command that will allow to change the behaviour of the text flow inside a group: when invoked, the command will cause the text to be typeset in every other page but maintaining the consecutive numbering for the pages with text; once the group ends the text and numbering must return to their normal behaviour.
\shipoutinside\AtBeginShipout. An empty page can output by\AtBeginShipoutOriginalShipout\null(absolute page counters have to be corrected manually).\clearpagemight even add further float pages. – Heiko Oberdiek Aug 19 '12 at 6:22\labelbased approaches like\checkoddpageare not needed. – Heiko Oberdiek Aug 19 '12 at 6:24\shipoutinside\AtBeginShipout? Why don't you recommend doing so? – Gonzalo Medina Aug 19 '12 at 13:35\clearpage. Thus it can happen that in the middle of shipping out a page material is added somewhere later and the output routine is called again and might want to ship out a page while shipping out a previous page. A mess already.atbegshiis not reentrant, one of the reasons are possible global assignments of the shipout box. – Heiko Oberdiek Aug 19 '12 at 14:02