1

I am embedding a pdf document in a report and want to add all the sections in table of contents. I used the method that is suggested here.

\includepdf[scale=0.8,pages=1-38,pagecommand={\thispagestyle{fancy}},
addtotoc={6-8, section, 1, {Introduction}, intro, 
8-9, section, 2, {Overview}, over,
9-14, section, 3, {Results}, res,
14-15, section, 4, {Discussion}, dis, 
15-16, section,5, {Implications}, imp, 
16-17, section, 6, {Limits}, lim,
18-19,section,7,{Methods and Analysis},met,
18-19,subsection,1,{Participants},met1,
18-20,subsection,2,{Survey},met2,
20-24,section,8,{Analysis},an,
24-32,section,9,{References},ref,
33-38,section,10,{Suplement},sup}]{a.pdf}

The problem is my sections are not numbered in TOC after section 3. I couldn't solve it unfortunately, is there a way to fix it?

2

Using the sample you provide, I get an error "Page number in option addtoc is not a number". The link that you provide above demonstrates the correct use of the command. The solution here is to state only the page at which your section starts and that the third number is not the number you want to appear in the toc, but the depth of the entry:

\includepdf[scale=0.8,pages=1-38,pagecommand={\thispagestyle{fancy}},
addtotoc={6, section, 1, {Introduction}, intro, 
8, section, 1, {Overview}, over,
9, section, 1, {Results}, res,
14, section, 1, {Discussion}, dis, 
15, section,1, {Implications}, imp, 
16, section, 1, {Limits}, lim,
18,section,1,{Methods and Analysis},met,
18,subsection,2,{Participants},met1,
18,subsection,2,{Survey},met2,
20,section,1,{Analysis},an,
24,section,1,{References},ref,
33,section,1,{Suplement},sup}]{a.pdf}
1
  • Yes, it works! I completely misinterpreted the depth of the entry.
    – fca
    Jan 8 at 8:12

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.