SJGR Publishing

From digital master to your audience's hands

3: Practical LaTeX

A minimal document

Let’s just jump right in and make a functional book template. It will be able to generate a Table of Contents (if we need it), a glossary (if we need it) and an index (if we need it), and will have a title page and some sections:

\documentclass{book}

\usepackage{tocloft}

\usepackage{makeidx}
\makeindex

\usepackage{glossaries}
\makeglossary

\begin{document}

\frontmatter

\title{My first \LaTeX\ book\\how I learnt to stop worrying and love typesetting}
\author{LaTeX user number 1}
\date{\today}
\maketitle

\mainmatter

\chapter{The first chapter}

\section{The first section in the first chapter}

\subsection{Subsections are fine}

\subsubsection{Even sub-subsections are fine!}

\par{Explicitly marking paragraphs is in fact also fine, but you don’t need to do this unless you want to emphasis the first word(s) in the paragraph.}

Normally, a paragraph is indicated simply by the fact that it is just text with an empty line above it. That’s all you need to indicate a proper paragraph.

\LaTeX\ will make sure that the first paragraph is kept flush on the left edge, and every other paragraph in the series is indented with respects to the left edge.

\section{Structure counts}

This is the second section in the first chapter

\chapter{Chapter numero dos}

And this is the second chapter.

\backmatter

\printglossaries
\printindex

\end{document}