2

I found a bunch of threads with similar problems, but I didn't manage to solve mine, because slightly different. I would like to have the bibliography shown as:

Doniger, W.. Splitting the Difference. Chicago: University of Chicago Press, 1999.

Instead, I have:

W. Doniger, Splitting the Difference. Chicago: University of Chicago Press, 1999.

my code is:

\documentclass[12pt,a4paper,openany]{report}
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={(},close={)}}
...
\printbibliography
\bibliography{bib}
\end{document}

Basically I only need to invert the first name and the last name without changing anything else, because it is already in alphabetical order and with the citation style that I need. I use an online version of latex, so I don't know if I can change the packages (and I don't know how to do it). Any idea?

  • 1
    Most of the code you have shown is standard BibTeX/natbib, but you also call \printbibliography, which is only defined by biblatex. This should get an error message (if you are using Overleaf, see tex.meta.stackexchange.com/q/7898/35864). You probably should drop the call to \printbibliography with this setup. – moewe Jun 25 at 18:31
  • That said, the name format is defined by your bibliography style (abbrvnat), if you want to change that, you need to modify the bibliography style or change the style. – moewe Jun 25 at 18:36
  • Thanks @moewe, it works even without the \printbibliography, but I did not understand how to modify the names order. Could you please give an example or a reference link? – hydra Jun 25 at 21:32
  • I've taken the liberty of deleting the biblatex and citing tags. – Mico Jun 25 at 22:16
2

I suggest you proceed as follows.

  • Find the file abbrvnat.bst in your TeX distribution. If you work with an online LaTeX compiler, I suggest you obtain the file from https://www.ctan.org/tex-archive/macros/latex/contrib/natbib/.

  • Make a copy of this file and call the copy, say abbrvnat-reverse.bst. Don't edit an original file of the TeX distribution directly.

  • Open the file abbrvnat-reverse.bst in a text editor. The editor you use to edit your tex files will do fine.

  • In the file abbrvnat-reverse.bst, locate the function format.names. In my copy of this file, the format.names function starts on line 216.

  • In this function, locate the following line:

        { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
    

    Change this line to

        { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
    
  • Save the file abbrvnat-reverse.bst either in the directory where your main tex file is located (this instruction applies if you use an online LaTeX compiler) or in a directory that's searched by BibTeX. If you choose the latter method, please also update the filename database of your TeX distribution suitably.

  • In your main TeX file, change

    \bibliographystyle{abbrvnat}
    

    to

    \bibliographystyle{abbrvnat-reverse}
    
  • Finally, perform a full recompile cycle -- LaTeX, BibTeX, and LaTeX twice more -- to fully propagate all changes.

Happy BibTeXing!

  • Thanks a lot @Mico , that was very clear and it worked perfectly! :) – hydra Jun 26 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.