1

I know how to include single pages of one document as images in another document.

\documentclass{scrartcl}

\usepackage{filecontents}
\begin{filecontents*}{file.tex}
  \documentclass{scrartcl}
  \usepackage{lipsum}

  \begin{document}
  \lipsum[1-100]
  \end{document}
\end{filecontents*}

\usepackage{graphicx}
\newcommand\page[1]{
  \frame{\includegraphics[page=#1, scale=.2]{file.pdf}}
}

\begin{document}
\begin{figure}
  \centering
  \page{1}\page{2} \\
  \page{3}\page{4}
  \caption{Pages}
\end{figure}
\end{document}

But I struggle with including the whole file.pdf without knowing how many pages it consists of.

I already tinkered with pdfpages to replace graphicx, but have difficulties of containing the imported pages in the floating environment then. Wrapping \includepdf into a minipage does not alleviate this problem.

How can I display the pages of a pdf in a figure?

XZS
  • 2,953
  • What is \frame? The beamer frame command? –  Sep 25 '15 at 19:33
  • @ChristianHupfer \frame just puts a border around the pdf content so they are more clearly recognizable as pages against the white background. – XZS Sep 25 '15 at 19:35
  • 1
    What about \includepdf ? – Romain Picot Sep 25 '15 at 19:37
  • @RomainPicot see the paragraph about pdfpages. It seems \includepdf does not like to be put into floats. – XZS Sep 25 '15 at 19:39
  • 1
    @XZS Yes, but where does \frame come from? –  Sep 25 '15 at 19:39
  • @XZS: Please make a working example instead of fragments. –  Sep 25 '15 at 19:40
  • You should edit to put the complete MWE with the preamble you used ;-) – Romain Picot Sep 25 '15 at 19:41
  • @ChristianHupfer From this answer here: http://tex.stackexchange.com/a/20715/17129 That is all I know about it... – XZS Sep 25 '15 at 19:45
  • MWE now complete with file.tex. – XZS Sep 25 '15 at 19:50
  • With \includepdf this might be a layout issue only –  Sep 25 '15 at 19:51
  • @ChristianHupfer \includepdf seems to hog the whole page to itself, overlaying the caption, surrounding text and ignoring any positioning, to only name a few problems. I am open to an \includepdf solution, if you manage to find one. – XZS Sep 25 '15 at 19:57
  • it's not clear, is each page of your document only one figure of 4 pages with caption pages? nothing else? – touhami Sep 25 '15 at 20:38
  • @touhami The figure should be part of a much bigger document. I left out the surrounding text in the MWE here. All pages of the included file.pdf should end up inside the same figure. I hope this clarifies. – XZS Sep 25 '15 at 20:41
  • ok, use a new document tempfile.tex like this \documentclass{scrartcl} \usepackage{pdfpages} \begin{document} \includepdf[nup=4x6,frame,pages=-]{file.pdf} \end{document} you can use 6x6 or whatever to make all file.pdf's pages in one page pdf file and than use it with \includegraphics – touhami Sep 25 '15 at 21:15
  • @touhami: you should answer this question! –  Sep 25 '15 at 21:42
  • @ChristianHupfer please, if you think so you can make it an answer, you can add some explanation that make it more helpfull than I can. – touhami Sep 25 '15 at 21:53
  • @touhami: No, you've found the nup=... option -- I did not find it in the manual (however, I did not test your suggestion) –  Sep 25 '15 at 21:55
  • see this related question http://tex.stackexchange.com/questions/8316/how-to-know-the-number-of-pages-in-a-pdf-file and you can use the option height rather then scale. – touhami Sep 25 '15 at 22:32

0 Answers0