4

EDIT: Substantial edit of the original version has been done to clarify the question.

Background

I've written two small python package manuals with sphinx (http://sphinx-doc.org/) a program that helps with source code documentation. Among others sphinx allows to output the manuals to LaTeX, based on their own documentclass and defined in a style file.

I am currently writing my thesis and would like to present the manuals in the appendix of the document. The format of the sphinx latex files is convenient for its purpose, but I don't want to use it for the remainder of the thesis. However, vice-versa in the manuals I'd like to stick to the sphinx-format.

Question

Is there a way to include full documents into a main document, such that they maintain their format without interfering with the main document? A similar problem would be to include a refereed paper inside e.g. a thesis such that it maintains the format of the Journal.

Notes

Including the files in tex format and compiling them together with the main document would allow referencing as well as correcly numbered pages and inclusion in the toc.

EDIT:

Options from the comments below:

  • standalone package this seems promising. However I still have issues with it (see below.) (also https://tex.stackexchange.com/a/12268/27635)

  • combine seems to me that it is rather usefull to produce something like conference proceedings with mutliple files in the same format. It also only lists the titles in the general TOC.

  • Compiling the manuals indivudualy and including them in the main tex as pdf. I would rather not use this option, if possible.

Possible contender: Standalone

I am not sure if this is the right way to go. From what I understand standalone loads the preamble from the sub-files for the main.tex file. This is what I'd like to avoid. Hoever, so far I managed to use standalone to include the manuals into my main manual, however the style remains the same as in the main tex, otherwise this would be what I search for. Here is my current setup for my main.tex:

\documentclass[12pt, twoside, paper=A4, final]{scrbook}
\usepackage{standalone}
\usepackage{load other packages ...}

\begin{document}
Mainmatter
\input{manual}
\end{document}

and my manual.tex:

\documentclass[subpreamble]{standalone}
\usepackage{sphinx}
\standaloneconfig{class=sphinxmanual}

\begin{document}
 manual content
\end{document}

I am not sure if I declare the documentclass for standalone correcly and wheter \standaloneconfig accepts it.

  • Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Marco Daniel Jul 6 '13 at 12:51
  • Honestly, your question is not much clear for me. Perhaps the standalone package may help you? See this answer from its author. – karlkoeller Jul 6 '13 at 14:34
  • Might the combine package solve your problem? mirror.math.ku.edu/tex-archive/macros/latex? /combine/combine.pdf – Ethan Bolker Jul 6 '13 at 15:10
  • Thanks for the answers! Sorry if the question is a bit confusing. I'll rephrase it to make it clearer. @karlkoeller standalone seems promising and I managed to include the files, however the different style is not adopted, yet. @EthanBolker BolkerFrom what I see combine needs the same style for each document and is more though to produce something like conference proceedings. – Ascurion Jul 6 '13 at 16:40
2

For completely independent documents you can just compile them on their own and then include them with pdfpages. using arara makes compiling easier

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
    \clearpage
    \includepdf[pages={-}]{docA.pdf}

    \clearpage
    \includepdf[pages={-}]{docB.pdf}

    \clearpage
    \includepdf[pages={-}]{docC.pdf}
\end{document}

% arara: pdflatex: { files: [ docA.tex ] }
% arara: pdflatex: { files: [ docB.tex ] }
% arara: pdflatex: { files: [ docC.tex ] }
% arara: pdflatex

In fact, if you want the documents to be fully independent you can write your own arara rule which calls arara on docA, docB, and docC.

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.