[Tex/LaTex] How to add a separate LaTeX-document as an appendix

appendiceskoma-script

I want to add LaTeX-documents to my main document as appendices.

I have a set of documents (of class scrartcl) that all have their own tables of content, titles etc. Each of these documents should be included as an appendix in the main document.

Optimally, it would work like:

  • The main document lists every document in its TOC (e.g. … 4. foo 5. bar A First Appendix …)
  • After the content of the main document has ended, the appendix documents are listed (each on a new page)

  • Each appendix-document's content stays untouched (They have different headers etc.)

  • (I don't think that's possible) The numbering for e.g. graphics is altered so that it is "Figure A 4.1" instead of "Figure 4.1 for Appendix A.

Can something like this be done?

If not, is it possible to stitch the pdfs of every document together? Then I would have to find a way to adjust the main TOC.

Any help is highly appreciated.

Best Answer

You can use the pdfpages to include other pdfs in your document- there are lots of options for this package, all of which are well documented. In the MWE below, I've used

\includepdf[pages=-]{myotherdocument}

so that it includes all of the pages of myotherdocument.pdf

If you want to add content to your toc, then you can use \addcontentsline which has the general form

\addcontentsline{<file>}{<level>}{<stuff>}

You can choose the <level> to be chapter, section, etc depending on how you want it to look.

As discussed in the comments, your third and fourth requests conflict :)

Here's a MWE, assuming that you have myotherdocument.pdf in your current working directory.

\documentclass{report}
\usepackage{pdfpages}

\begin{document}

\tableofcontents

% use the \addcontentsline{<file>}{<level>}{<stuff>} mechanism to add content to your toc
\addcontentsline{toc}{chapter}{Chapter heading}
\addcontentsline{toc}{section}{Section heading}
\addcontentsline{toc}{subsection}{Subsection heading}

% [page=-] means include all pages
\includepdf[pages=-]{myotherdocument}

\end{document}