15

I have a quite huge thesis-latex-document with lots of references to the appendix. The whole document I would like to split into two pdf-files. That means: I would like to have the thesis and the appendix as separate .pdf-outputs with own titlepages but the references in the main document leading to the appendix, so I can print out two independent documents.

The reason is: The main file is my thesis, the appendix is - obviously - the appendix that is not actually independent from the thesis but should be treated as independent if you know what I mean. I would like to be able to give out the thesis without the appendix but the references that I have to the appendix should indicate that it actually is another document.

I am using the scrreprt-KOMA-Script document class and I would like to keep using it. Also I am using the varioref, hyperref and the cleveref-packages in combination. I also would like to keep that.

I assume I'll have to create two separate "main files". One for the main document "thesis.tex" and one for the appendix "appendix.tex". The question then is: How can I

  1. let the included "appendix.tex"-file get compiled while actually compiling the "thesis.tex" including all necessary references? In this case the hyperlinks are not that important.
  2. get as output thesis.pdf and appendix.pdf?
  3. get the reference in the main document point to sth. like "Appendix, p. XY" or - preferabily since I am writing in German - "Anhang, S. XY"?

I am using Sublime Text with the latexing-extension but I guess this is not very important in this case. In terms of typesetting engine I use pdflatex, so nothing really experimental.

After all I need to know: What package do I might need for this? What changes do I need to undertake in my document (for example labels) to accomplish the above mentioned results?

lockstep
  • 250,273
Kris
  • 299
  • 1
    Maybe you want to use xref? I'm not entirely sure quite what you want the results to be, though. Why not just print the pages you want (if it is one document) or split the file (if it is two)? – cfr Feb 02 '14 at 00:03
  • This answer might help you: http://tex.stackexchange.com/questions/155867/making-one-pdf-file-from-multiple-pdfs-or-tex/155883#155883 . Use the subfiles package to seperately include the main thesis and your appendix. Compile the main thesis only or compile the entire file. – Snicksie Feb 02 '14 at 08:55

2 Answers2

13

A fairly simple way to achieve this is to use the \include command to load your thesis main text and from a separate file your appendix. You then have one main file, say full.tex that compiles the whole document until all references are correct.

In addition you can set up two short files that are identical to the full.tex but containing an \includeonly statement loading only the thesis or only the appendix. After resolving the x-references running full.tex often enough the .aux files of the included files contain all relevant information to produce the two pdf files you need by running each file with the \includeonly statement once.

Compared to the suggestion to strip out the appendix from the full pdf this approach has the advantage that it can be automated, i.e., it doesn't involve any manual steps. On the downside it means additional LaTeX runs to produce the partial documents.

  • That did it. Not completely, though (One main document and another separate document with separate titlepage but "cross"-references to each other), but at least now I can create two documents with correct links and references. – Kris Feb 02 '14 at 12:26
  • sure, if you want different title pages in different situations then it gets slightly more elaborate, but the principle still applies - good luck with your thesis – Frank Mittelbach Feb 02 '14 at 13:04
  • This solution probably will not be accepted if the journal requires "The package should contain everything necessary to build the camera-ready PDF, and should compile once unarchived, without having to update any file routes nor hardcoded information in the sources."? Is there a possibility where one only has to compile it once? – Jakob Apr 28 '22 at 12:57
  • 1
    @Jakob my suggested approach doesn't require any changes to the so, it suggests that for the different purposes you have different master files which was the use case of the OP. However, concerning your: "compile only once". If you mean that literally then you you have to archive all auxilary files with your source as well so that after unpacking only one run is needed. If you only archive the sources, then you nearly always need to compile several times to get x-refs and table of contents etc correct. – Frank Mittelbach Apr 28 '22 at 19:30
  • How would you handle the \clearpage introduced by \include? If \maketitle is called in the full.tex, then running \includeonly for "main text" only will possibly introduce an unwanted blank space? Thanks! – Matifou Jan 05 '23 at 13:07
  • @Matifou the original question asked for the case of a titlepage (note "page") + main body + appendix in separate documents. Being separate document they would start on indiviual pages, ergo \include poses no problems. If you do want to have partial output with the text starting somewhere in the middle of a page then include wouldn't work. But longer documents usually have the title on its own page. – Frank Mittelbach Jan 05 '23 at 16:55
5

To get a thesis-PDF without the appendix - but including all references to it - compile your thesis including the appendix. Then use Acrobat Pro or pdftk (free software) to remove unwanted pages.

If you want only the appendix: remove the other pages.

nameref will solve your third problem. See here: \nameref -- How to display section name AND its number