tags:

views:

253

answers:

2

In my document I include a PDF using

\includepdf[pages=-]{./mypdf.pdf}

The problem I'm having is how to add a TOC entry for this pdf.

It supposed to be an appendix. I tried adding a new section in the appendix but of course the section name can't be printed on the same page than the included pdf, so the resulting TOC line directs to a wrong page.

if I use \addcontentsline I loose the numbering and the page is wrong too because the included pdf actually starts at the next page...

I'm a bit lost here so I would really appreciate if someone knows how to do this.

note: the pdf I try to include was not generated from LaTex.

Thanks in advance.

A: 

Have you tried

\section[text for toc]{text for document}

in your case

\section[text for toc]{}

to suppress the output in the document.

aioobe
That adds a line in the TOC with the right label but it still points to the wrong page, and even if the label isn't printed in the document, the appendix number still is ^^That's why it still points to the wrong page.Isn't there a way to force the page number on which a toc label points?
Heyyou'reQt
Do you have a .toc file? You could try to edit that before the final compilation ..
aioobe
+3  A: 

From the documentation of pdfpages (page 6) it looks like there is an experimental tag called addtotoc. I think you'd use it like:

\includepdf[pages=-, addtotoc={<page number>, section, 1, <heading>, <label>}]

Where <page number> is the desired page number (edit) to link to, <heading> is the title in the TOC, and <label> is how you may \ref to the section.

Geoff
Thanks a lot, that's exactly the option I was looking for... I feel stupid not having looked inside the doc the pdfpages package...EDIT: <page number> is the number of the page that should be used as the reference in the TOC (so it's 1 most of the time)
Heyyou'reQt
Thanks for following up, I altered the answer to be more accurate.
Geoff