The documentation says the following:

E.g.: pages=- will insert all pages of the document [...]

however, when I put \includepdf[pages=-]{foobar.pdf} in my LaTeX doc (compiled w/ xelatex), I get this error:

! Package pdfpages Error: Cannot find file `-'.

Similarly, just using a range like \includepdf[pages={1,3,5-last}]{foobar.pdf} results in:

 <use  "foobar.pdf" >
! Missing = inserted for \ifnum.
<to be read again> 
l.91 ...df[pages={1,3,5-last}]{foobar.pdf}

I'm using the latest pdfpages downloaded from CTAN.

Any idea where could the problem lie?



  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Feb 28 '15 at 10:57
  • In my experiment, lines like \includepdf[pages=-]{foobar.pdf} and \includepdf[pages={1,3-5}]{foobar.pdf} succeed, but I get failure when I try pages={1,3-last}. – egreg Feb 28 '15 at 11:03
  • @egreg Same on my side. It looks like there is some issue with ppxetex.def – karlkoeller Feb 28 '15 at 11:04
  • @egreg The error actually appears even when using "defined" ranges like 3-5 at my end. – Tomáš M. Feb 28 '15 at 11:11
  • 1
    @TomášM. Now it's clear! The problem is of course \usepackage[czech]{babel}! But there's hope, don't worry. – egreg Feb 28 '15 at 11:16

The problem is the same as in Slovak (and Czech) babel gives problems with cmidrule and cline: the czech option to babel makes the - character into a shorthand and this disrupts the working of the pages option.

Quick fix:


Better fix:







Note that, for some reasons, the last keyword doesn't work with XeLaTeX, but specifying 3- instead of 3-last is fine.

  • Today the command "\includepdf[pages={1,3-4}]{largefrac.pdf}" help me a lot. Thanks – tiankonghewo Jun 10 '16 at 19:01

I just copile this code and it work very good


for the second problem use

  • 1
    Try to use pages={1,3-last} and compile with xelatex – karlkoeller Feb 28 '15 at 11:06
  • that does not work but pages={1,3-} do the job – touhami Feb 28 '15 at 11:11
  • This does not answer the question, anyway. – karlkoeller Feb 28 '15 at 11:12
  • Why? help me to see the problem – touhami Feb 28 '15 at 11:14
  • @touhami The same code doesn't work on my end. – Tomáš M. Feb 28 '15 at 11:14

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.