LaTeX/More Bibliographies

From Wikibooks, open books for an open world
Jump to navigation Jump to search

LaTeX

Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials

Mechanics

  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics

Programming

  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes

Miscellaneous

  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC

This is a gentle introduction to using some of the bibliography functionality available to LaTeX users beyond the BibTeX basics. This introduction won't be discussing how to create new styles or packages but rather how to use some existing ones. It is worth noting that Harvard, for example, is a citation style. It is associated with an alphabetical reference list secondarily ordered on date, but the only strictly defined element of Harvard style is the citation in author-date format.

The example data[edit | edit source]

The database used for my examples contains just the following

@article{Erdos65,
	title = {Some very hard sums},
	journal = {Difficult Maths Today},
	author = {Paul Erd\H{o}s and Arend Heyting and Luitzen Egbertus Brouwer},
	year = {1930},
	pages = {30}
}

The limits of BibTeX styles[edit | edit source]

Using cite.sty and BibTeX makes it very easy to produce some bibliography styles. But author-date styles - for example the often mentioned, never defined "Harvard" - are not so easy. It's true that you can download some .bst files from CTAN that will handle some variants but using them is not always straightforward. This guide deals with Natbib a supplementary package that can access .bib files and has sophisticated functionality for producing custom or default author-year format citations and bibliographies as well as the numerical styles handled by BibTeX.

Natbib[edit | edit source]

Natbib is a package created by Patrick Daly as a replacement for the cite.sty package when author-date citation styles are required. Natbib provides three associated bibliography styles:

  • plainnat
  • abbrvnat
  • unsrtnat

which correspond to the three styles available by default in BibTeX where you have a plain numbered style, an abbreviated numbered style and an unsorted numbered style.

Alongside these new styles is an extended set of citation commands to provide flexible citation formats. These are

\citet[]{}

and

\citep[]{}

each of which has a number of variants.

The Preamble[edit | edit source]

All Natbib styles require that you load the package in your document preamble. So, a skeleton LaTeX file with Natbib might look like this:

\documentclass[]{article}
\usepackage[round]{natbib}

\begin{document}

Document body text with citations.

\bibliographystyle{plainnat}
\bibliography{myrefs}

\end{document}

Options[edit | edit source]

Options available with Natbib can be specified in the brackets on the \usepackage command. Among them are:

Option Effect
round ()
square []
curly {}
angle <>
semicolon separate citations with ;
colon as semicolon
comma separate with commas
authoryear author-year citations
numbers numeric citations
super superscript citations
sort multiple citations are ordered as in bibliography
sort&compress as sort but number ranges are compressed and hyphenated
compress number ranges are compressed and hyphenated but only where the 'natural' sort produces a continuous range
longnamesfirst first citation is full author list and subsequent citations are abbreviated
sectionbib allows multiple bibliographies in the same document
nonamebreak forces all author names onto one line
merge merges a citation with a previous citation
elide elides any repeated elements in merged references
mcite ignore merge

Clearly some of these options require explanation but that will be achieved via examples below. For now, we just note that they can be passed through \usepackage[]{} in the preamble of your LaTeX file.

Citation[edit | edit source]

Basic Citation Commands[edit | edit source]

To cite with Natbib, use the commands \citet or \citep in your document. The "plain" versions of these commands produced abbreviated lists in the case of multiple authors but both have * variants which result in full author listings. We assume the use of the round option in these examples.

\citet and \citet*[edit | edit source]

The \citet command is used for textual citations, that is to say that author names appear in the text outside of the parenthetical reference to the date of publication. This command can take options for chapter, page numbers etc. Here are examples

\citet{Erdos65}producesErdős et al. (1965)
\citet[chapter 2]{Erdos65}producesErdős et al. (1965, chapter 2)
\citet[pp. 10-12]{Erdos65}producesErdős et al. (1965, pp. 10-12)
\citet[see][chap. 2]{Erdos65}producesErdős et al. (see 1965, chap. 2)

Here are the \citet* versions

\citet*{Erdos65}producesErdős, Heyting and Brouwer (1965)
\citet*[chapter 2]{Erdos65}producesErdős, Heyting and Brouwer (1965, chapter 2)
\citet*[pp. 10-12]{Erdos65}producesErdős, Heyting and Brouwer (1965, pp. 10-12)
\citet*[see][chap. 2]{Erdos65}producesErdős, Heyting and Brouwer (see 1965, chap. 2)

\citep and \citep*[edit | edit source]

The \citep command is used where the author name is to appear inside the parentheses alongside the date.

\citep{Erdos65}produces(Erdős et al. 1965)
\citep[chapter 2]{Erdos65}produces(Erdős et al. 1965, chapter 2)
\citep[pp. 10-12]{Erdos65}produces(Erdős et al. 1965, pp. 10-12)
\citep[see][chap. 2]{Erdos65}produces(see Erdős et al. 1965, chap. 2)
\citep[e.g.][]{Erdos65}produces(e.g. Erdős et al. 1965)

Here are the \citep* versions

\citep*{Erdos65}produces(Erdős, Heyting and Brouwer 1965)
\citep*[chapter 2]{Erdos65}produces(Erdős, Heyting and Brouwer 1965, chapter 2)
\citep*[pp. 10-12]{Erdos65}produces(Erdős , Heyting and Brouwer 1965, pp. 10-12)
\citep*[see][chap. 2]{Erdos65}produces(see Erdős , Heyting and Brouwer, 1965, chap. 2)
\citep*[e.g.][]{Erdos65}produces(e.g. Erdős , Heyting and Brouwer, 1965)

The Reference List[edit | edit source]

Having dealt with basic varieties of citation, we turn to the creation of the bibliography or reference list.

Inserting a correct and correctly formatted bibliography when using Natbib is no different than when using plain BibTeX. There are two essential commands -

\bibliography{mybibliographydatabase}

which LaTeX interprets as an instruction to read a bibliographic database file (eg myrefs.bib) and insert the relevant data here, and

\bibliographystyle{plainnat}

which specifies how the data are to be presented.

Above the three basic Natbib styles were mentioned as analogues of the partially homonymous styles in BibTeX. Let us imagine documents bearing citations as in the section about citation above. Here is, approximately, how these citations would appear in plainnat.

What more is there?[edit | edit source]

This covers the basic functionality provided by the package Natbib. It may not, of course, provide what you are looking for. If you don't find what you want here then you should probably next investigate harvard.sty which provides a slightly different set of author-date citation functions. Providing a gentle guide to harvard.sty is my next rainy day project.


Previous: Bibliography Management Index Next: Letters