TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like a letter at the start of my report, but it would be a different document class.

Could I use the same .tex file, with \begin{document}\end{document}\begin{document}\end{document}?

share|improve this question
TeX will stop the compilation process the first time it sees \end{document} (non verbatim). So, no you cannot use \begin{document}\end{document}\begin{document}\end{document}. – cjorssen Mar 9 '12 at 17:32
up vote 12 down vote accepted

I would write the letter as a different document, compile it into a PDF and include it in the report using \includepdf{<filename>} from the pdfpages package. This avoids the double documentclass, but only works with full pages. However, this seem what you want anyway.

share|improve this answer

Just for fun, you can have it all in "one file" (note that shell-escape must be active).



This is my letter.

\immediate\write18{pdflatex myletter}



My report.

share|improve this answer
Neat! I will try this. Thank you! – MercurialMadnessMan Mar 9 '12 at 17:33
In this case you might want to load the filecontents package as well (before the environment of course) to ensure that the external file is outdated when you change the content changes. Otherwise an existing file will never be overwritten. – Martin Scharrer Mar 9 '12 at 17:43
Okay, will do. I'm using shareLaTeX for the collaboration on the report, which doesn't allow compilation options, so not sure if this approach will work... but I will try! – MercurialMadnessMan Mar 9 '12 at 17:47
@MartinScharrer Thanks Martin. This 'feature' of the filecontents environment has bothered me for a while. Updated answer. – cjorssen Mar 9 '12 at 18:50
@cjorssen -- This is a very neat solution. – Yiannis Lazarides Mar 9 '12 at 18:59

There are command-line tools that can combine several PDF files into one, such as pdftk:

pdftk a.pdf b.pdf output a_plus_b.pdf

Combine this with a Makefile or a similar mechanism to compile only what's necessary. latexmk can do a nice job here, too:

latexmk -pdf a
latexmk -pdf b

will run pdflatex, bibtex etc. on both a.tex and b.tex as often as necessary.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.