A weird problem with pdfpages and table of contents

pdfpages

Never happened to me before: I'm trying to insert a pdf file using pdfpages and also create a TOC entry as a chapter. But the first page of the inserted file then overlaps with the second page. No such problem if I don't use tableofcontents or if the inclusion in TOC is at the level of sections. MWE:

\documentclass[12pt,a4paper,oneside]{report}
\usepackage{pdfpages}
\begin{document}
\tableofcontents
\includepdf[noautoscale=false,nup=1x2,pages={1-},landscape=true,addtotoc={1,chapter,1,{PDF file included},pdffile}]{PDFfile}
\end{document}

If I replace "chapter" with "secton", the problem disappears (but the TOC line is unsatisfactory). If the first number in addtotoc is 3 or above, the problem disappears (but the result is unsatisfactory).

Any ideas? Unfortunately, I don't have a second machine here to test if this is something specific to my installation.

Best Answer

No idea why it happens. Anyway, a workaround seems to be adding something invisible between the TOC and the included file.

\documentclass[12pt,a4paper,oneside]{report}
\usepackage{pdfpages}

\begin{document}

\tableofcontents

\mbox{}

\includepdf[
  noautoscale=false,
  nup=1x2,
  pages=-,
  landscape=true,
  addtotoc={1,chapter,0,{PDF file included},pdffile}
]{\jobname fake}

\end{document}

enter image description here

The “fake” file has eight pages.

Related Question