1

I have to use natbib for a conference paper bibliography and I'm having trouble getting the numbering working. I have the following code:

...
\usepackage[numbers]{natbib}
...
\begin{document}
...
\bibliographystyle{unsrtnat}
\bibliography{FAR_citations}
\end{document}

With the following in FAR_citations.bib:

@ONLINE {spy_camera,
    author = "Adafruit",
    title  = "Spy Camera for Raspberry Pi",
    year   = "2015",
    howpublished = {\url{https://www.adafruit.com/products/1937}}
}

@ONLINE {raspberry_pi,
    author = "Adafruit",
    title  = "Raspberry Pi Model B+ 512MB RAM",
    year   = "2015",
    howpublished = {\url{http://www.adafruit.com/products/1914}}
}

@ONLINE {powerboost,
    author = "Adafruit",
    title  = "PowerBoost 500 Basic - 5V USB Boost at 500mA from 1.8V+",
    year   = "2015",
    howpublished = {\url{https://www.adafruit.com/products/1903}}
}

The output is:

enter image description here

The following are my problems:

  1. How do I make natbib sort the order of the citations by their order of appearance in the document?
  2. How do I make natbib put [1], [2], etc. instead of these weird [Ada15a], [Ada15b] type citations?

Thanks a lot for your help!

3
  • 1
    This code produces the right output for me: \documentclass{article} \usepackage[numbers]{natbib} \begin{document} \cite{raspberry_pi,powerboost,spy_camera} \bibliographystyle{unsrtnat} \bibliography{FAR_citations} \end{document} Commented Nov 24, 2015 at 7:18
  • Your screenshot strongly suggests that you (a) were using the alpha bibliography style (or something very similar) prior to switching to unsrtnat and (b) have not (or, not yet) re-run LaTeX, BibTeX, and LaTeX twice more, which is needed to fully propagate all changes. Try recompiling your document in the manner described in the preceding sentence.
    – Mico
    Commented Nov 24, 2015 at 9:07
  • Okay, I actually created a new latex project and copy pasted everything over and now, magically, is works. I was indeed using alpha prior to switching to unsrsat... however commenting out alpha changed nothing - and perhaps TeXlipse (what I use) was not doing the compilation properly? Commented Nov 24, 2015 at 13:21

1 Answer 1

1

The screenshot and description you've posted give the impression that you used to work with the alpha citation call-out style (probably achieved by specifying the bibliography style alpha, or something very similar) before switching over to an unsorted numeric call-out style, to be achieved by (a) using the unsrtnat bibliography style and (b) loading the natbib citation management package with the option numbers.

After switching bibliography styles, it is mandatory to recompile the document with LaTeX, re-run BibTeX, and then re-run LaTeX twice more in order to propagate all changes. Did you remember to run this four-step process?

Two additional comments/suggestions:

  • The entry type @online is not actually defined by either the unsrtnat or the alpha bibliography style. In such cases, BibTeX falls back on the catch-all entry type @misc to format the entries. The @misc entry type recognizes and knows how to process the field named howpublished.

  • Be sure to prevent BibTeX from lowercasing uppercase-letter acronyms -- such as USB, RAM, and MB -- that occur in the title fields of your entries. The easiest way to achieve this is to encase the contents of the title fields in curly braces.

Here's a modified version of your code that achieves your stated objectives and also preserves uppercase spelling of words in the title fields.

\RequirePackage{filecontents}
\begin{filecontents}{FAR_citations.bib}
@ONLINE {spy_camera,
    author = "Adafruit",
    title  = "Spy Camera for {Raspberry Pi}",
    year   = "2015",
    howpublished = {\url{https://www.adafruit.com/products/1937}},
}

@ONLINE {raspberry_pi,
    author = "Adafruit",
    title  = "{Raspberry Pi Model B+ 512MB RAM}",
    year   = "2015",
    howpublished = {\url{http://www.adafruit.com/products/1914}},
}

@ONLINE {powerboost,
    author = "Adafruit",
    title  = "{PowerBoost 500 Basic---5V USB Boost at 500mA from 1.8V+}",
    year   = "2015",
    howpublished = {\url{https://www.adafruit.com/products/1903}},
}
\end{filecontents}

\documentclass{article}
\usepackage[numbers]{natbib}
\bibliographystyle{unsrtnat}
\usepackage[hyphens]{url}

\begin{document}
\cite{powerboost}, \cite{raspberry_pi}, and \cite{spy_camera}.
\bibliography{FAR_citations}
\end{document} 
1
  • Great, really appreciate this help! Commented Nov 24, 2015 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .