Besides keeping you style definitions and list of packages in a separate file and including them with \usepackage{<somepackage>}
, I'd recommend you use the standalone
package as well. This will allow you to compile each chapter as you go and and then use that file directly in the main book.
So, first create a somepackage.sty
file to contain all your custom macros and packages such as:
\usepackage{amsmath}% or any others that you use
\usepackage{lipsum}% for dummy text
\usepackage{standalone}% Need standalone package
This file will become sort of you master page. I'd include the geometry information for the margins in here, watermarks, as well as any footers, headers, etc...
Then create separate files for each chapter. Here is an example for chapter1.tex
which is a complete file and can be compiled by itself:
\documentclass{book}
\usepackage{somepackage}% your custom list of macros and packages
\begin{document}
\chapter{First Chapter}
\section{}
\lipsum[1]% ... contents of chapter 1 here...
\end{document}
Similarly for the other chapters. Then your main file would look like:
\documentclass{book}
\usepackage{somepackage}% your custom list of macros and packages
\begin{document}
\input{chapter1}
\input{chapter2}
\end{document}
One important thing to keep in mind is that main file must include the standalone
package as well as all ALL the packages required by the individual chapter files.
\input
command is your friend. :)