I am trying to create a pdf from a selection of pages from an existing pdf. Simply put, I want the resulting pdf to feature only a selection from the parent pdf. No added text from my side.

However, the pages are being positioned improperly. They are offset so that they are almost out of the page, they are much smaller in size. I am also getting a preposterous warning saying "filename.pdf not found.". Despite this warning, latex is compiling the file. It would've been impossible if the file really wasn't there.

Here is the MWE:

    \includepdf[pages = {11-15}]{Joern Pachl (2007) - Deadlock Avoidance In Railroad     Operations Simulations.pdf}

This is a really simple operation. I'm surprised that an error is occurring. There is perhaps a trivial error, but I am not able to find it.

  • 4
    Have you tried to include a pdf without spaces in its name? – user36296 Feb 27 '15 at 13:38
  • Welcome to TeX.SX! Can you add an image showing the problem? As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. – Andrew Swann Feb 27 '15 at 13:48
  • Yes. I have tried to include a pdf file without spaces, but latex has a problem with underscores outside of math environment. The file is being detected, as it is being rendered. It's just being rendered badly. For no apparent reason. – Aseem Awad Feb 28 '15 at 14:40
  • 1
    If it really says filename.pdf not found, that is most odd as that was not the name of the file. What exactly is the error message? My guess is part of the file name as it can't deal with the spaces. Underscores usually work OK. But you could always avoid both and eliminate brackets from the name, too. In general, all strange characters should be avoided in file and path names, including spaces, punctuation etc. – cfr Dec 28 '16 at 1:20

There are spaces in the file name:

  • Add \usepackage{grffile} to get some support for spaces in image file names (if pdflatex or xelatex is used).
  • Consecutive spaces are merged to one space by TeX. The name contains a sequence of five spaces. File names need expandable macros, \␣ or ~ will not work. But macro \space is expandable.

Full example:

\includepdf[pages = {1-3}]{Joern Pachl (2007) - Deadlock Avoidance In %
  Railroad \space\space\space\space Operations Simulations.pdf}

The space after the last \space terminates the command name and will be ignored.

Very likely the offset of the MWE in the question is generated by parts of the file name printed in the left of the page.


Use pdftk instead. From the terminal:

pdftk input-file.pdf cat 11-15 output output-file.pdf

pdftk man page

  • Hardly straightforward given the filename. What is the :~& meant to do? Note that pdftk is no longer maintained and increasingly unavailable. – cfr Dec 28 '16 at 1:21
  • :~$ stands for the beginning of the command line interface – Alessandro Cuttin Dec 28 '16 at 9:41
  • 1
    Given that varies wildly, wouldn't it be clearer not to? Lots of people will just try copy-pasting the code as-is. – cfr Dec 28 '16 at 21:26

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.