# Customize bibliography style with natbib

Using the code below, my bibliography looks like this

.

How do I force LateX to:

1. Put the authors in alphabetical order by last name (eg. Basdevant and then Hall)
2. Put the last name of the first author first (eg. Basdevant, Oliver)

\documentclass{article}

\usepackage[round]{natbib}

\begin{document}

According to \citet{hall2003} ...

\bibliographystyle{plainnat}

\bibliography{/Users/joedangerstox/Documents/library}

\end{document}

• It is pretty uncommon to change the order of the authors of a publication: the order listed in the article/book/etc. is usually meant to reflect the relative weight or extent of each author's contribution. (I'm sure that's not always true, but how is the reader to judge in general.). – jon Aug 16 '13 at 4:57
• Yeah, it was actually originally in alphabetical order and I had messed it up in Mendeley. Fixed the problem in Mendeley. – JoeDanger Aug 16 '13 at 12:34

Solved it. I'll leave this here in case anyone else needs a solution. This will make the citations as follows:

Case of 1 author: LAST name, FIRST name

Case of 2 authors: LAST name, FIRST name, and FIRST name LAST name

Case of 3 authors: LAST name, FIRST name, FIRST name LAST name, and FIRST name LAST name

(1) I decided to try an look at the plainnat.bst file but found I didn't have one. I dunno if it as built in or something but I decided to download it from here

(2) Save this file somewhere as something different so you don't overwrite the original plainnat.bst (wherever is is) and open it.

(3) Search for this block of code:

FUNCTION {format.names}
{ 's :=
#1 'nameptr :=
s num.names$'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
nameptr #1 >
{ namesleft #1 >
{ ", " * t * }
{ numnames #2 >
{ "," * }
'skip$if$
t "others" =
{ " et~al." * }
{ " and " * t * }
if$} if$
}
't
if$nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$
}


and replace it with:

FUNCTION {format.names}
{ 's :=
#1 'nameptr :=
s num.names$'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{ll,~}{ff}{vv~}{, jj}" format.name$ 't :=
nameptr #1 >
{ namesleft #1 >
{ ", " * s nameptr "{ff~}{ll}{vv~}{, jj}" format.name$* } { numnames #2 > { "," * } 'skip$
if$t "others" = { " et~al." * } { " and " * s nameptr "{ff~}{ll}{vv~}{, jj}" format.name$ *}
if$} if$
}
't
if$nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$
}


(4) Replace

\bibliographystyle{plainnat}


With whatever path and file name you need to find the file (wherever you saved it)

\bibliographystyle{/Users/joedanger/Documents/my_plainnat.bst}

• You should not give it the same name if you edit a standard file like plainnat.bst: it can lead to future confusion (or worse if you do something like share the file with others or the web, or people start making their own changes and calling the modified file plainnat.bst). I highly recommend that you rename your modified file; perhaps myplainnat.bst or plainnat-mod.bst (or whatever). (Also, you did have a plainnat.bst: you would have received an error message if you did not.) – jon Aug 16 '13 at 4:52