When I try to compile the file, I get this error message:


Package pdfpages Error: Cannot find file `-'. \includepdf[pages=-]{file.pdf}

When I change \includepdf[pages=-]{file.pdf} to \includepdf[pages={1}]{file.pdf} it will print the first page or any other page I want. It also does not work and show the error message when I try to print pages 7-11, so anytime I put - sign I get the message.

Does anyone know, why is that and how to fix it? Thanks.

  • 2
    Can you post a full example? That's the correct syntax and should work. Is it possible your editor is changing - to some other character?
    – Teepeemm
    Mar 17 '18 at 22:15
  • Did you try to compile via command line (rather than via a GUI) ? Result ?
    – user139954
    Mar 17 '18 at 22:18
  • \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[czech]{babel} \usepackage{geometry} \usepackage{graphicx} \usepackage{makeidx} \usepackage{hyperref} \usepackage{pdfpages} \begin{document} \includepdf[pages={-}]{file.pdf} \end{document}
    – Jump
    Mar 17 '18 at 22:21
  • "Did you try to compile via command line (rather than via a GUI) ? Result?" No I did not
    – Jump
    Mar 17 '18 at 22:22
  • try without \usepackage[czech]{babel} if that is the issue add \shorthandoff{-} just before the image inclusion to make - safe Mar 17 '18 at 22:26

Unfortunately - is made into an active shorthand character by the czech babel option, you can use


Just before the pdf inclusion to make - safe again. Normally this is inside a group so - will regain its babel meaning, or you could use \shorthandon to explicitly reset it.

  • Most of the times I get amazed how @david-carlisle spots the problem, saving many hours of my life by the his answers.
    – Shahryar
    Aug 16 '19 at 9:34

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.