TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a book. I am trying to build a preamble in such a way that there is master.tex and different files for different chapters, preface, contents etc. I am 4/10 in latex knowledge. I will be highly obliged if somebody help me to build a master latex preamble to write a book. Thanks

share|improve this question
I think you'll need to qualify your requirements way more than this for an objective answer to be possible. – Joseph R. Jan 5 '14 at 1:43
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. – cmhughes Jan 5 '14 at 1:48
You don't want a different file for the contents, though. That is just one line in your master file (\tableofcontents) since latex will construct this automatically. (At least, there is a specific file for this but it is generated by latex and you don't need to think about it.) It would be especially helpful if you could post what you have so far and explain what it does or doesn't do that you care about. – cfr Jan 5 '14 at 2:03
If you need anything other than the standard \include{file} for each chapter that is in a separate file, you will need to give more details of your requirements. – David Carlisle Jan 5 '14 at 2:09
up vote 4 down vote accepted

The basic structure would be to have some directory, /book/, then have subdirectories:

  1. /book/tex/ which would contain the actual chapters in their own files; so, things like chapter-0.tex, preface.tex, chapter-29.tex, bibliography.tex, etc.
  2. /book/img/ which would have the images, if you have any.

You would probably want to isolate your macros in its own file, like /book/macros.tex.

Note you would want to keep track of the front matter apart from the main-matter (see, e.g., this thread for example).

Then your book would be /book/book.tex. You would run this through LaTeX. Its preamble would be:


\title{The Great American Novel}
\author{Alex Nelson}

\include{tex/preface} % if you have a preface, or foreward, include them here
% ... 
% ...
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.