Importing Your Bibliography


By the end of the chapter you will be able to:

  • export your bibliography from a reference manager
  • insert in text citations
  • control bibliography and citation style
  • compile your bibliography

Exporting a BibTeX file

Open your chosen reference management system. Select the files that you wish to form your bibliography, right click and then export as a BibTeX file. Save your file in the same directory as your main tex file. Your file should have a .bib file extension.

Open your main tex file and scroll down to the bottom where it says %Put bibliography here. To insert the bibliography we use \bibliography{bibliography filename}, where the .bib file extension is not needed.

To include the bibliography within the PDF bookmarks and the contents page we use \phantomsection and \addcontentsline{toc}{chapter}{Bibliography} just like with the abstract and acknowledgements.

Activity - Export a BibTeX file from your reference manager and add the example code to your main tex file.

Do not compile yet!

Inserting a bibliography

\addcontentsline{toc}{chapter}{BibTeX filename}

Insert text citations

To reference a paper within the text use \cite{citation key} where the citation key is taken from your BibTeX file. A typical BibTeX entry looks like the one on the right, where the citation key is given after the citation type. So in the example the citation key is Freegarde1997. You should also be able to right click on the entry in your reference manager and copy the LaTeX citation from there. The in text citation for this example then becomes:

In 1997 \cite{Freegarde1997} Freegarde et al showed that......

You can also cite several papers at once using:

\cite{citation key1,citation key2,citation key3,....}

To cite a particular page number of a reference use \cite[p.~215]{citation key}.

Finally, to include a bibliography entry that links to the correct page in your document, but not include an explicit reference, use \nocite{citation key}. This prevents the citation from appearing in the text but ensures that the reference still appears in the bibliography.

Activity - Create an in-text citation.

BibTeX entry

author = {Freegarde, Tim and Coutts, Julian and Walz, Jochen and Leibfried, Dietrich and Hansch, T.W.},
journal = {Journal of the Optical Society of America},
number = {8},
title = {{General analysis of type I second-harmonic generation with elliptical Gaussian beams}},
volume = {14},
year = {1997}

Control bibliography style

To control the bibliography style insert \bibliographystyle{option} below where you inserted your bibliography. The options below explain how you can control how the citations in appear in the text and how the references appear in the bibliography.

To use author-date citations add \usepackage{natbib} to the preamble. Natbib uses the same options as those on the right suffixed by nat; plainnat, abbrvnat and unsrtnat. Natbib can also use different citation commands, as seen in the table on the right.

Options Explanation
plain The in text citations are a number in square brackets, the bibliography is alphabetical by author's surname and the author's names are written in full.
abbrv Author's first names are reduced to just an initial, otherwise the same as plain.
unsrt References are not in alphabetical order but in the order that the citations appear in the text, otherwise the same as plain.
alpha The citation is an alphanumeric combination of the author's surname and the date in square brackets e.g. [EIN05].

Citation Result
\citet{Freegarde1997} Freegarde et al.(1997)
\citep{Freegarde1997} (Freegarde et al., 1997)
\citeauthor{Freegarde1997} Freegarde et al.
\citeyear{Freegarde1997} 1997
\citeyearpar{Freegarde1997} (1997)
\citealt{Freegarde1997} Freegarde et al. 1997

Compile your bibliography

To compile your bibliography and see all your references and in text citations properly formatted you must follow a set procedure. Firstly, run Quick Build as normal, then click on the dropdown arrow and choose BibTeX. Run BibTeX once and then change the dropdown box back to Quick Build. Run Quick Build twice before checking that all your references and citations are formatted correctly.

  1. Quick Build
  2. BibTeX
  3. Quick Build
  4. Quick Build

Activity - Compile your bibliography.

You should now see your bibliography file listed in the first TeXmaker window. If you click on this file it will open in TeXmaker and you can edit it manually if you wish, just remember to save it when you are finished. Once the BibTeX file is loaded, any new citations to the same references will be automatically made when you Quick Build once. If you wish to add more references you will need to go through the above procedure again.