Managing Contents, Indexes, and Bibliography
local graph
Chapter 8 — Managing Contents, Indexes, and Bibliography
Section titled “Chapter 8 — Managing Contents, Indexes, and Bibliography”So far, you have learned how to structure and format documents, create tables and images, and connect their parts using cross-references. This chapter shows how LaTeX builds on that by automatically collecting and presenting a document’s content in tables of contents, figures, tables, indexes, and bibliographies. LaTeX makes it easy to create all kinds of cross-referenced lists. For example, we’ve already seen that using just the \tableofcontents command gives you a clean, nicely formatted table of contents (TOC). It automatically collects the chapter and section headings, along with their page numbers, and generates a tidy list.
A TOC and an index help readers navigate a document. A list of tables and a list of figures work in the same way. Academic papers and books often include a list of other works to cite their sources or support the topic. If this list contains only cited works, we often call it a list of references; if it also contains uncited but relevant works, we call it a bibliography.
By the end of this chapter, you’ll know how to create and customize all of these lists.
Here’s what we’ll cover:
- Customizing the table of contents
- Generating an index
- Creating a bibliography
- Adding a glossary
- Changing the headings
Let’s begin with the contents.
Customizing the table of contents
Section titled “Customizing the table of contents”Simply typing the \tableofcontents command produces a ready-made list of contents. But LaTeX also lets us fine-tune its appearance and structure. Let’s see how.
We’ll create a short example document that serves as our test file throughout this chapter.
It will contain a few headings so that we can experiment with the table of contents and learn how to adjust it. We will modify it to be more nuanced and include additional entries.
In Chapter 3, Designing Pages, we saw what happens when we use the \tableofcontents command. LaTeX collects all the entries from the headings and automatically lists them. This time, we’ll include headings down to the subsubsection level and add a few manual entries. Let’s begin by building the base document:
- Start a new
bookdocument:\documentclass{book} - Set the table of contents’ depth value to
3to include headings down to the subsubsection level:\setcounter{tocdepth}{3} - Begin the document:
\begin{document}
- Print the table of contents at the beginning:
\tableofcontents
- Write headings in all the levels you want. Use
\addcontentslineor\addtocontentsto add something to the TOC manually:\part{First Part}\chapter*{Preface}\addcontentsline{toc}{chapter}{Preface}\chapter{First main chapter}\section{A section}\section{Another section}\subsection{A smaller section}\subsubsection[Deeper level]{This section has aneven deeper level}\chapter{Second main chapter}\part{Second part}\chapter{Third main chapter} - Finish with an appendix that has its own chapters:
\appendix\cleardoublepage\addtocontents{toc}{\bigskip}\addcontentsline{toc}{part}{Appendix}\chapter{Glossary}\chapter{Symbols}\end{document}
- Click Typeset to compile. The first page will show Contents, but no entries will appear.
- Click Typeset a second time. Now we can see the table of contents:

Figure 8.1 – An example of a table of contents
Figure 8.1 – An example of a table of contents
We structured a document using several sectioning commands. LaTeX reads all of our sectioning commands during the first run and creates a .toc file that stores all the headings. During the first run, that file didn’t exist yet; thus, the TOC remained empty. The second run reads this file and prints the final table of contents.
In our example, we increased the TOC depth by 1 level. We added a chapter-like entry for the preface and inserted a part-like heading for the appendix beginning, using the \addcontentsline command. Through the \addtocontents command, we inserted some space before the heading. In the following sections, we’ll look more closely at these commands and learn how to customize the TOC.
Adjusting the depth of the TOC
Section titled “Adjusting the depth of the TOC”Each sectioning command in LaTeX has an associated TOC level. These levels determine which headings appear in the table of contents. Here are the values for the standard sectioning commands:
\part: -1 in thebookandreportclasses, and 0 in the articleclassarticle\chapter: 0 (except in thearticleclass, since there are no chapters witharticle)\section: 1\subsection: 2\subsubsection: 3\paragraph: 4\subparagraph: 5
In the book and report classes, LaTeX creates TOC entries up to level 2 (i.e., down to the \subsection level). In the article class, LaTeX creates TOC entries until level 3 by default, that is, down to the \subsubsection level. In a book, this means, for example, that \subsubsection doesn’t generate a TOC entry. There is a variable representing the level, namely, \tocdepth. It’s an integer variable, which we call a counter. To tell LaTeX to include subsubsections in the TOC, we would have to raise this counter. There are two basic ways to adjust a counter value:
\setcounter{name}{n}specifies an integer value ofnfor thenamecounter.\addtocounter{name}{n}adds the integer value ofnto the value of thenamecounter. To decrease a counter, choose a negative value forn.
For example, the following command makes LaTeX include even \subparagraph headings in the TOC:
\setcounter{tocdepth}{5}Alternatively, use the \addtocounter command to raise or lower the level without needing to know the current value.
In contrast to commands, counter names don’t begin with a backslash.
Shortening TOC entries
Section titled “Shortening TOC entries”As you have already learned in Chapter 3, Designing Pages, you may choose a text for the TOC different from the heading in the body text. Each sectioning command understands an optional argument for the TOC entry, which is especially useful if you wish to use a very long heading but want a shorter TOC entry. In our example, we did this by means of the following command:
\subsubsection[Deeper level]{This section has an even deeperlevel}The body text shows the long heading, while the TOC shows the short one. Titles printed at the top of pages, called running headers, would also use the short entry. This way, you can avoid a cluttered TOC or overflown page headers.
Adding TOC entries manually
Section titled “Adding TOC entries manually”Starred sectioning commands, such as \chapter* and \section*, are used for printing a heading without generating a TOC entry. In our example, we added one manually using this command:
\addcontentsline{file extension}{sectional unit}{text}You can use this command in different situations. The file extension specifies which list to update, for example:
tocfor the table of contentsloffor the list of figureslotfor the list of tables
The sectional unit determines the entry’s formatting. For instance, if you set it to chapter, LaTeX will format the entry as a regular chapter entry. The same applies to other sectional units, such as part, section, and subsection. The third argument contains the entry text.
You can also insert text or commands more directly using the following command:
\addtocontents{file extension}{entry}Unlike \addcontentsline, this command writes the argument entry directly into the file as it is, without applying any additional formatting. You can freely define any formatting you like.
You can also use the \addtocontents command for various customizations. Here are some examples:
\addtocontents{toc}{\protect\enlargethispage{\baselineskip}}increases the text height so that one more line fits on the contents page.\addtocontents{toc}{\protect\newpage}forces a page break in the TOC. This can be useful if LaTeX automatically breaks the page in an awkward place, for example, right after a chapter entry, but before the following section entries.\addtocontents{toc}{\protect\thispagestyle{fancy}}changes the page style of the current TOC page tofancy. As the first page of a chapter is of theplainstyle by default, the first page of the TOC would be plain as well, even if you specified\pagestyle{fancy}earlier. That command overrides it.
Place such commands where you want their effects to take place. For example, to affect the first TOC page, place it at the beginning of your document. To insert a page break before a specific chapter, put it right before the corresponding \chapter command.
Creating and customizing lists of figures
Section titled “Creating and customizing lists of figures”There are two commands for creating lists of figures and tables: \listoffigures and \listoftables. Depending on the class, they produce a well-formatted list of all captions, along with the figure or table number and the corresponding page numbers. Just like with the TOC, LaTeX handles this automatically. Still, we may use the same techniques, such as with the TOC, to customize the other lists. Let’s try that.
Suppose all our figures are diagrams. We’ll replace the term figure with diagram, and we’ll add a list of diagrams:
- Open our current example. Add these lines to your preamble:
\renewcommand{\figurename}{Diagram}\renewcommand{\listfigurename}{List of Diagrams}
- Right after
\tableofcontents, add the following:\listoffigures - Add a diagram somewhere in the first chapter:
\begin{figure}\centering\fbox{Diagram placeholder}\caption{Enterprize Organizational Chart}\end{figure}
- In the second part of the third chapter, we’d like to add network design diagrams. Let’s mark that in the list of figures (LOF) and then include the diagrams:
\addtocontents{lof}{Network Diagrams:}\begin{figure}\centering\fbox{Diagram placeholder}\caption{Network overview}\end{figure}\begin{figure}\centering\fbox{Diagram placeholder}\caption{WLAN Design}\end{figure}
- Click Typeset twice to get the document and the list:

Figure 8.2 – A list of diagrams
Figure 8.2 – A list of diagrams
We renamed the figures and the list heading by redefining LaTeX macros. At the end of this chapter, you will get a list of names used by LaTeX classes that you may redefine.
As with the TOC, we used the \addtocontents command to insert a bold heading into the .lof file, where LaTeX stores the figure captions. It works the same way as it does for the TOC.
Creating a list of tables
Section titled “Creating a list of tables”Creating and customizing a list of tables (LOT) works just like with figures. The file where LaTeX collects the tables’ captions has the .lot extension. To modify it, use lot as the first argument to the \addtocontents command. Everything follows the same logic as before, just like with \listoftables, \tablename, and \listtablename.
Using packages for customization
Section titled “Using packages for customization”In addition to the basic methods we’ve seen, various packages provide sophisticated features for customizing the TOC and the lists of figures and tables:
tocloftgives extensive control over the typography of TOC, LOF, and LOT. You can even define new kinds of such lists.titletocprovides convenient entry management and is the companion totitlesec, an excellent package for customizing sectioning headings.multitocoffers a layout in two or more columns using themulticolpackage.minitoccreates small TOCs for each part, chapter, or section.tocbibindcan automatically add a bibliography, index, TOC, LOF, and LOT to the table of contents. It can even number these headings and entries if you prefer.
To learn more, use the texdoc command-line tool or visit https://texdoc.org to read the package documentation.
Now you know how to create lists of contents, tables, and figures that we usually put at the beginning of a document. Let’s continue with lists that appear at the end of a document: a keyword index and a bibliography.
Generating an index
Section titled “Generating an index”Longer documents often include an index. That’s a list of words or phrases along with page numbers showing where related topics appear in the document. Unlike a full-text search feature, an index provides carefully chosen pointers to the most relevant information.
Once we identify and mark the words we want to include in the index, LaTeX handles collecting them and typesetting the index.
Let’s say our example document contains information about an enterprise, its structure, and its network design. We’ll mark places in the text where these concepts occur. Finally, we will tell LaTeX to generate the index. Follow these steps:
- Go back to our example. In the preamble, load the
indexpackage and add the command to create the index:\usepackage{index}\makeindex - In the caption of our enterprise diagram, index this point with the keyword
enterprise:\caption{\index{enterprise}Enterprise OrganizationalChart} - In the third chapter, which contains our diagrams, index by the keyword
network:\index{network} - Directly before
\end{document}, create an entry for the index to appear in the table of contents. To ensure that it shows the correct page number, end the page right before it:\clearpage\addcontentsline{toc}{chapter}{Index} - On the following line, tell LaTeX to typeset the index:
\printindex
- If you’re using TeXworks, choose MakeIndex instead of pdfLaTeX in the drop-down box next to the Typeset button. Then, click the Typeset button. If you use another editor, use its MakeIndex feature or type the following at the command prompt in the document directory, without a file name extension:
makeindex documentname
- Switch back to pdfLaTeX. Click on Typeset, and look at the last page:

Figure 8.3 – An index
Figure 8.3 – An index
We loaded the index package, which enhances LaTeX’s built-in indexing functions.
Alternatively, you can use the makeidx package, which is part of standard LaTeX. The \makeindex command prepares the index. Both commands belong to the preamble, so they must be placed before \begin{document}.
The \index command takes just one argument, namely, the word or the phrase to be indexed. It writes this phrase into a file with the .idx extension. If you look into this file, you will find lines such as the following:
\indexentry {enterprise}{9}\indexentry {network}{15}These represent the index entries and their corresponding page numbers.
The external makeindex program processes that .idx file and generates a .ind file. The latter consists of LaTeX code for creating the index. Specifically, it contains the index list environment together with the items and appears as follows:
\begin{theindex}\item enterprise, 9\indexspace\item network, 15\end{theindex}More complex indexes may contain subitems, page ranges, and references to other items. Let’s see how to produce such an index. On the book’s website, https://latexguide.org/chapter-08, you can find fully compilable code containing example commands that we will learn about in the following sections. You can try them out directly on the web page.
Defining index entries and subentries
Section titled “Defining index entries and subentries”So far, we’ve already created simple index entries using the following command:
\index{phrase}To produce subentries, specify the main term followed by an exclamation mark, and then the subentry. Here’s an example:
\index{network!overview}Also, subentries may have subentries; use another exclamation mark, for example:
\index{enterprise!organization}\index{enterprise!organization!sales}\index{enterprise!organization!controlling}\index{enterprise!organization!operation}LaTeX supports up to three levels of subentries.
Specifying page ranges
Section titled “Specifying page ranges”If several pages deal with the same topic, you may specify a page range for the index entry. Use |( where the range starts, and add |) where it ends. So, at the beginning of the network chapter, add |( as follows:
\index{network|(}While, at the end of this chapter, add |) like this:
\index{network|)}This will produce an index entry such as Network, 15-17.
Using symbols and macros in the index
Section titled “Using symbols and macros in the index”By default, makeindex sorts all entries alphabetically. If you want to include symbols in the index – for example, Greek letters, chemical formulas, or math symbols – you may run into sorting challenges. To handle this, the \index command supports a sort key. Use this key as a prefix for the entry, separated by the @ symbol, for instance:
\index{Gamma@$\Gamma$}Using macros for index entries is generally not recommended. The macro name, including the backslash, would determine the sorting, although the macro would be expanded in the index. Imagine you’ve got a \group macro that stands for TeX Users Group, defined like this:
\newcommand{\group}{\TeX\ Users Group}If you write the following, then the TeX Users Group entry will be treated like \group in the sorting and won’t appear among the entries beginning with T:
\index{\group}However, you could repair such issues by adding a sort key as a prefix, such as here:
\index{TeX@\group}You can also indicate how words with special characters will be sorted. Here, the German word schön, which contains an umlaut, will be sorted like the word schon:
\index{schon@sch\"{o}n}Since the symbols |, @, and ! have special meanings within index entries, we need to quote them to print them as their original meanings. This is an example of how we can print them:
\index{exclamation ("!)!loud}We can print the symbols |, @, and ! in the index by quoting them, using a preceding ".
Referring to other index entries
Section titled “Referring to other index entries”Different words may stand for the same concept. In such cases, it’s possible to add a cross-reference to the main phrase without a page number. Adding the |see{entry list} code achieves that, for example:
\index{wireless|see{WLAN}}\index{WLAN}As such, references don’t print a page number, so their position in the text doesn’t matter. You could collect them anywhere in your document.
Fine-tuning page numbers
Section titled “Fine-tuning page numbers”If an index entry refers to several pages, you should emphasize a specific page number to indicate it as the primary reference. You could define a command for emphasizing as follows:
\newcommand{\main}[1]{\emph{#1}}Then, for the index entry, add a pipe symbol followed by the command name:
\index{WLAN|main}Now, LaTeX emphasizes the corresponding page number. Simply writing \index{WLAN|emph} or \index{WLAN|texbf} is also possible. However, defining your own macro is more consistent: remember the concept of separating form and content.
Designing the index layout
Section titled “Designing the index layout”If we extend our example document with the example commands mentioned in the previous sections, \printindex gives us this layout, containing subentries, ranges, references, and emphasized entries:

Figure 8.4 – A more complex index
Figure 8.4 – A more complex index
LaTeX comes with several built-in index styles, called latex (the default), gind, din, and iso. To use another style, specify it using the –s option of the makeindex program, for example:
makeindex –s iso documentnameIf you compile after this call, the index layout changes to the following:

Figure 8.5 – An index with the iso style
Figure 8.5 – An index with the iso style
You could even define your own styles. To learn more about indexing and makeindex, use texdoc at the command prompt:
texdoc indexFor more information about the makeindex tool, use the following command:
texdoc makeindexOr, visit the documentation online at https://texdoc.org/pkg/index and https://texdoc.org/pkg/makeindex.
Although it might seem natural to generate the index while writing the document, it’s recommended to wait until the writing is finished and then decide what should appear in the index.
Next, we’ll move on to another type of list: the list of references, that is, the bibliography.
Creating a bibliography
Section titled “Creating a bibliography”Scientific and academic documents usually include a list of references or a bibliography. We’ll work out how to typeset a bibliography and cite its entries in the text.
Using LaTeX’s built-in features, we’ll create a short list of references containing a book and an article by Donald E. Knuth, the creator of TeX. In our main text, we will cite both of them:
- Create a new document as follows:
\documentclass{article}\begin{document}\section*{Recommended texts}To study \TeX\ in depth, see \cite{DK86}.For writing math texts, see \cite{DK89}.\begin{thebibliography}{8}\bibitem{DK86} D.E. Knuth, \emph{The {\TeX}book}, 1986\bibitem{DK89} D.E. Knuth, \emph{Typesetting ConcreteMathematics}, 1989\end{thebibliography}\end{document}
- Click on Typeset and examine the output:

Figure 8.6 – A list of references
Figure 8.6 – A list of references
Here, we used an environment called thebibliography to typeset the list of references, which is similar to a description list, as you saw in Chapter 4, Creating Lists. Each item on this list has a key that identifies it. For citing in the body text, we used the \cite command to refer to that key. Let’s take a closer look at how these commands work.
Using the built-in bibliography environment
Section titled “Using the built-in bibliography environment”LaTeX’s default environment for bibliographies has the following structure:
\begin{thebibliography}{widest label}\bibitem[label]{key} author, title, year etc.\bibitem……\end{thebibliography}Each item is specified using the \bibitem command. This command requires a mandatory argument determining the key. We may refer to this key with \cite{key} or \cite{key1,key2}. \cite also accepts an optional argument stating a page range, for example, \cite[p.\,18--20]{key}. You may choose a label by means of the optional argument of \bibitem. If we did not state a label, LaTeX would number the items consecutively in square brackets, as we saw in Figure 8.6.
Using labels, the environment could look as follows:
\begin{thebibliography}{Knuth89}\bibitem[Knuth86]{DK86} D.E. Knuth, \emph{The {\TeX}book}, 1986\bibitem[Knuth89]{DK89} D.E. Knuth, \emph{Typesetting Concrete Mathematics}, 1989\end{thebibliography}The corresponding output is this:

Figure 8.7 – A list of references
Figure 8.7 – A list of references
As you can see, LaTeX automatically adjusted the output of \cite to the new labels. If you want more control over citation formatting, the cite package offers compressed and sorted lists of numerical citations, such as [2,4-6], and further formatting options for in-text citations.
The mandatory environment argument should include the widest label for alignment. So, for instance, if you have more than 9 but fewer than 100 items, you may write two digits into the argument.
Using bibliography databases with BibTeX
Section titled “Using bibliography databases with BibTeX”Manually creating the bibliography can be tedious. Especially if you use references across several documents, it would be better to use a database and let a program generate the bibliography for you. This sounds more complicated than it actually is. Let’s try it.
We’ll create a separate database file containing the references from our previous example. We’ll modify our example to use that database. To make this work, we have to call the external program BibTeX:
- Create a new document. Begin by writing the entry for TeXbook:
@book{DK86,author = "D.E. Knuth",title = "The {\TeX}book",publisher = "Addison Wesley",year = 1986}
- Next, add the article, where we’ll specify even more fields:
@article{DK89,author = "D.E. Knuth",title = "Typesetting Concrete Mathematics",journal = "TUGboat",volume = 10,number = 1,pages = "31--36",month = apr,year = 1989}
- Save the file and name it
example.bib. Open our example document and modify it as follows:\documentclass{article}\begin{document}\section*{Recommended texts}To study \TeX\ in depth, see \cite{DK86}. For writing math texts,see \cite{DK89}.\bibliographystyle{alpha}\bibliography{example}\end{document} - Click Typeset one time with pdfLaTeX. If you’re using TeXworks, choose BibTeX instead of pdfLaTeX, present in the drop-down box next to the Typeset button, and then click on Typeset. If you are writing with another editor, use its BibTeX option or type at the command prompt in the document directory as follows, without a file name extension:
bibtex documentname
- Click on Typeset twice with pdfLaTeX. Here’s the result:

Figure 8.8 – A bibliography based on a database file
Figure 8.8 – A bibliography based on a database file
In this setup, we created a text file containing all the bibliography entries. Our document uses the alpha style, which sorts entries by the authors’ names and uses a shortcut consisting of the author and year keys as the label. We told LaTeX to load the bibliography file called example. The .bib extension is assumed automatically.
Then, we called the external program BibTeX. This program knows from the example .tex file that example.bib needs to be translated. Thus, out of this .bib file, it creates a .bbl file containing a LaTeX thebibliography environment and the final entries.
Finally, we had to compile twice to ensure that all the cross-references are correct.
Although this process involves a few extra steps to generate the bibliography, there are also advantages: we don’t need to fine-tune each entry, we can easily switch between styles, and we can then reuse the .bib file.
Now, let’s look at the .bib file format more closely.
Looking at the BibTeX entry fields
Section titled “Looking at the BibTeX entry fields”BibTeX supports various entry types, as we saw with the book and article entries. Furthermore, these entries contain fields such as author, title, and year. Let’s first look at the supported fields, and afterward, we’ll discuss the different kinds of entries.
Here’s a list of the standard fields. Some fields are common, some are rarely used; we’ll list them in alphabetical order, for completeness:
address: The address of the publisherannote: An annotation not used by the standard bibliography stylesauthor: The name(s) of the author(s)booktitle: The title of a book if you cite a part of it; you can also use thetitlefield insteadchapter: A chapter numbercrossref: The key of the database entry being cross-referencededition: The edition (first, second, and so on) of a book; it’s commonly in uppercaseeditor: The name(s) of the editor(s)howpublished: The way of publishing; the first word should be in uppercaseinstitution: This could be a sponsoring institutionjournal: A journal name; you may use standard abbreviationskey: Used for alphabetizing, cross-referencing, and labeling if the author’s information is missing; don’t confuse it with the key used in the\citecommandmonth: The month in which the work was published; a three-letter abbreviation is often usednote: Any additional helpful information; again, the first word should be in uppercasenumber: The number of a journal or another kind of work in a seriesorganization: This can be a sponsoring organizationpages: A page number or range of page numbers, such as 12-18 or 22+publisher: The name of the publisherschool: This could be the name of the school where the document was writtenseries: The name of a series of books or its number in a multi-volume settitle: The title of the worktype: The type of the publicationvolume: The volume of a journal or multi-volume bookyear: The year of the publication
You can read the BibTeX documentation by typing texdoc bibtex at the command line or visiting https://texdoc.org/pkg/bibtex.
Citing internet resources
Section titled “Citing internet resources”Nowadays, it’s common to cite web pages and other internet sources. To put internet addresses into BibTeX fields, use the \url command of the url or hyperref package, for example:
howpublished = {\url{https://latex.org}}Some styles’ bibliographies include a URL field that can be used to refer to internet addresses.
Understanding BibTeX entry types
Section titled “Understanding BibTeX entry types”Usually, you start by choosing the appropriate entry type you want to add, and then you fill in the fields. Different types may support various fields. Some fields are required, some are optional and may be omitted, and some are ignored when the style doesn’t support them.
Usually, the name of the entry tells you its meaning. These are the standard BibTeX entry types and their required and optional fields:

Figure 8.9 – BibTeX entry types and fields
Figure 8.9 – BibTeX entry types and fields
Have a look at the BibTeX reference for more details by typing the following at the command prompt:
texdoc bibtexAlternatively, you can visit https://texdoc.org/pkg/bibtex.
If no other entry fits, choose the misc type. It doesn’t matter whether you use capitals or small letters in a type; @ARTICLE is understood the same as @article. As the example shows, entries have the following form:
@entrytype{keyword,fieldname = {field text},otherfieldname = {other field text},…}Enclose the field text in braces. You can also use straight quotes instead, as in "field text". For numbers, you may even omit the braces. While entries are separated by a comma, never put a comma after the last field. Otherwise, BibTeX assumes another field must follow and may report an error.
Some styles change capitalization, which might result in undesired lowercase letters. To protect letters or words from becoming lowercase, put additional braces around them. Preferably, do it around a word rather than just the letter to keep ligatures and improve spacing. For example, {WAL} looks better than {W}AL, because in a standard text flow, LaTeX moves an A closer to a preceding W. Separating with braces interferes with LaTeX’s micro-typographic improvements.
Choosing the bibliography style
Section titled “Choosing the bibliography style”BibTeX offers several standard styles:
plain: Uses Arabic numbers for the labels, sorted alphabetically by the authors’ names. The number is written in square brackets, which also appear with\cite.unsrt: There’s no sorting. All entries appear in the order they were cited in the text. Apart from this, it looks like theplainstyle.alpha: Sorting is based on authors’ names; the labels are shortcuts consisting of the author’s name and the year of publication. Square brackets are used here as well.abbrv: This works likeplain, but abbreviates first names and other field entries.
Choose the style after \begin{document} but before \bibliography. You may write \bibliographystyle right before \bibliography to keep it together.
There are more styles available in TeX distributions and on the internet. For instance, the natbib package provides styles and the capability to cite in a nice author-year scheme. This package further adds some fields, such as ISBN, ISSN, and URL.
You could give the natbib package a try and use its plainnat, abbrvnat, and unsrtnat styles, for instance:
\usepackage{natbib}\bibliographystyle{plainnat}The natbib package reimplemented the \cite command and offers variations to it, with the main purpose of supporting author-year citations. It works with most other available styles. Itintroduces the citation command, \citet, for textual citations, and the \citep command for parenthetical citations. There are starred variants that print the full author list, and optional arguments that allow adding text before and after the list.
Check out the documentation if you would like to take advantage of this excellent package. As usual, type texdoc natbib at the command line or visit https://texdoc.org/pkg/natbib.
The biblatex package is a complete reimplementation of BibTeX’s bibliographic functionality. While BibTeX relies on a separate, stack-based style language, biblatex is native to LaTeX, which makes bibliography styles easier to customize and extend. You can find the documentation at https://texdoc.org/pkg/biblatex.
It works closely with the modern biber program, which replaces the traditional BibTeX program; see https://texdoc.org/pkg/biber for documentation. In the LaTeX Cookbook, 8, Producing Contents, Indexes, and Bibliographies, you can find a well-explained, step-by-step example using biblatex and biber.
Listing references without citing
Section titled “Listing references without citing”By default, BibTeX includes only references from the database that are cited in the text and prints them. However, you may specify keys for references, which should nevertheless appear. Just write the following for a single reference:
\nocite{key}Or, write the following to list the complete database:
\nocite{*}Make sure to remove \nocite{*} in the final version of the document if you don’t want to have references in the bibliography that you never cited in the document.
Now that we know how to create such tables of contents, lists of objects, indexes, and bibliographies, let’s have a final look at how to customize them.
Changing the headings
Section titled “Changing the headings”As shown in Figure 8.2, you can easily change the Contents heading if you don’t like it. LaTeX stores the text of the heading in the \contentsname text macro. So, you can redefine it as follows:
\renewcommand{\contentsname}{Table of Contents}Here’s a list of such macros and their default values:
\contentsname: Contents\listfigurename: List of figures\listtablename: List of tables\bibname: Bibliography (in thebookandreportclasses)\refname: References (in thearticleclass)\indexname: Index
Furthermore, here’s a list of other macros for names used by LaTeX, with their default values:
\figurename: Figure\tablename: Table\partname: Part\chaptername: Chapter\abstractname: Abstract\appendixname: Appendix
This is not really surprising! Using name macros is especially useful when you write in another language. For instance, the babel package takes a language option and redefines all those name macros according to the chosen language.
However, they are also helpful when choosing abbreviations, such as Fig., or different phrasing, such as Appendices instead of Appendix.
Adding a glossary
Section titled “Adding a glossary”A glossary is a structured list of terms with their definitions. It’s commonly used to explain technical vocabulary, abbreviations, and symbols in theses, scientific papers, technical manuals, and books, especially when terms recur throughout the text. Closely related are lists of acronyms and symbols, which serve the same purpose: helping readers find explanations quickly without interrupting the flow of the document.
In LaTeX, the recommended modern solution is the glossaries package. It’s powerful and flexible, handling everything from a short list of abbreviations to large, automatically generated glossaries in complex documents. Some highlights of this package include support for glossaries, acronyms, and symbols in a single framework; automatic sorting and formatting; fine control over entry display; integration with indexing tools; and support for multilingual documents.
The package is exceptionally well documented. It comes with a beginner’s guide, a detailed user manual, and an author FAQ, all available at https://ctan.org/pkg/glossaries.
Because the accompanying guides are so thorough, we won’t go into the details here. The point is: if you need a glossary or a list of symbols, this package is highly recommended.
Summary
Section titled “Summary”In this chapter, we covered many types of lists. Specifically, we learned how to generate and customize the table of contents and lists of figures and tables, produce an index pointing to relevant information for keywords and phrases, and create bibliographies, both manually and using a bibliography database.
These lists serve as navigation aids, guiding readers to the information they seek. They aren’t merely for listing and summarizing. Sometimes, there’s a strange requirement to list the table of contents within itself. If you are not sure about a design or a requirement, have a look at a good book in your particular field to see what exemplary tables of contents, lists, and indexes might look like.
You can find related examples in the LaTeX Cookbook, 8, Producing Contents, Indexes, and Bibliographies, with code examples available on the book’s website: https://latex-cookbook.net/chapter-08.
In the next chapter, we’ll take a closer look at scientific writing.