## Document templates

Although not reference material, perhaps these document templates will be useful. Additional template resources are listed at http://tug.org/interest.html#latextemplates.

### `beamer` template

The `beamer` class creates presentation slides. It has a vast array of features, but here is a basic template:

    \documentclass{beamer}

    \title{Beamer Class template}
    \author{Alex Author}
    \date{July 31, 2007}

    \begin{document}

    \maketitle

    % without [fragile], any {verbatim} code gets mysterious errors.
    \begin{frame}[fragile]
     \frametitle{First Slide}

    \begin{verbatim}
      This is \verbatim!
    \end{verbatim}

    \end{frame}

    \end{document}

One web resource for this: http://robjhyndman.com/hyndsight/beamer/.

### `article` template

    \documentclass{article}
    \title{Article Class Template}
    \author{Alex Author}

    \begin{document}
    \maketitle

    \section{First section}
    Some text.

    \subsection{First section, first subsection}
    Additional text.

    \section{Second section}
    Some more text.
    \end{document}

### `book` template

This is a straightforward template for a book. See See Larger book template for a more elaborate one.

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

    \begin{document}
    \maketitle

    \chapter{First}
    Some text.

    \chapter{Second}
    Some other text.

    \section{A subtopic}
    The end.
    \end{document}

### 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}

### `tugboat` template

TUGboat is the journal of the TeX Users Group, http://tug.org/TUGboat.

    \documentclass{ltugboat}

    \usepackage{graphicx}
    \usepackage{ifpdf}
    \ifpdf
    \usepackage[breaklinks,hidelinks]{hyperref}
    \else
    \usepackage{url}
    \fi

    %%% Start of metadata %%%

    \title{Example \TUB\ article}

    % repeat info for each author.
    \author{First Last}
    \address{Street Address \\ Town, Postal \\ Country}
    \netaddress{user (at) example dot org}
    \personalURL{http://example.org/~user/}

    %%% End of metadata %%%

    \begin{document}

    \maketitle

    \begin{abstract}
    This is an example article for \TUB{}.
    Please write an abstract.
    \end{abstract}

    \section{Introduction}

    This is an example article for \TUB, linked from
    \url{http://tug.org/TUGboat/location.html}.

    We recommend the \texttt{graphicx} package for image inclusions, and the
    \texttt{hyperref} package if active urls are desired (in the \acro{PDF}
    output).  Nowadays \TUB\ is produced using \acro{PDF} files exclusively.

    The \texttt{ltugboat} class provides these abbreviations (and many more):
    % verbatim blocks are often better in \small
    \begin{verbatim}[\small]
    \AllTeX \AMS \AmS \AmSLaTeX \AmSTeX \aw \AW
    \BibTeX \CTAN \DTD \HTML
    \ISBN \ISSN \LaTeXe
    \mf \MFB
    \plain \POBox \PS
    \SGML \TANGLE \TB \TP
    \TUB \TUG \tug
    \UNIX \XeT \WEB \WEAVE

    \, \bull \Dash \dash \hyph

    \acro{FRED} -> {\small[er] fred}  % please use!
    \cs{fred}   -> \fred
    \meta{fred} -> <fred>
    \nth{n}     -> 1st, 2nd, ...
    \sfrac{3/4} -> 3/4
    \booktitle{Book of Fred}
    \end{verbatim}

    For references to other \TUB\ issue, please use the format
    \textsl{volno:issno}, e.g., ``\TUB\ 32:1'' for our \nth{100} issue.

    This file is just a template.  The \TUB\ style documentation is the
    \texttt{ltubguid} document at \url{http://ctan.org/pkg/tugboat}.  (For
    \CTAN\ references, where sensible we recommend that form of url, using
    \texttt{/pkg/}; or, if you need to refer to a specific file location,
    \texttt{http://mirror.ctan.org/\textsl{path}}.)

    Email \verb|tugboat@tug.org| if problems or questions.

    \bibliographystyle{plain}  % we recommend the plain bibliography style
    \nocite{book-minimal}      % just making the bibliography non-empty
    \bibliography{xampl}       % xampl.bib comes with BibTeX

    \makesignature
    \end{document}