[Tex/LaTex] Adding caption with minipages to \includepdf figure page

minipagepdfpages

I have a pdf file with \includepdf as a latex page. I am trying to add an caption to it. I tried using minipage, but the capture shows up randomly on the graphic. Is there a way for me to put it at the top or bottom and squeeze the image in the area below or above it?

\begin{minipage}[c]{1.5\textwidth}
\includepdf[pages={1}, scale=1]{fusion_app.pdf}
\captionof{figure}{Caption for image}
\end{minipage}
\includepdf[pages=2-6, scale=1]{fusion_app.pdf}

Best Answer

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}

example inclusion

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}

with <code>picturecommand*</code>

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.

Related Question