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 want to include some pages of a pdf file into my document and wrap them into a figure with a caption for example (with pdfpages)

\begin{figure}[h]
   \centering      
   \includepdf[pages={1,3,2},nup=2x2]{test.pdf}      
 \caption{Test}
 \label{fig:Test}
\end{figure}

However this doesn't work. So is there another way to do this?

share|improve this question
4  
Yes, you need to include these the "traditional" way, via \includegraphics on an image-by-image (or page-by-page) way. Also, \label should be after \caption always. –  Werner May 29 '12 at 12:16
    
@Werner Can \includegraphics select a particular page from a pdf-file? I also tried to to something like \includgraphics{\includepdf{...}}. –  student May 29 '12 at 12:18
3  
Yes, \includegraphics[page=1]{file}, for example. –  Werner May 29 '12 at 12:18

3 Answers 3

up vote 14 down vote accepted

As already said by others in the comments you need to use \includegraphics directly because \includepdf uses a page of its own. You can use a tabular to get the 2x2 layout and use the page=<number> key to select the page:

\documentclass{article}

\usepackage{graphicx}
\usepackage{blindtext}

\begin{document}
\blindtext

\begin{figure}[h]
   \centering
   \begin{tabular}{@{}c@{\hspace{.5cm}}c@{}}
       \includegraphics[page=1,width=.45\textwidth]{somemultipagepdf} & 
       \includegraphics[page=2,width=.45\textwidth]{somemultipagepdf} \\[.5cm]
       \includegraphics[page=3,width=.45\textwidth]{somemultipagepdf} \\
   \end{tabular}
 \caption{Test}
 \label{fig:Test}
\end{figure}

\blindtext
\end{document}
share|improve this answer

pdfpages typically inserts page breaks before inserting content, causing problems if you want to have an arrangement if pages inside a figure environment. Instead, use the page key-value of \includegraphics itself to insert the contents on a page-by-page basis. Something like this:

\begin{figure}[ht]
  \centering
  \includegraphics[page=1,width=.3\textwidth]{test} \hspace*{.25/textwidth}%
  \includegraphics[page=3,width=.3\textwidth]{test}

  \includegraphics[page=2,width=.3\textwidth]{test}
  \caption{Test}
  \label{fig:Test}
\end{figure}

If you want the last "image" (page=2) to be shown in a nup=2x2 fashion, you could add \hspace*{.55\textwidth} after it, otherwise it will be horizontally centred below the two "images" (page=1 and page=3) above it.

Of course, you can play with the width adjustment to suit your liking.

share|improve this answer

It works if the figure environment is not used.

Simply put

\includepdf[pages=-]{test.pdf}   

The only problem is that the captions need to be provided with \captionof but then may not appear on the last page of the pdf included.

share|improve this answer
    
The only reason to use figure environment in this case was to use captions and labels correctly. If there is a way to get the captions correctly on the last page or each of the pages, please add that solution. \captionof works but is not on same page as the table. –  Anusha Sep 28 at 8:22

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.