3

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$
}
  • Welcome to TeX.SE! Rather than hack an existing style file of unknown vintage and unknown interoperability with natbib, I suggest you run the makebst utility, which is a part of the custom-bib package, to create your own custom bibliography style file. The custom-bib package was created by the author of natbib, by the way. The process is really quite easy: it's a menu-driven set of queries, where each question comes with several choices. One of the questions will be about how you wish to truncate the number of authors shown in citation call-outs. – Mico Dec 4 '14 at 20:13
  • @Mico Thank you for your suggestion. For this task, I have the .bst file almost exactly as I need. This is the only tweak required. If possible, it would be ideal for me if it were possible to just slightly revise the .bst file. – user67403 Dec 4 '14 at 20:33
  • Depending on the internal structure of aer.bst, what you may call "tweaking" could turn out to be a bear of a job. Hence my recommendation to start from scratch. Incidentally, I'm an economist and have in the past tried to use the aer style, just for fun. I found it to be buggy, and hence I don't use it for my own working papers. If you happen to like the formatting that's produced by the aer style file, you'll find you're much better off in the long run spending five to ten minutes creating a new style file from scratch using the makebst utility. – Mico Dec 4 '14 at 20:38
  • Incidentally, did you check out the posting In-text citation: list all authors for pieces with three (or fewer) authors? – Mico Dec 4 '14 at 20:42
  • 1
    @Mico There is one other solution I noticed. I can use \cite*. However, the issue with \cite* is that it prints references as Berry, Levinsohn and Pakes (1995) instead of Berry, Levinsohn, and Pakes (1995) That is, it is missing the Oxford comma. This is strange because it seems to have it in the below link gking.harvard.edu/files/natnotes2.pdf. Any thoughts on how to get the comma back? – user67403 Dec 5 '14 at 6:54
4

(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}
  • I apologize, but I had an additional question. For formatting within parentheses, I need to eliminate the comma that comes before the year, e.g., "This paper draws on prior work (Berry, Levinsohn, and Pakes, 1995)." Specifically, I would like to eliminate the comma before 1995. Can that be done in aer.bst? – user67403 Dec 5 '14 at 23:48
  • @user67403 - Please take a few minutes to read and familiarize yourself with the natbib package's user guide. You'll find that the instruction \setcitestyle{aysep={}} will come in handy. – Mico Dec 6 '14 at 7:45

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.