6

How can I fix a content (textblock, minipage, etc.) to be on a specific page an let the main text flow from page no 1 directly to page no 3 (i.e. skip page no 2)?

It is for the impressum of a magazine resp. newspaper. It should appear on page two, top, but text is already starting at page one and should directly continue at page three. (I guess the question is shamefully stupid).

3 Answers3

7

The package afterpage allows the insertion of material at the beginning of the next page:

\documentclass{article}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\afterpage{%
  \textbf{\Huge Page Two}%
  \newpage
}
\lipsum[1-9]
\end{document}
Heiko Oberdiek
  • 271,626
5

In ConTeXt, you can use \startposponing[<pagenum>] to force content to appear on a specific page.

\starttext

\startpostponing[2] % Show content on page 2
  \startsection[title={This will appear on page 2}]
    \input ward
  \stopsection
  \page
\stoppostponing

\dorecurse{15}{\input knuth \par}

\stoptext

You can also use \startpostponing[+1] to force content to appear on the next page.

Aditya
  • 62,301
3

Since package multicol is used, the simple version with package afterpage does not work. The following method uses package atbegshi. Page 2 is given right after \begin{document} as first page. In \AtBeginShipout the page is not output, but stored in a box for later use. Then the normal text follows (page 1, 3, 4, …). If the third page is seen in \AtBeginShipout, the box with "page 2" is output before the third page. Also page numbering needs a fix to skip page 2.

\listfiles
\documentclass{article}
\usepackage{atbegshi}[2010/12/02]
\usepackage{zref-abspage}% only for counter "abspage"

\newbox\PageTwo
\AtBeginShipout{%
  % Store the first page
  \ifnum\value{abspage}=1 %
    \global\setbox\PageTwo=\box\AtBeginShipoutBox
    \AtBeginShipoutDiscard
  \fi
  % Output first page as "page 2" before page 3
  \ifnum\value{abspage}=3 %                     
    \AtBeginShipoutOriginalShipout\box\PageTwo
  \fi
}

% Fix page numbering, go directly from 1 to 3 
\makeatletter
\let\OrgStepCounter\stepcounter  
\renewcommand*{\stepcounter}[1]{%
  \expandafter\ifx\csname c@#1\endcsname\c@page
    \ifnum\value{#1}=1 %  
      \OrgStepCounter{#1}%
    \fi
  \fi
  \OrgStepCounter{#1}%
}
\makeatother

\usepackage{multicol}
\usepackage{lipsum}
\begin{document}
\setcounter{page}{2}
\textbf{\Huge Page Two}%
\newpage

\setcounter{page}{1}
\begin{multicols}{2}
\lipsum[1-9]   
\end{multicols}
\end{document}

The example is tested with TL and MiKTeX 2.9.

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
zref-abspage.sty    2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty    2012/04/04 v2.24 Module base for zref (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
multicol.sty    2011/06/27 v1.7a multicolumn formatting (FMi)
  lipsum.sty    2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
 ***********
Heiko Oberdiek
  • 271,626
  • I tried above code as is, but it gave errors (undefined control sequence. Page two is on page 3. – Thierry Blanc Aug 06 '12 at 09:54
  • The last word in the line after ! Undefined control sequence. is the undefined control sequence. Which versions do you use, see edited answer. – Heiko Oberdiek Aug 06 '12 at 10:32
  • ! Undefined control sequence. ...e}=3 \AtBeginShipoutOriginalShipout \box \PageTwo \fi l.43 \end{document} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. – Thierry Blanc Aug 06 '12 at 10:38
  • LaTeX Warning: You have requested, on input line 2, version 2010/12/02' of package atbegshi, but only version2008/07/31 v1.9 At begin shipout hook (HO)' is available. Maybe a version problem? – Thierry Blanc Aug 06 '12 at 10:42
  • You need a newer version of package atbegshi. It is part of bundle oberdiek. – Heiko Oberdiek Aug 06 '12 at 11:14
  • Updating is so complicated, so I did just overwrite the atbegshi.sty, texhash... and it works!Thanks a lot! – Thierry Blanc Aug 06 '12 at 12:42