0

For my projectwork I'd like to add some attachments. I got this one:

\section*{A. Projektplan}
\includepdf[pages=-,scale=.85,pagecommand={}]{Anlagen/Projektplan.pdf} 
\pagebreak

But Latex generates two sites instead of one side. On the first, there is only the heading. On the second there is only the included pdf file. How can I add those into one site?

  • Welcome to TeX.SX! If you cannot provide a full MWE , it is always helpful to include a screenshot or (meaningful) log messages. This makes it easier for others to understand your problem. In your case, i can only assume that the document you are trying to include is itself bigger than the default page size. Consider scaling it down further or crop the PDF so that it does not contain the default page margins. – barghest Aug 13 '15 at 11:16
  • as pdfpages only makes whole pages this is not really possible. Might be better to add the section and perhaps some intro text and then let \includepdf fill in the next pages. – daleif Aug 13 '15 at 11:19
  • @daleif: It's just an attachment with a heading. Not really usefull to insert some text. – jollepe Aug 13 '15 at 11:22
  • Have you tried using \includegraphics{Anlagen/Projektplan} instead? – barghest Aug 13 '15 at 11:25
1

The \includepdf command from the pdfpages package inserts the PDF as separate pages into the document. That way, you don't have to worry about margins, headers etc - it simply inserts the PDF pages 1:1 like they were.

If you want to embed the PDF on the page, i.e. to have headers, respect the margins of the document etc. you don't need \includepdf, but you can use \includegraphics. That way the PDF can be handeled like any other image. In your case that would be

\includegraphics[page=1,scale=.85]{Anlagen/Projektplan.pdf}

With that, you can only insert one page at a time. For a multi-page PDF, you would therefore need multiple \includegraphics commands.

Now there are several possibilities how to include the document:

  1. Include every page with \includegraphics (probably using a for loop). Still, not a very nice solution.
  2. Include the first page using \includegraphics to have the section heading, and include the rest with \pdfpages.
  3. Have the section heading on the first page, maybe add a short description, and then add all documents with \pdfpages (as you had before).
  • beat me by four seconds ;) good answer though! – barghest Aug 13 '15 at 11:26
1

You can use the pagecommand key to insert the section (probably you will need a suitable scale value):

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pagecommand=\section*{blbubla},scale=0.8]{example-image-a4}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.