# Author's last name first using plainnat

running the risk that this has been asked before, I'll ask it again as commonly suggested solutions didn't seem to work:

My bibliography stubbornly gives first names first, but I'd like it the other way round.

I followed the suggestions re. changing the .bst file and now have the following name format function:

FUNCTION {format.names}
{ 's :=
#1 'nameptr :=
s num.names$'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{vv~}{ll}{, f.}{, 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 :=
}


A sample bibliography entry is

@article{ghysels2007midas,
title={MIDAS regressions: Further results and new directions},
author={Ghysels, Eric and Sinko, Arthur and Valkanov, Rossen},
journal={Econometric Reviews},
volume={26},
number={1},
pages={53--90},
year={2007},
publisher={Taylor \& Francis}
}


printing this

Eric Ghysels, Arthur Sinko, and Rossen Valkanov. Midas regressions: Further results and new directions. Econometric Reviews, 26(1):53–90, 2007.

As you can see, we've got first names first, which is a bit of a mystery to me. Any help on solving this would be greatly appreciated!

I copied plainnat.bst in the working directory as plainnat-swapnames.bst, making the suggested edit to the format.names function.

Then I composed the following minimal example:

\begin{filecontents*}{\jobname.bib}
@article{ghysels2007midas,
title={MIDAS regressions: Further results and new directions},
author={Ghysels, Eric and Sinko, Arthur and Valkanov, Rossen},
journal={Econometric Reviews},
volume={26},
number={1},
pages={53--90},
year={2007},
publisher={Taylor \& Francis}
}
\end{filecontents*}

\documentclass{article}
\usepackage[authoryear]{natbib}

\begin{document}

\cite{ghysels2007midas}

\bibliographystyle{plainnat-swapnames}
\bibliography{\jobname}

\end{document}


Usage of filecontents* is only for making the example self-contained, you can use whatever bib file you want.

Running LaTeX, BibTeX, LaTeX yielded the following result.

• Thanks for the reply! There must be something wrong with my workflow. As I see it, you could replicate what I intended with the code I had. I recycled my old bib file and ran latex - bibtex - latex as suggested but unfortunately no change. The example you used, didn't seem to like the .bib file in my case. Could there be anything else that is messing with that? I can normally build bibliographies without issues otherwise. Again, many thanks for this! Feb 1, 2018 at 15:17
• @PaulWohlfarth Check in the .blg file what's the .bst actually used. Feb 1, 2018 at 15:58