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 am using pdfpages which works quite well.

But this time, I want to include a 5 page pdf and the first page should be scaled down a bit such that above the first page is enough space for a subsection (in the LaTeX document).

Using just

\usepackage{pdfpages}
...

\subsection{Interesting Letter}
\includepdf{letter.pdf}

does not work, because includepdf inserts a newpage command before the first page.

I looked at the pdfpages manual but could not find options relating to that.

I hacked this command, which kind of works:

\newcommand{\insertrep}[1]{%
\hspace*{-2.4cm}
\fbox{\includegraphics[page=1,scale=0.8]{#1}}
\includepdf[scale=0.8,pages=2-,frame]{#1}
}

\subsection{Interesting Letter}
\insertrep{letter.pdf}

The subsection is printed on the same page as the first page of the pdf, but an empty page is inserted before the section ...

The empty page vanishes if I scale the first page to 0.5 - which is too small ...

It seems that \includegraphics inserts an empty page before the graphic, if the inserted graphic violates the margins of the page.

Besides, the hspace value does not always fit.

Thus, my question: How to solve this right?

share|improve this question
1  
Did you try just \includegraphics?: PDFs can be used as images by pdfTeX. –  Joseph Wright Nov 24 '10 at 17:35
    
@Joseph Wright, yes, like mentioned in the 2nd part of my post –  maxschlepzig Nov 24 '10 at 18:42

2 Answers 2

up vote 15 down vote accepted

You can use the pagecommand key:

\includepdf[scale=0.8,pages=1,pagecommand=\subsection{blub}]{testpdf}

You get the empty page when you use \includegraphics because the graphics is too large for the textbody, so latex tries if it fits on the next page (and then complain). pdfpages hides the size of the graphics so it is possible to insert complete pages which overwrites the margins. If you want to insert large graphics with \includegraphics: use eso-pic.

share|improve this answer
    
Unfortunately, what this actually does is insert a section on its own, and then inserts a pagebreak automatically - which means you cannot have any text between the subsection and the included pdf - even if you scaled it to something like 0.2 of the page... EDIT: actually ok - \def\excerpt{\section{Blah} .. \\ blah} and then pagecommand={\excerpt} works. Cheers! –  sdaau Jun 17 '12 at 17:54

For me the following worked just fine:

\includepdf[pages=1,pagecommand=\section{Section Heading}]{testpdf}
\includepdf[pages=2-,pagecommand={}]{testpdf}
share|improve this answer

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.