As several people have pointed out, it is useful to put all of your prefactory material into a separate preamble. I usually make a custom class to contain all of the required packages, formatting information, etc.
Write each chapter as a completely separate document, and then – as Martin Scharrer pointed out – you can use one of the following packages to allow you to directly \input these chapters in the master document:
docmute: A minimal package providing just enough to allow you to include standalone chapters in the main document.
combine: A more comprehensive set of classes and packages designed for combining conference proceedings. Provides more functionality for dealing with titles and bibliographies.
standalone: When used as a package, this works very similarly to docmute but provides much more functionality, such as the standalone class which crops the output.
subfiles: Similar functionality to docmute but requires a slightly modified usage format (\subfile{} instead of \input{} etc.)
The class myclass.cls should look something like this:
\ProvidesClass{myclass}[2012/06/01 v1 Custom class for ... project]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrbook}}% or whatever
\ProcessOptions\relax
\LoadClass{scrbook}
% Include whatever packages you need here...
% Use either one of these:
\RequirePackage{standalone}
%\RequirePackage{docmute}
Now your chapters can look and behave like like self-contained documents:
\documentclass{myclass}
\begin{document}
\chapter{First Chapter}
Here is the first chapter
\end{document}
and your master file can input these like
\documentclass{myclass}
\begin{document}
\input{chapter1.tex}
\input{chapter2.tex}
\end{document}
The packages modify the outer document so that the inner \documentclass and document environments in each of the \input chapters have no effect.
lipsumorkantlipsumthe rest of the document,maybe? – percusse Jun 05 '12 at 09:23\input{preamble} \begin{document} \input{chapter_n} \end{document}which doesn't look cumbersome to me. – Stephan Lehmke Jun 05 '12 at 09:32\inputs of the other chapters in their local copy. Ok, you have to be careful not to commit this change into the VCS. However, you could still make an unversioned copy and use this as main file. As long the main file doesn't change often this is reasonable. – Martin Scharrer Jun 05 '12 at 09:49