When I write a book or other lengthy document which contains
chapters and sections, I create a master file with a name like
master.tex which looks like this:
\documentclass[11pt]{book}
\usepackage{amsmath} %Never write a paper without using amsmath for its many new commands
\usepackage{amssymb} %Some extra symbols
\usepackage{makeidx} %If you want to generate an index, automatically
\usepackage{graphicx} %If you want to include postscript graphics
\usepackage{mystyle} %Create your own file, mystyle.sty where you put all your
own \newcommand statements, for example.
%\includeonly{chaptr2} %If you just want to process chaptr2.tex
\begin{document}
\author{E. G. Goodaire}
\title{How to Write a Book}
\date{May 2002}
\frontmatter
\tableofcontents
\include{preface}
\mainmatter
\include{chaptr1}
\include{chaptr2}
\include{chaptr3}
\include{chaptr4}
\include{chaptr5}
\backmatter
\include{glossary}
\include{notat}
\bibliographystyle{amsalpha} %The style you want to use for references.
\bibliography{mr,refs} %The files containing all the articles and books you ever referenced.
\printindex %Make an index AUTOMATICALLY
\end{document} ********End of master.tex
With a statement like \include{preface}, LaTeX
looks for a file called preface.tex which is read in
literally, line by line. So preface.tex might look like:
This is the preface to my book. It is a wonderful
book which I hope many people will read.
Note: No \begin{document} or \end{document}.
You already have these in master.tex.
My file chaptr1.tex looks like this
\chapter{Alternative Rings}
\label{altrings} % So I can \ref{altrings} later.
\section{Definitions}
\label{defs}
\input{chap1/sec11}
\section{The Cayley Numbers}
\label{cayley}
\input{chap1/sec12}
\section{Zorn's Vector Matrix Algebra}
\label{zorn}
When LaTeX sees a line like \input{chap1/sec11}, it looks for the
file sec11.tex in the directory chap1 and inputs this file line
by line into master.tex. (The file sec11.tex is
the contents of my Section 1.1 of my book.) Again, don't use
\begin{document}
or \end{document}: sec11.tex
should contain just the exposition of this section.
Finally, a couple of comments about bibliographies. Especially near the start
of your careers, when you start writing papers and theses, I advise you
strongly to create a file called refs.bib which contains like this:
@ARTICLE{EGG:96a, %A code of your own making by which you refer to this paper
AUTHOR = "Edgar G. Goodaire and D. A. Robinson",
TITLE = "A construction of loops which admit right alternative loop rings",
JOURNAL = RESUM, %RESUM is defined in mr.bib; it expands to an official journal name
YEAR = {1996},
VOLUME = {59},
PAGES = {56--62} }
@UNPUBLISHED{EGG:98,
AUTHOR = "Edgar G. Goodaire and D. A. Robinson",
TITLE = "Commutative alternative rings: A construction",
NOTE = "preprint"
@BOOK{EGG:99a,
AUTHOR = "Edgar G. Goodaire and Sean May and Maitreyi Raman",
TITLE = "The {M}oufang Loops of Order less than $64$",
PUBLISHER = "Nova Science Publishers, Inc.",
ADDRESS = "Commack, New York",
YEAR = {1999}
Each time you want to reference something, if it is not in your refs.bib, you must add, with formatting as above. YOU DO THIS ONLY ONCE IN YOUR LIFE. Ever thereafter, if you want to reference Goodaire and Robinson in your paper, you write \cite{EGG:96a}. After you latex master.tex, you bibtex master.tex. At this point, the bibtex program will go into your refs.bib file and pull into your paper or book just those references which you require in your current work. Run latex master.tex once (or twice) more and look at the output. Your references will be numbered and alphabetized automatically and all the references in your exposition will be just as you want them.
The file mr.bib is a short version of mrabbrev.bib, which is available
from the AMS (if it isn't on our own systems). It's a list of all official
abbreviations for journals and is invaluable.
The command \bibliographstyle{amsalpha} asks bibtex to use the amsalpha style. There are numerous other possibilities. Many book publishers have their own. There is much much more to all this than I can outline here. I do urge you, however, to read the sections in Lamport's book which deal with bibliographies (and making your index). Good luck.