3

In the line of this post, I am looking for a way to compile a large document (~400 pages with 10 chapters) into a single pdf file and one additional pdf file per chapter.

Currently, I use pdftk to manually split the large pdf file after its pdflatex compilation. However, this is tedious in the sense that the page split may vary (addition in chapter 1 will shift page numbers of following chapters...).

Is there a way to compile a latex file between two labels for instance ? Ideally I would like to keep hyperlinks active in the final sub-pdf files (which is the advantage of pdftk...).

The only thing I can think of is the use of \ifnum in order to consider specific parts of the document but this will necessarily break all hyperlinks.

Alain
  • 954
  • 1
    Effectively you need multiple runs. You could do that with a shell script or something similar and say, your chapters are numbered with file-0.tex, file-1.tex, etc. you could give it a jobname like 0 and it would use the jobname for doing an \includeonly. – TeXnician Jun 09 '17 at 12:12
  • @TeXnician I see but I believe this would break the hyperlinks between chapters which is a problem. – Alain Jun 09 '17 at 12:21
  • How do you imagine hyperlinks between chapters that aren't in the PDF? What should they show? – TeXnician Jun 09 '17 at 14:12
  • Well let's say I have a link from chapter 2 to chapter 9 ",see chap. 9". If I make distinct compilations, my link will show up as ",see chap. ??". This is what I would like to avoid. – Alain Jun 09 '17 at 14:51
  • @JohnKormylo That's what I thought too as I suggested it. – TeXnician Jun 10 '17 at 16:24
  • I'm sorry I don't have time to elaborate in this, but my idea would be to write the pagenumber at each new chapter in an external file, and to use this as an input of your pdftk script – ebosi Jun 10 '17 at 23:02

0 Answers0