Chapter 7 – Contents, Indexes, and Bibliographies

Here are the Code examples of of this chapter. You can compile them online right on this web page by pressing the Typeset / Compile button. You can also edit them for testing, and compile again.

For a better view with the online compiler, I sometimes use \documentclass[border=10pt]{standalone} instead of \documentclass{article}. Instead of having a big letter/A4 page, the standalone class crops the paper to see just the visible text without an empty rest of a page.

Any question about a code example? Post it on LaTeX.org, I will answer. As forum admin I read every single question there. (profile link).

External file (texbook.bib) needed and compilation of a few examples requires makeindex/makeglossaries.

\documentclass[11pt,a5paper,pagesize=auto,titlepage=firstiscover]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage[tocindentauto]{tocstyle}
\usetocstyle{KOMAlike}
\frenchspacing
\makeatletter
\renewcommand*{\maketitle}{
  \thispagestyle{empty}
  \vspace*{1cm}
  {\huge\raggedright\@title\par}
  \noindent\hrulefill\par
  {\LARGE\raggedleft\@author\par}
  \vfill
  {\Large\raggedleft Institute\par}
  \cleardoublepage
  }
\makeatother
\begin{document}
\title{The Book}
\author{The Author}
\date{}
\maketitle
\addtocontents{toc}{\protect\thispagestyle{empty}}
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

\documentclass[11pt,a5paper,pagesize=auto,titlepage=firstiscover]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage[tocindentauto,tocflat]{tocstyle}
\usetocstyle{KOMAlike}
\frenchspacing
\makeatletter
\renewcommand*{\maketitle}{
  \thispagestyle{empty}
  \vspace*{1cm}
  {\huge\raggedright\@title\par}
  \noindent\hrulefill\par
  {\LARGE\raggedleft\@author\par}
  \vfill
  {\Large\raggedleft Institute\par}
  \cleardoublepage
  }
\makeatother
\begin{document}
\title{The Book}
\author{The Author}
\date{}
\maketitle
\addtocontents{toc}{\protect\thispagestyle{empty}}
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

\documentclass[11pt,a5paper,pagesize=auto,titlepage=firstiscover]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage[tocindentauto,tocfullflat]{tocstyle}
\usetocstyle{KOMAlike}
\frenchspacing
\makeatletter
\renewcommand*{\maketitle}{
  \thispagestyle{empty}
  \vspace*{1cm}
  {\huge\raggedright\@title\par}
  \noindent\hrulefill\par
  {\LARGE\raggedleft\@author\par}
  \vfill
  {\Large\raggedleft Institute\par}
  \cleardoublepage
  }
\makeatother
\begin{document}
\title{The Book}
\author{The Author}
\date{}
\maketitle
\addtocontents{toc}{\protect\thispagestyle{empty}}
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

\documentclass{scrartcl}
\usepackage{biblatex}
\addbibresource{texbooks.bib}
\begin{document}
\section*{Recommended texts}
To study \TeX\ in depth, see \autocite{DK86}. For writing math texts,
see \autocite{DK89}. The basic reference for \LaTeX\ is \autocite{Lamport}.
\printbibliography
\end{document}

\documentclass{scrartcl}
\usepackage[
    backend = biber,
    style   = authoryear,
    natbib  = true,
  ]{biblatex}
\addbibresource{texbooks.bib}
\begin{document}
\section*{Recommended texts}
To study \TeX\ in depth, see \autocite{DK86}. For writing math texts,
see \autocite{DK89}. The basic reference for \LaTeX\ is \autocite{Lamport}.
\printbibliography
\end{document}

\documentclass{scrartcl}
\usepackage{biblatex}
\addbibresource[location=remote]{http://latex-community.org/texbooks.bib}
\begin{document}
\section*{Recommended texts}
To study \TeX\ in depth, see \autocite{DK86}. For writing math texts,
see \autocite{DK89}. The basic reference for \LaTeX\ is \autocite{Lamport}.
\printbibliography
\end{document}

\documentclass[parskip=half]{scrartcl}
\usepackage[style=long3col]{glossaries}
\makenoidxglossaries
\newglossaryentry{tex}{
  name = {\TeX},
  sort = {TEX},
  description = {Sophisticated digital typesetting system,
                 famous for high typographic quality of
                 mathematical formulae}
}
\newglossaryentry{latex}{
  name ={\LaTeX},
  sort = {LATEX},
  description = {Document markup language based on
                 \gls{tex}, widely used in academia}
}
\newglossaryentry{tikz}{
  name = {Ti\emph{k}Z},
  sort = {TikZ},
  description = {Extremely capable graphics
                 language for drawing with \gls{tex}}
}
\begin{document}
\gls{tikz} works with plain \gls{tex}. However,
it is mostly used with \gls{latex}.
\printnoidxglossary
\end{document}

\documentclass[parskip=half]{scrartcl}
\usepackage[acronym,style=long3col]{glossaries}
\setacronymstyle{long-sc-short}
\newacronym{ctan}{CTAN}{Comprehensive \TeX\ Archive Network}
\newacronym{tug}{tug}{\TeX\ Users Group}
\newacronym{dante}{dante}{Deutschsprachige Anwendervereinigung \TeX}
\makenoidxglossaries
\begin{document}
The \gls{ctan} has been founded by members of the \gls{tug} and of
the German speaking group ``\gls{dante}''.

The \gls{ctan} project is actually independent of \gls{tug} and \gls{dante},
but \gls{dante} is still the main supporter.
\printnoidxglossary[type=\acronymtype]
\end{document}

\documentclass[parskip=half]{scrartcl}
\usepackage{makeidx}
\makeindex
\begin{document}
While \index{glossary}glossary entries are simply
printed in the text, an \index{acronyms}acronym
is firstly fully printed with the short version
in parentheses, later only in the short version.
\printindex
\end{document}

\documentclass[parskip=half]{scrartcl}
\usepackage{makeidx}
\newcommand{\package}[2]{\index{packages!\texttt{#2}}%
  \index{#1!package \texttt{#2}}\texttt{#2}}
\makeindex
\begin{document}
While \index{glossary}glossary \index{glossary!entry}entries are simply printed in the text,
an \index{acronym}acronym is firstly fully printed with the \index{acronym!short version}short
version in \index{parentheses}parentheses, later only in the short version.

A glossary can be done using one of the packages
\package{glossary}{glossaries} or \package{glossary}{nomencl}.
For a list of acronyms, suitable are \package{acronyms}{acronym}, \package{acronyms}{acro}
and also \package{acronyms}{glossaries}.
\clearpage
\thispagestyle{empty}
\printindex
\end{document}

Go to next chapter.