Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Chapter 5: Textual tools

Section 5.3: References

This is one of the most powerful features of LATEX. As we mentioned when discussing Figures and Tables, you can label any point in a document with a name you make up, so that you can refer to it by that name from anywhere else in the document (or even from another document) and LATEX will always work out the right cross-reference number for you, no matter how much you edit the text or move it around.

As we well see later, a similar method is also used to cite documents for a bibliography or list of references, and there are packages to sort and format these in the correct style for different journals or publishers.

5.3.1 Cross-references

You label the place in your document you want to refer to by adding the command \label followed by a short name you make up, in curly braces: exactly as we did for labelling Figures and Tables in § 4.2.2.

\section{New Research}

You can then refer to this place from anywhere in the same document with the command \ref followed by the name you used, eg

In section~\ref{newstuff} there is a list of recent 

In section 13.5 there is a list of recent projects.

  • Note the use of the unbreakable space (~) between the \ref and the word before it. This prints a space but prevents the line ever breaking at that point, should it fall close to the end of a line when being typeset.

  • The \S command can be used if you want the section sign § instead of the word ‘section’ (there is also a \P command that produces the paragraph sign or pilcrow ).

Labels MUST be unique (that is, each value MUST occur only once as a label within a single document), but you can have as many references to them as you like. If you are familiar with HTML, this is the same concept as the internal linking mechanism using # labels (or IDs in XHTML or HTML5).

Labels in normal text

If the label is in normal text, as above, the reference will give the current chapter/section/subsection number (depending on the current document class).

Labels in Tables or Figures

If the label is inside a Table or Figure, the reference provides the Table number or Figure number prefixed by the chapter number (remember that in Tables and Figures the \label command MUST come after the \caption command).

The \ref command does not produce the word ‘Figure’ or ‘Table’ for you: you have to type it yourself, or use the varioref package which automates it.

Labels in lists

A label in an item in an enumerated list will provide the item number. In other lists its value is null or undefined.

Labels elsewhere

If there is no apparent countable structure at the point in the document where you put the label (in a bulleted list, for example), the reference will be null or undefined.

The command \pageref followed by any of your label values will provide the page number where the label occurred, instead of the reference number, regardless of the document structure. This makes it possible to refer to something by page number as well as by its \ref number, which is useful in very long documents like this one (varioref automates this too).

LATEX records the label values each time the document is processed, so the updated values will get used the next time the document is processed. You therefore need to process the document one extra time before final printing or viewing, if you have changed or added references, to make sure the values are correctly resolved. Most LATEX editors handle this automatically by typesetting the document twice when needed.

Unresolved references are printed as two question marks, and they also cause a warning message at the end of the log file. There’s never any harm in having \labels you don’t refer to, but using \ref when you don’t have a matching \label is an error, as is defining two labels with the same value.

5.3.2 Bibliographic references

The mechanism used for references to reading lists and bibliographies is very similar to that used for normal cross-references. Instead of using \ref you use \cite or one of the variants explained in §; and instead of \label, you attach a label value to each of the reference entries for the books, articles, reports, etc that you want to cite. You keep these reference entries in a bibliographic reference database that uses the BIBTEX data format (see §

This does away with the time needed to maintain and format them each time you use them, and dramatically improves accuracy. It means you only ever have to enter the bibliographic details of your references once, and you can then cite them in any document you write, and the ones you cite will get formatted automatically to the style you specify. Choosing between BIBTEX and biblatex

LATEX has two systems for doing this, BIBTEX and biblatex: both of them use the same file format, called BIBTEX.

  • the older BIBTEX system uses a separate file for each style format (eg Harvard, Oxford, IEEE, Vancouver, MLA, APA, etc), plus a sort-and-extract program also called bibtex, which creates the formatting for the references in LATEX. The drawbacks of BIBTEX are that a) it doesn’t handle accented and other non-Latin characters very easily and b) the style format files (.bst files) are written in its own rather strange language, making them extremely difficult to modify.

  • the newer biblatex system is a standard LATEX package with options for the different style formats. There is also a new program (biber) to replace bibtex for sorting and extracting the references from your BIBTEX file. The main advantages are that biblatex a) works with UTF-8 characters, so accents and other writing systems are handled natively, especially with XƎLATEX and b) is written entirely in LATEX, providing a much more extensible data model, so extending or modifying it is much easier than with BIBTEX.

The biblatex package with the biber program is therefore recommended, as it is under active development. However, there are a few classes and packages which may still require BIBTEX style formats, and there are some less common style formats which are still not available prepackaged for biblatex. The flexibility of the biblatex data model means altering or extending style formats is possible, but this is not a task for the beginner.

Both systems use the same database file format, still called a ‘BIBTEX file’ after the older system, so you can switch between the systems if needed. The BIBTEX file format

The format for BIBTEX files, used for both biber and bibtex programs, is specified in the original BIBTEX documentation (look on your system for btxdoc.pdf), but the biblatex package and its updated style formats provide more fields.

There is a prescribed minimum set of fields for each of a dozen or so types of document: book, article (in a journal), article (in a collection), chapter (in a book), thesis, report, paper (in a Proceedings), etc, exactly as with all other reference management systems. These are listed in detail in the biblatex documentation (Lehman, Kime, Boruvka and Wright, 2015).

Each entry starts with an @ sign followed by the type of document, followed by the whole entry in a single set of curly braces. The first value is the unique key (label) that you make up, followed by a comma:



Then comes each field (in any order), using the format:

keyword = {value},

There MUST be a comma after each line except the last.

   title        = {{An Innkeeper's Diary}},
   author       = {John Fothergill},
   edition      = {3rd},
   publisher    = {Penguin},
   year         = 1929,
   address      = {London}

Most TEX-sensitive editors have a BIBTEX mode which understands these entries and provides menus or templates for writing them. The rules are:

  • Omit the comma after the last field in the entry (only — eg after {London} in the example)

  • Some styles recapitalise the title when they format: to prevent this, enclose the title in double curly braces as in the example;

  • Also use extra curly braces to enclose multi-word surnames, otherwise only the last will be used in the sort, and the others will be assumed to be forenames, for example the British explorer can be sorted under T with Ranulph {Twisleton Wykeham Fiennes}

  • Multiple authors go in the one author field, separated by the word and (see example below)

  • Values which are purely numeric (eg years) may omit the curly braces;

  • Fields can occur in any order but the format must otherwise be strictly observed;

  • Fields which are not used do not have to be included (so if your editor automatically inserts them as blank or prefixed by OPT [optional], you can safely delete them as unused lines)

Here’s another example, this time for a book on how to write mathematics — note the multiple authors separated by and.

  author = 	 {Donald E Knuth and Tracey Larrabee and
                  Paul M Roberts},
  title = 	 {{Mathematical Writing}},
  publisher = 	 {Mathematical Association of America},
  address = 	 {Washington, DC},
  series = 	 {MAA Notes 14},
  isbn = 	 {0-88385-063-X},
  year = 	 {1989}}

Every reference in your reference management software MUST have a unique key value (label or ID): you can make this up, just like you do with normal cross-references, but some bibliographic software automatically assigns a value, usually based on some abbreviation of the author and year. These keys are for your convenience in referencing: in normal circumstances your readers will not see them. You can see these labels in the right-hand-most column and at the bottom of the screenshot in Figure 5.1, and in the examples above. You use this label in your documents when you cite your works.

There are many built-in options to the biblatex package for adjusting the citation and reference formats, only a few of which are covered here. Read the package documentation for details: it is possible to construct your own style simply by adjusting the settings, with no programming required (unlike the older BIBTEX styles, which are written in a programming language used nowhere else). Citation commands

The basic command is \cite, followed by the label of the entry in curly braces. You can cite several entries in one command: separate the labels with commas.


For documents with many citations, use the Cite button or menu item in your bibliographic reference manager, which will insert the relevant command for you (you can see it activated for the TEXStudio editor in Figure 5.1).

How the citation appears is governed by the reference format (style) you specify in the options to the biblatex package (see § or in a \bibliographystyle command if you are using BIBTEX (see § There are three common formats used:


There are two types of this format: one with the year in parentheses and one with the whole citation in parentheses.

The first type is used in phrases or sentences where the name of the author is part of the sentence, and the year is there to identify what is being cited; in biblatex this command is \textcite{fg} has clearly been shown by Fothergill (1929).

The second type is used where the phrase or sentence is already complete, and the citation is being added in support: in biblatex this command is \parencite{fg} we have already clearly shown (Fothergill, 1929).


This format is popular in some scientific disciplines and produces just a number in square brackets [42]. The references at the end of the document are numbered in sort order.


This format is also popular in some scientific disciplines and produces a three- or four-letter abbreviation of the author’s name and two digits of the year, all in square brackets [Fot29]. The references at the end of the document are labelled with the same format in sort order.

To direct your reader to a specific page or chapter, you can add a suffix as an optional argument in square brackets before the label. This gets printed after the citation but within the parentheses, if any; for example \cite[Foreword, p.13]{fg} produces (Fothergill, 1929, Foreword, p.13). If you are using biblatex, you can specify a prefix and a suffix as two optional arguments: in this case the first is the prefix and the second is the suffix.

Footnoted citations are common in History and related disciplines, to the extent that scholars in these fields actually call their references ‘footnotes’, which is confusing. The command \footcite does these (see Table 5.1) but it is only relevant for author-year styles (in numeric style it just produces the number, which looks wrong).

There are many variant forms of these commands, either for specific styles like Harvard, IEEE, MLA, etc; or for grammatical modifications like capitalising name prefixes, omitting the comma between name and year, or adding multiple notes; or for extracting specific fields from an entry (eg \titlecite). If you have requirements not met by the formats described here, you can find them in the documentation for the biblatex package.

Table 5.1: Citation style commands and formats

authoryear\cite{fg}(Fothergill, 1929)
authoryear\parencite{fg}(Fothergill, 1929)
authoryear\textcite{fg}Fothergill (1929)

¹ Fothergill 1929.

If you are using BIBTEX, the commands you can use are not standardised except for \cite. Instead, they depend on which style format you use, for example the popular natbib package, which implements author-year citation for the natural sciences, uses \citet and \citep instead of \textcite and \parencite.

Figure 5.1: JabRef displaying a file of references, ready to insert a citation to Fothergill’s book into a LATEX document being edited with TEXStudio


Your reference management software will have a display something like Figure 5.1 (details vary between systems, but they all do roughly the same job in roughly the same way), showing all your references with the data in the usual fields (title, author, date, etc).

Your BIBTEX file, saved or exported to a .bib file from your reference management software, looks like the examples in §

If your software doesn’t save BIBTEX format direct, save it in RIS format, then open the .ris file in something like JabRef and save it as a .bib file from there. Setting up biblatex with biber

You set up your document by adding the csquotes and biblatex packages, specifying the biber program and the style of references you want, either numeric or alphabetic or authoryear, or a publisher’s style (here I am using APA format). The default language is American English, so there are optional commands to map this to other language variants (shown here for British English). You also specify the name of your BIBTEX file[s] (see the sidebar ‘Bibliographic reference databases’) with one or more \addbibresource commands:


The csquotes package is needed to ensure that citation of any titles needing quotation marks will be handled correctly.

Finally, you need to add the \printbibliography command at the point in your document where you want the full list of references you have cited to be printed. See § for details of how XƎLATEX produces the references. Using BIBTEX

The BIBTEX method is deprecated, partly because it does not handle UTF-8 character-encoding correctly, and partly because its unusual internal programming language makes it hard to extend.

The principles underlying BIBTEX are identical to biblatex: you create and maintain your BIBTEX file of references in exactly the same way, and you use the \cite in the same way. But there is no basic package to load with options: instead, you specify the name of the style you want, using a \bibliographystyle command in your Preamble, plus any additional packages needed to help with the formatting. You then use the \bibliography command to give the name of your BIBTEX file (without the .bib extension) at the point you want the references to be printed.


In this example the American Political Science Review (APSR) Harvard-like reference style has been selected (common in the political and economic sciences), which normally means numerical citation, but the author wants the Natural Sciences (author-year) form of citation, which is provided by the natbib package, which in turn requires the har2nat package to handle Harvard-style formatting. The natbib package provides \citet for textual citation like Fothergill (1929), and \citep for parenthetic citation like (Fothergill, 1929).

There is an option on all the cite commands and variants to let you specify a suffix to the citation, so \citep[Foreword, p.13]{fg} produces (Fothergill, 1929, Foreword, p.13).

See § for details of how PDFLATEX produces the references. Producing the references

Because of the record-extract-format process (the same as used for cross-references), you will get a warning message about ‘unresolved references’ the first time you process your document after adding a new citation for a previously uncited work and running biber or bibtex. The bibtex program produces a bold ?? where the unresolved reference will be; biber produces the entry label in bold instead. This will disappear once LATEX has been run again, which is why so many editors have a Build function to do the job for you.

Your LATEX editor’s Typeset or Build button or menu entry should therefore handle the business of running biber or bibtex for you. If not, here’s how to do it manually in a Command window:

For XƎLATEX with biber

Run XƎLATEX, then run biber to extract and sort the details from the BIBTEX file, and then run XƎLATEX again:

xelatex myreport
biber myreport
xelatex myreport
For PDFLATEX with bibtex

Run PDFLATEX, then run bibtex to extract and sort the details from the BIBTEX file, and then run PDFLATEX again twice (to resolve the references):

pdflatex myreport
bibtex myreport
pdflatex myreport
pdflatex myreport

In practice, authors tend to retypeset their documents from time to time during writing anyway, so they can keep an eye on the typographic progress of the document. Just clicking the Typeset or Build button after adding a new \cite command, and subsequent runs of LATEX will incrementally incorporate all references without you having to worry about it.

  1. Be aware that in some disciplines where cross-references are not much used, the word ‘references’ may be used to mean ‘bibliographic references’. 

  2. This section is labelled normalxref, for example. 

  3. Thus I can refer here to the label at the start of this section as \ref{normalxref} and get the value ‘§ 5.3.1’.  

  4. In fact, the old bibtex program can be still be used instead of biber with biblatex, but this seems perverse.