Larger book template (LaTeX2e unofficial reference manual (November 2018))

Next: tugboat template, Previous: book template, Up: Document templates [Contents][Index]

### A.4 Larger `book` template

This is a more elaborate template for a book. It has `\frontmatter`, `\mainmatter`, and `\backmatter` to control the typography of the three main areas of a book (see \frontmatter & \mainmatter & \backmatter). The book has a bibliography and an index.

Notable is that it uses `\include` and `\includeonly` (see Splitting the input). While you are working on a chapter you can comment out all the other chapter entries from the argument to `\includeonly`. That will speed up compilation without losing any information such as cross-references. (Material that does not need to come on a new page is brought in with `\input` instead of `\include`. You don’t get the cross-reference benefit this way.)

    \documentclass[titlepage]{book}
    \usepackage{makeidx}\makeindex

    \title{Book Class Template}
    \author{Alex Author}

    \includeonly{%
      frontcover,
      preface,
      chap1,
      ...
      }
    \begin{document}
    \frontmatter
    \include{frontcover}
      % maybe comment out while drafting:
    \maketitle \input{dedication} \input{copyright}
    \tableofcontents
    \include{preface}
    \mainmatter
    \include{chap1}
    ...
    \appendix
    \include{appena}
    ...
    \backmatter
    \bibliographystyle{apalike}
    \addcontentsline{toc}{chapter}{Bibliography}
    \bibliography
    \addcontentsline{toc}{chapter}{Index}
    \printindex
    \include{backcover}
    \end{document}

Unofficial LaTeX2e reference manual