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.

To insert only a few pages of a PDF document to my latex document, I use this macro. The numbering of the pages in my document is not interrupted even if I customize the header-footer with fancyheader.

%%%% www.madit.be

%%%%%%%%%%%%%%%%%% macro
\newcommand{\myMultipdf}[3]{%args: {uri of pdf}{startpage}{endpage}
    \setcounter{myCurrentPage}{\number#2}%page start
    \setcounter{myLastPage}{(\number#3)+1}%last page    

\section{Some Text}


\section{Some insert of pdf pages}


\section{Some Text}


share|improve this question
Of course to use this example correctly, you must replace the foo.pdf by (1) a correct URI and (2) with the actual name of your document. –  madit Oct 3 '12 at 11:23
However i have 1 BadBox at compile : Overfull \hbox(15.0pt too wide). Who has an idea to avoid this? –  madit Oct 3 '12 at 11:31
I'm having trouble finding the question in your question. If your question is how to avoid the BadBox I believe you should update the question with that. –  Silex Oct 3 '12 at 12:08
@ Silex. No my first objective was'nt to ask something. Simply add small piece of code to the community. Early as newbies, I lost a lot of time to find an easy way to insert often PDF pages in a large syllabus. It is only sharing. But it is true that the most talented of you will find it a bit "light" ;-) –  madit Oct 3 '12 at 12:14
In that case you should formulate a question and add your solution as an answer. –  Stephan Lehmke Oct 3 '12 at 13:51
show 2 more comments

closed as not a real question by Lev Bishop, qubyte, Marco Daniel, diabonas, Stefan Kottwitz Oct 3 '12 at 16:36

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

The overfull \hbox is caused by \parindent. The graphics starts a new paragraph and the width is the line width. \noindent suppresses the paragraph indent:


For completeness. Also


keeps the head and foot lines of the original document. But the original document might contribute it own head and foot lines. The margins can be influenced to some degree by options trim, clip.

share|improve this answer
Indeed, the command \noindent suppresses bad box. Thanks for this tip. But I do not like the command "includepdf" because it causes a page break before insertion. With the following command, it is possible to insert a section on the same page, but unfortunately it is repeated on every page :-(. \includepdf [pages = 3-4, scale = 0.9, pagecommand = {\section {With includepdf}} ] {} foo.pdf And as includepdf documentation is very basic, so I ended up using this macro. –  madit Oct 3 '12 at 15:54
Thank you for having responding to my non-question... –  madit Oct 3 '12 at 18:06
add comment

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