Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am embedding full pages from another PDF document (using the pdfpages package), but I would like to be able to declare my own section headings before each embedded document (for e.g. hyperlinking / TOC purposes). pdfpages has an experimental feature which lets me do this, but the problem is that I want to put all of these embedded documents inside a section, so I need to insert a section heading and a subsection heading on the first document I embed. Unfortunately pdfpages doesn't seem to be able to do this. Is there a way for me to do this?

Edit: Thank you for the suggestions. I am also in need of something similar for general labels — at the moment I am abusing the addtolist option of \includePDF but the objects I'm labelling aren't really figures or tables.

share|improve this question
Did you try \phantomsection\addcontentsline{toc}{section}{Title}? –  egreg Apr 17 '11 at 9:37
Invisible? I understand the text of your question that you wish to insert your own headings, which I would expect to be visible. –  Stefan Kottwitz Apr 17 '11 at 10:02
@egreg Works perfectly. Thanks. If you post it as an answer I'll accept. –  Zhen Lin Apr 17 '11 at 10:04
@Stefan: I can edit the documents being embedded to have the text of the correct heading, but what I really need is for \pageref etc. to work correctly. –  Zhen Lin Apr 17 '11 at 10:05
Your problem in Edit is not clear. What needs to be labeled? I'd also suggest to create a new question for this. –  Christian Lindig Apr 17 '11 at 11:42

2 Answers 2

You can create entries in the table of contents (TOC) when importing a PDF. Here is an example:


     1,section,1,First Section Entry,p1,   
     1,subsection,1,Subsection Entry,p2,
     2,section,1,Second Section Entry,p3}]

Parameters for each TOC entry are:

  • Page number relative to the first page of the included document
  • Level for the TOC entry
  • Not sure – who knows?
  • TOC entry
  • Label for the entry

You can create two entries for a single page on different levels (like section and subsection). The first two entries go the same page. A label (like p2) can be used to refer to a page that is part of the included PDF.

share|improve this answer
That was exactly what I tried to do, but having two entries for the same page didn't seem to work. –  Zhen Lin Apr 17 '11 at 10:35
thanks for the toc option reference. –  umar Jun 4 '11 at 12:24
The third field is for the depth of the section. 1 for section level, 2 for subsection level ... –  Sohaib Afifi Sep 4 at 14:22

You could use the pagecommand option of \includepdf:


Extend pagecommand as desired. The second \includepdf line includes the remaining pages without the page command.

You could also use the pagecommand option for setting hyperlink targets or bookmarks using commands of hyperref or bookmark there and also for \addcontentsline of \addtocontents if desired.

share|improve this answer
Ah. That's quite clever... but my first document has only one page. (I'm also having trouble with including multi-page PDF documents — not sure if that's a problem with my source material or the package itself...) –  Zhen Lin Apr 17 '11 at 10:01
@Zhen Lin: then you can omit the 2nd line. Regarding other trouble with multi-page inclusion you could describe that in another question, perhaps somebody is able to help. –  Stefan Kottwitz Apr 17 '11 at 10:06
Genius, this feels like the slightly more elegant way of doing this. –  Nick Hawes May 15 '13 at 22:30

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.