0

I'm using pdfpages package to insert some pages from a pdf file.

I'm using the following options within \includepdf

openright=false,%
frame=true,%
trim=3.5cm 2.8cm 3.5cm 5cm,%
clip,%
scale=.4,%

so that the frame is very small comparing with the text body. But the problem is that the page is being inserted in another page and so the section title is on a single page.

In other words, I'm doing this:

\newpage
\section{foo}\label{foo}
\includepdf[%
openright=false,%
frame=true,%
trim=3.5cm 2.8cm 3.5cm 5cm,%
clip,%
scale=.4,%
pages=1,%
pagecommand={},%
]{myfile}

but the output is (showframe only to prove that the box fits inside the text area)

enter image description here

I tried to check the sty file to see if there is some \newpage but no success.

Any idea how to avoid inserting new page?

  • 2
    Use \includegraphics. \includepdf is for pages. – Ulrike Fischer Aug 24 '15 at 11:39
  • 1
    \includepdf[% openright=false,% frame=true,% trim=3.5cm 2.8cm 3.5cm 5cm,% clip,% scale=.4,% pages=1,% pagecommand={\section{foo}\label{foo}},% ]{myfile} – touhami Aug 24 '15 at 11:45
  • 2
    You don't want the graphic to ocupy the whole page. So you are not including a page, you are including a graphic. So why not using \includegraphics? But the suggestion of touhami should work too. – Ulrike Fischer Aug 24 '15 at 11:52
  • 1
    Perhaps my answer might be helpful. It is for chapters but could be adapted for sections provided you are always starting a new page before the first section title/PDF i.e. it will only avoid page breaks within the set of {section heading, PDF pages added}. You still will get a page break before, if there is other stuff before the \section, and/or after, if there is other stuff after the final PDF page is added. Harish Kumar's answer shows how to use \includegraphics. – cfr Aug 24 '15 at 11:57
  • 1
    You can insert one specific page with page=X. – Ulrike Fischer Aug 24 '15 at 15:43
1

pdfpages doc

pagecommand Declares LATEX commands, which are executed on each sheet of paper. (Default: pagecommand={\thispagestyle{empty}})

Here what we need is

\includepdf[%
openright=false,%
frame=true,%
trim=3.5cm 2.8cm 3.5cm 5cm,%
clip,%
scale=.4,%
pages=1,%
pagecommand={\section{foo}\label{foo}},%
]{myfile}

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.