[Tex/LaTex] how to use \input{file.tex} correctly


Suppose I have two latex files file1 and file2 with the same preamble and so on. Then I want to create a file called bigfile which just puts the two files together. This is not working for some reason. Therefore I first tried to include just file1, this is what I have done:

\documentclass .... %% same as file1 ...
same preamble as file1

The result is that I not only get file1, but also the preamble and so on. This is my first experience with putting files together in 1 file. Kindly provide me a solution 🙂

Best Answer

The best thing is probably to leave out the document preamble and the \begin{document} and \end{document} from the included files and have one master file that sets up the style.

Master file:

% preamble.

First included file:

% more stuff.

Second included file

\section{More stuff}
% blah blah