Alternative: Use tcolorbox
(Gonzalo Medina was proposing it while I wrote this answer ;-)) with the breakable
option. There is a huge number of options for the shape, colours etc -- it's impossible to show them all here in a small example.
\documentclass{article}
\PassOptionsToPackage{svgnames}{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{blindtext}
\newtcbtheorem[auto counter]{example}{My Example}{arc=0pt, auto outer arc, breakable,left=2pt,right=2pt,colback=LightBlue,colbacktitle=LightBlue,coltitle=black,title after break={Continued from Example \thetcbcounter},titlerule=0pt}{examples}
\begin{document}
In \ref{examples:brontosaurs}, we will see that...
\begin{example}{Theory on Brontosaurs}{brontosaurs}
\blindtext[20]
\end{example}
\end{document}
Option 1
Use \includegraphics
for the page which needs the caption. It doesn't matter if this is the first page or not. Here, I exclude the first two pages of a seven page PDF, add a caption when including page three with \includegraphics
, and then use \includepdf
to include the next three pages. But you can mix and match as you please.
You can't include multiple pages at once with \includegraphics
. If you need text repeated on multiple pages, use the pagecommand
or picture
keys provided by pdfpages
. But I gather this is not required from you non-working example code.
\documentclass[a4paper]{article}
\usepackage{pdfpages,caption,geometry}
\begin{document}
\verb|mypages| is a 7 page document.
The first page is red, the second orange, the third yellow and so on through the rainbow.
\newgeometry{scale=1}
\thispagestyle{empty}
{%
\centering
\includegraphics[page=3,scale=.95]{mypages}
\captionof{figure}{Page 3 in the original.}
\par
}
\includepdf[pages={4-6}]{mypages}
\restoregeometry
This should be back to normal.
\end{document}
Option 2
Use picturecommand
, picturecommand*
or pagecommand
. picturecommand*
affects only the first page. The others affect all pages.
\documentclass[a4paper]{article}
\usepackage{pdfpages,geometry,calc}
\begin{document}
\verb|mypages| is a 7 page document.
The first page is red, the second orange, the third yellow and so on through the rainbow.
\includepdf[pages=3-6,scale=.9,picturecommand*={\put (\LenToUnit{.05\paperwidth},20) {Page 3 in the original.};}]{mypages}
This should be back to normal.
\end{document}
Note the only reason these are now uniform is that I've scaled all pages by the same amount. You could equally do this with Option 1.
Best Answer
Here is a primitive model to be served as a starting point.