2

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

4
  • 6
    I think you'll need to qualify your requirements way more than this for an objective answer to be possible.
    – Joseph R.
    Commented Jan 5, 2014 at 1:43
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format.
    – cmhughes
    Commented Jan 5, 2014 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
    Commented Jan 5, 2014 at 2:03
  • 1
    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. Commented Jan 5, 2014 at 2:09

1 Answer 1

4

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:

\documentclass{book}
\input{macros}

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

\begin{document}
\frontmatter
\maketitle
\tableofcontents
\include{tex/preface} % if you have a preface, or foreward, include them here
\mainmatter
\include{tex/chapter-0}
\include{tex/chapter-1}
% ... 
\backmatter
\appendix
\include{tex/appendix-0}
% ...
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .