TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using pdfjam to merge a large number of PDF files for subsequent printing. Because I don't want to have pages from different documents on the same physical sheet of paper, I want to issue a \cleardoublepage after every document (I have one page per sheet, but I'm printing double-sided). From the pdfjam source I found that the core of the call is \includepdfmerge[$miscOptions]{$filePageList}. So then the question is: is there any option for \includepdfmerge that will have the effect of \cleardoublepage before every inserted document?

I tried:

  • pdfjam --openright, but this simply unconditionally inserts an empty page before the first page of the document.
  • pdfjam --pagecommand '\\cleardoublepage', I had expected this to add empty pages between all pages (not what I want), but tried anyway; it fails with ! LaTeX Error: There's no line here to end..

Note: The reason I want a single PDF is because the actual process of sending the document to the printer is a bit involved, so I rather have one document with very many pages, than many small documents.

share|improve this question
To pass an option to \includepdfmerge use e.g. --pagecommand={\\cleardoublepage}. However, that will not do want you want, it is just a command executed between the output pages. What you really need to is rewrite the script so it produces a sequence of commands \includepdf[$options]{$file1}\clearpage\includepdf[$options]{$file2}.., which is not too hard a perl exercise, but is not really relevant to a latex site. – Andrew Swann Feb 23 '13 at 16:48
@AndrewSwann That's what I ended up doing in practice (it was small enough to do by hand), question is if I can do that in LaTeX by passing appropriate commands. – gerrit Feb 23 '13 at 17:50
You can do something similar in latex using one of the many looping constructs, there many examples on this site, but this would be using \includepdf. The \includepdfmerge has no such option and I see no simple modification you can make to its code to effect that. – Andrew Swann Feb 23 '13 at 20:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.