# [texhax] General Advice on Combining Documents for a Thesis

Reinhard Kotucha reinhard.kotucha at web.de
Sat May 29 01:55:16 CEST 2010

On 28 May 2010 Thomas Jacobs wrote:

> I am a doctoral student in Finance where the practice is to write
> three papers (not necessarily related) and combine them into a thesis.
>  I have confirmed that combining them as follows is acceptable to the
>
> Paper 1 Title Page, Abstract, Body, References, Tables, Figures
> Paper 2 Title Page, Abstract, Body, References, Tables, Figures
> Paper 3 Title Page, Abstract, Body, References, Tables, Figures
> Thesis Conclusion
>
> I have been unable to decipher how to do this in LaTeX, particularly
> as most web available code skeletons or guides assume a single set of
> references, etc.
>
> When I try to combine them in one TeX file I get errors if I have more
> than one document begin and end line and am uncertain how I would code
> the three distinct sets of references.
>
> Can anyone advise if this is possible or if I need to create five
> separate LaTeX projects and their resulting output .pdf files
> then use Acrobat to combine the five resulting files?  Thanks very
> much.

The question is whether it's sufficient to provide a paper copy or you
need a PDF file with intact hyperlinks.

Combining the PDF files is possible, either using Acrobat or the
pdfpages package.  Then you have to set the page counter at the
beginning of each file manually.  This is quite easy and I even could
send you a Perl script which combines all PDF files in a particular
directory into a single PDF file.  The drawback is that hyperlinks get
lost because they are not stored at the same place as the page
contents within a PDF file.  Don't know whether Acrobat handles this
better.  It's not trivial.

The LaTeX solution is to move everything between \begin{document} and
\end{document} to separate files.  The papers (Paper 1..3) should use
\documentclass{article} because the top-level sectioning command is
\section.

Then you could write your thesis like this:

--------------------------
\documentclass{report}

\begin{document}
\chapter{foo}
text...

\chapter{bar}
text...

\chapter{foobar}
text...

\chapter{Paper 1}\include{paper1}
\chapter{Paper 2}\include{paper2}
\chapter{Paper 3}\include{paper3}

\chapter{Conclusion}
text...
\end{document}
--------------------------

In order to compile a particular paper separately, you have to provide
files like:

--------------------------
\documentclass{article}

\begin{document}
\include{paper1}
\end{document}
--------------------------

BTW, I would move the papers to the appendix:

--------------------------
\documentclass{report}

\begin{document}

\chapter{Conclusion}
...conclusion...

\appendix

\chapter{Paper 1}\include{paper1}
\chapter{Paper 2}\include{paper2}
\chapter{Paper 3}\include{paper3}
\end{document}
--------------------------

1 foo
2 bar
3 foobar
4 Conclusion
A Paper 1
B Paper 2
C Paper 3

Regards,
Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------