14 Big Files

14.1 Include

If you're writing a large document such as a book or thesis, then it's usually more manageable to split it into several files. It's easy to combine these in LaTeX using the include command. By putting all your command definitions in one file, and each chapter in a different file, you can keep your main LaTeX file very neat indeed, e.g.



% Only chapters go into the table of contents


\title{\Huge{\texttgoth{My Opus Magnum}}}
\author{\sc by Phil Hasnip}





% Bibliography
\addcontentsline{toc}{chapter}{\sc Bibliography}


The files you're including are put in your document exactly as if you'd copy-and-pasted them yourself. This means they shouldn't usually have any preamble such as \documentclass or \usepackage, they don't even need a \begin{document} - these are all done in the main LaTeX document.

14.2 Your Own Style Files

If you find yourself defining the same paper margins or commands again and again then you might want to create your own style file. Style files have the sty extension, and are essentially just a list of LaTeX commands. They don't have any preamble at all, and can be used with a \usepackage command just like any other style file.

Previous page Next page