Natbib: Multiple reference citation

By thurnherr

Natbib is a reimplementation of the \cite command, providing both, author-year and numerical citations.You can get the distribution as well as the documentation from CTAN.Apparently, my previous post on this topic was not providing sufficient information in order to automatically create lists for multiple citations, e.g. [1,2,3, 5] -> [1-3, 5].Here is how it definitely works using “natbib”: First you include the package into your document with whatever options you prefer:

\usepackage[square, comma, sort&compress]{natbib}

Here, “sort&compress” provides the effect we are looking for, i.e. comma separation and hyphenation of multiple citations. By default, natbib uses round parentheses and colons, hence I changed them to square brackets and commas.Use

\citet{wikiEn}

for textual and

\citep{wikiEn}

for parenthetical citation, instead of \cite. The following example shows how Natbib replaces more than two consecutive citations by a hypen:

\documentclass{article}

\usepackage[square, comma, sort&compress]{natbib}

\begin{document}

\section{Comma separated citations}

Most popular search engines include Google and Yahoo, \citep{google, yahoo}.

\section{Citation list}The most popular free online encyclopaedia is available in different languages, \citep{wikiEn, wikiDe, wikiFr}.

\bibliographystyle{plainnat}

\begin{thebibliography}{99}

\bibitem{google}http://www.google.com. Google Inc. search engine, 2008.

\bibitem{yahoo}http://www.yahoo.com. Yahoo! Inc. search engine, 2008.

\bibitem{wikiEn}http://en.wikipedia.org. Wikipedia in English, 2008.

\bibitem{wikiDe}http://de.wikipedia.org. Wikipedia in German, 2008.

\bibitem{wikiFr}http://fr.wikipedia.org. Wikipedia in French, 2008.

\end{thebibliography}

\end{document}

My apologies, I got something wrong here in the first place. Natbib is not a bibliography-style, but a package providing  author-year and numerical citation. Natbib is supported by the following three styles:

plainnat.bst, abbrvnat.bst and unsrtnat.bst

which replace the standard bst-files.

(Source: http://merkel.zoneo.net/Latex/natbib.php)

Tags: , , , , , ,

10 Responses to “Natbib: Multiple reference citation”

  1. satsuma Says:

    Thanks for the good info, this really helps. One thing that your posting does not cover though, and neither does any other site that I’ve found about natbib, is how to set page numbers for multiple citations.

    What I mean is that sometimes it’s needed to have the citation like this: [2, p. 15 ; 4, p 181]

    I am not experienced enough with LaTex to provide a work-around for this. If you have a clue on how to do this, please add it to your blog. Appreciate it. Thanks.

  2. thurnherr Says:

    Hi!

    You are right, natbib cannot do it. But you can define your own citation-command as a work-around:

    \newcommand{\mycite}[4]{[\citenum{#1}, #2; \citenum{#3}, #4]}

    And now you can have multiple citations with page numbers as follows:

    \mycite{bla91}{p. 15}{bla99}{p. 181}

  3. satsuma Says:

    For some reason in my environment the natbib didn’t seem to have a command \citenum. All I got was an undefined control sequence error. But when I downloaded the natbib.sty and included in the directory where my tex files are, it is working.

    Thanks for sharing that work-around.

  4. satsuma Says:

    The problem with \citenum problem is that the version of natbib that came with LaTex is an old version from 2003. The new one I downloaded is from 2007.

  5. Louic Says:

    Thanks for your website, it’s very informative.

    I needed to download hypernat.sty and use
    \usepackage{hypernat}
    to get the “sort&compress” to work.

    Apparently there is a conflict between hyperref and natbib, which is solved by using hypernat.

    Happy TeX’ing

  6. k Says:

    I had to spend an hour with Google to find this one trivial command:
    \nocite{key}
    which puts a citation in your \bibliography, without showing up in the actual text (good for abstracts)

  7. Pradeep Says:

    Thanks a lot buddy.. How to use “square brackets” in natbib trick worked….

  8. Eivind Uggedal Says:

    satsuma: In my own thesis class I have to following to cite two sources with pages:


    % Double page citation
    \newcommand{\citedouble}[4]{%
    (\citealp[#1]{#2}; \citealp[#3]{#4})%
    }

  9. sohail Says:

    Using natbib, for a single citation with page number and the text see e.g. I do

    \citep[see e.g.][p.394]{efron1993ib}

    and it generates

    (see e.g. Efron and Tibshirani, 1993, p.394)

    but I am unable to do the same for the multiple citation with page numbers and the text see e.g. like

    (see e.g. Efron and Tibshirani, 1993, p.107; Chernick, 1999, p.84)

  10. Naveen Says:

    Thanks Thurnherr!! That helped.

Leave a Reply