[Tex/LaTex] Revise the AER bibliography style to write out all names if a piece has three authors

bibliographiesbibtex

For aer.bst, citations with 3 or more authors are listed using et al. I need to modify the bibliography so that citations with 4 or more authors are listed using et al., but that citations with 3 authors have all the names written out. For example, I want "See Adams, Brown, and Clark (2003)" as opposed to "See Adams et al. (2003)." I'm using natbib with LaTex: \usepackage{natbib,har2nat}

In order to do that, I need to modify the function format.lab.names.abbr.

Might someone know how to do this?

FUNCTION {format.lab.names.abbr}
{ 'name.list :=
  name.list num.names$ 'numnames :=
  numnames #1 >
    { numnames #2 >
        { name.list #1 "{vv~}{ll}" format.name$ " et al." * }
        { name.list #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            { name.list #1 "{vv~}{ll}" format.name$ " et al." * }
            { name.list #1 "{vv~}{ll}" format.name$ " and " *
              name.list #2 "{vv~}{ll}" format.name$ *
            }
          if$
        }
      if$
      field.used editor.field = {", eds" *} {} if$
    }
    {
        name.list #1 "{vv~}{ll}" format.name$
        field.used editor.field = {", ed" *} {} if$
    }
  if$
}


FUNCTION {format.lab.names.full}
{ 'name.list :=
  #1 'nameptr :=
  name.list num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { name.list nameptr "{vv~}{ll}" format.name$ 'temp :=
      nameptr #1 >
        { namesleft #1 >
            { ", " * temp * }
            { temp "others" =
                { " et~al." * }
                { " and " * temp * }
              if$
            }
          if$
        }
        'temp
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  numnames #1 > field.used editor.field = and {", eds" *} {} if$
  numnames #1 = field.used editor.field = and {", ed" *} {} if$
}

Best Answer

(This answer addresses only the matter of making the aer style insert an "Oxford comma". Since you're using the natbib citation management package, use \citet* and \citep* to generate citation call-outs that display the names of all authors/editors.)

To make the aer bibliography style insert an "Oxford comma" -- a comma just before the "and" particle that's inserted before the final item in the list of author/editor names, assuming the list contains three or more items -- you could apply the following edits:

  • Find the file aer.bst in your TeX distribution, make a copy of this file, and name the copy (say) aernc.bst. Don't edit an original file directly.

  • Open the file aernc.bst in a text editor, locate the function format.lab.names.full (which, in my copy of this file, starts on line 605), and in this function locate the line

                    { " and " * temp * }
    
  • Change this line to

                    { ", and " * temp * }
    
  • Save the file aernc.bst either to the directory where your main tex file is located or to a directory that's searched by BibTeX. If you choose the second option, be sure to update the filename database of your TeX distribution. Start using the new bibliography style by replacing \bibliographystyle{aer} with \bibliographystyle{aernc}. Be sure to run latex, bibtex, and latex twice more to fully propagate all changes.

Here's an MWE that uses \cite* for an entry with exactly three authors.

enter image description here

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{bbb,
  author = "Anna Andersen and Bert Branson",
  title  = "Thoughts",
  journal= "MyJournal",
  year   = 3002,
  volume = 1,
  number = 1,
  pages  = "1-100",
}
@article{ccc,
  author = "Anna Andersen and Bert Branson and Carla Carlsson",
  title  = "Thoughts",
  journal= "MyJournal",
  year   = 3003,
  volume = 1,
  number = 1,
  pages  = "1-100",
}
@article{ddd,
  author = "Anna Andersen and Bert Branson and Carla Carlsson and David Davies",
  title  = "Thoughts",
  journal= "MyJournal",
  year   = 3004,
  volume = 1,
  number = 1,
  pages  = "1-100",
}
\end{filecontents*}
\usepackage{natbib}
\bibliographystyle{aernc}
% \setcitestyle{aysep={}} % if you want to suppress the comma between author and year
\begin{document}
\cite{bbb}

\cite*{ccc}

\cite{ddd}
\bibliography{\jobname}
\end{document}