5.6 Creating a Bibliography
If you have a large number of citations in your document, it's best to use an external bibliographic application[Creating a BibTeX bibliography file], such as bibtex or biber. However, that is beyond the scope of this book (see, instead, A Guide to LaTeX [7], The LaTeX Companion [3] or Using LaTeX to Write a PhD Thesis). Therefore this section just gives a brief explanation of the thebibliography environment, which is usually automatically generated using bibtex or biber.
This environment is very similar to the list making environments described
in §4.4. Lists, but instead of \item
use
where <key> is a unique keyword that identifies this
item. Your keyword can be anything you like, but as with
\label
I recommend that you use
a short memorable keyword. I tend to use the first author's surname
followed by the year of publication.
The bibliography heading depends on the class file you are using.
Most of the article-style classes, such as scrreprt, use
\refname
(which produces “References”) in an unnumbered
section, whereas the report and book-styles, such as scrreprt
and scrbook, use \bibname
(which produces
“Bibliography”) in an unnumbered chapter. See
Table 8.1 for the list of the common textual label
commands.
Most class files don't automatically add the bibliography to the table of contents. The KOMA-Script classes provide the bibliography option. This can be bibliography=totoc (an unnumbered unit added to the table of contents), for example,
or bibliography=totocnumbered (a numbered unit added to the table of contents), for example,
If you're not using
one of the KOMA-Script classes, consult the
documentation for your class to see if
there is an equivalent option. Failing that, you can use
\addcontentsline
(described in §5.4. Creating a Table of Contents).
For example (using a class that defines chapters):
Example:
(This example uses the command \LaTeXe
which produces the
LaTeX2e logo. This indicates the current version of LaTeX rather
than the old 2.09 version.)5.2The class style in use is scrbook, so the title is
given by \bibname
(“Bibliography”).
\begin
{thebibliography}{3}
\bibitem
{lamport94} ``\LaTeX
: a document preparation
system'', Leslie Lamport, 2nd edition (updated for
\LaTeXe
), Addison-Wesley (1994).
\bibitem
{kopka95} ``A Guide to \LaTeX
: document
preparation for beginners and advanced users'',
Helmut Kopka and Patrick W. Daly, Addison-Wesley (1995).
\bibitem
{goossens94} ``The
\LaTeX
\␣Companion'',
Michel Goossens, Frank Mittelbach and
Alexander Samarin, Addison-Wesley, (1994).
\end
{thebibliography}
You can cite an item in your bibliography with the command
Example:
Output:
If you want to cite multiple works, use a comma-separated list:
Output:
The optional argument <text> to
the \cite
command can be used to add text to the
citation.
Example:
Output:
The thebibliography environment has a mandatory argument:
The argument <widest tag> is the widest tag in the list of
entries. This helps LaTeX to align the references correctly. In
the example above, the tags appeared as: [1], [2] and [3], and [3]
is the widest so that was used as the argument. These tags can be
changed from the default numbers to something else using
the optional argument to the \bibitem
command.
Example (Textual Tags):
This example uses the optional argument of \bibitem
to use textual
rather than numerical tags. The widest tag is [Goossens 1994]
so that is chosen to be the argument of the thebibliography environment:
\begin
{thebibliography}{Goossens 1994}
\bibitem
[Lamport 1994]{lamport94}
``\LaTeX
\
: a document
preparation system'', Leslie Lamport, 2nd edition
(updated for \LaTeXe
), Addison-Wesley (1994).
\bibitem
[Kopka 1995]{kopka95}
``A Guide to \LaTeX
: document
preparation for beginners and advanced users'', Helmut Kopka
and Patrick W. Daly, Addison-Wesley (1995).
\bibitem
[Goossens 1994]{goossens94}
``The \LaTeX
\␣Companion'',
Michel Goossens, Frank Mittelbach and
Alexander Samarin, Addison-Wesley, (1994).
\end
{thebibliography}
Exercise 13: Creating a Bibliography
Try adding the following chapter to your document:
\chapter
{Recommended Reading}For a basic introduction to
\LaTeX
\␣see Lamport~\cite
{lamport94}. For more detailed information about\LaTeX
\␣and associated applications, consult Kopka and Daly~\cite
{kopka95} or Goossens\emph
{et al}~\cite
{goossens94}.and also add the bibliography shown above to the end of your document. You can download or view the solution, but have a go by yourself first. Remember that, as before, you will need to LaTeX the document twice to get the references up-to-date, unless you're using latexmk (as described in §5.5. Cross-Referencing) in which case it will be done automatically.
Footnotes
- ... version.)5.2
- If a friend or colleague gives
you a file containing
\documentstyle
instead of\documentclass
they are nearly 20 years out of date.
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).