# Include file with preamble to another tex file

I have two files: paper.tex with text, title, and full preamble with authors and so on. It compiles successfully.

The second file (B) has also a full preamble with title, authors, little text. It compiles also successfully. File B is in other language than English.

I need to have the content of file B in paper.tex output WITH TITLE, AUTHORS, etc.

In other words, I need a document with TWO title pages - 1'st titlepage should be in English and come from paper.tex and should appear as normal. Second title page should appear with ALL formatting in last page and should be in another language with different babel and so on.

\include{B} in this situation does not work. How can I achieve this? Thank all for any kind of help.

-
Welcome to TeX.sx! –  texenthusiast Mar 15 '13 at 9:42
Can you stitch the PDFs together with e.g. pdftk? That might be the best solution. –  Seamus Mar 15 '13 at 9:54
Have a look at the standalone package‌​. To quote the manual: "The package standalone can be used in the main document to skip all extra preambles in included ﬁles. The main ﬁle must load all packages and settings required by the sub-files. Several package options are provided to collect the preambles of the sub-files automatically and execute them from the main file." –  benwilfut Mar 15 '13 at 9:58
Ah, sorry, I think I didn't read your question properly. The issue with the two titlepages would not be so easily solved with standalone. My apologies. –  benwilfut Mar 15 '13 at 10:06
@benwlfut , thank for a answer and recommendations, but I've tested and a package standalone does not fit my requirements. –  user27359 Mar 16 '13 at 15:47

As indicated in comments, this sounds like a case where you essentially want to combine the two resulting PDF files. That can be done using pdfLaTeX and the pdfpages pages, but probably is easiest to do using the pdftk utility.

-

I did this a somewhat different way.

Here is an example:

\documentclass{article}

\input{./firstExample/preamble.tex} % preamble of 1st doc
\input{./secondExample/preamble.tex} % preamble of 2nd doc
\input{./preamble.tex} % preamble for both

\let\masterdocument\document
\let\endmasterdocument\enddocument
\let\masterinput\input

\begin{masterdocument}

\begin{titlepage}
\vspace*{1in}
\begin{center}
{\Huge \bfseries Example activity collection}\\[0.5cm]
{\Large Author}\\[0.4cm]
This document was typeset on \today.
\end{center}
\end{titlepage}

\setcounter{page}{2}

\tableofcontents

\renewcommand{\documentclass}{\setbox0\vbox}
\renewcommand{\input}{\setbox0\vbox}
\renewenvironment{document}{}{}

\masterinput{./firstExample/firstExample.tex}

\masterinput{./secondExample/secondExample.tex}

\end{masterdocument}


Hope this helps!

-