[Tex/LaTex] Modify list of authors (`format.names` problem)

apa-stylebibliographiesbibtexnatbib

I am using natbib and started with apa-good.bst and was able to make minor modifications; for example use full-name instead of abbreviated 🙂 But even after reading several tutorials on the "unnamed programming language" used to specify bst files, I can't figure the following out:

I currently have {ll}, {ff} for all authors with an & before the last; i.e.:

  Aurnague, Michel, Hickmann, Maya, & Vieu, Laure

But I want only the first to be {ll}, {ff} and after one comma all other authors should follow as {ff} {ll}; i.e.:

  Aurnague, Michel, Maya Hickmann & Laure Vieu

Any hints are greatly appreciated. My prof won't let me change the bibliography to anything consistent 😐

Here is the current format.names:

FUNCTION {format.names}
{ 'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}{, ff}{, jj}"
      format.name$
      bibinfo bibinfo.check
      't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              "," *
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal *
                }
                {
                  "\&"
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}

Best Answer

The bibliography style file apa-good.bst, by default, indeed does not provide for different ordering of first and last names depending on whether or not the author/editor is listed first. Fortunately, though, adding this functionality isn't too hard to achieve.

Make a copy the file apa-good.bst and name the copy, say, myapa-good.bst. Then, in the function format.names (which starts on line 365 of my system's copy of this file, search for the following block of lines:

numnames 'namesleft :=
  { namesleft #0 > }
  { s nameptr
    "{vv~}{ll}{, ff}{, jj}"
    format.name$
    bibinfo bibinfo.check

and replace it with

numnames 'namesleft :=
  { namesleft #0 > }
  { s nameptr
    duplicate$ #1 >
      { "{ff }{vv~}{ll}{, jj}" }
      { "{vv~}{ll}{, ff}{, jj}" }
    if$
    format.name$
    bibinfo bibinfo.check

In these code snippets, I've already replaced {, f.} in the original bst file with {, ff} because you've indicated that you do not wish to abbreviate the authors' first names.

With this patch, you're instructing BibTeX to perform a check to see if the number of names of authors/editors left to be processed is greater than 1. If yes, it uses the formatting string {ff }{vv~}{ll}{, jj}; if no, i.e., if there's only one name left to be processed (which, because of BibTeX's "Reverse Polish Notation" method of handling the stack, must be the first author/editor), it uses the string {vv~}{ll}{, ff}{, jj}.

You should next store the new .bst file in a directory that's searched automatically by your TeX distribution and, if necessary, run texhash (or whichever command is appropriate for your TeX distribution) to update the distribution's filename database. Finally, be sure to issue the command

\bibliographystyle{myapa-good}

instead of \bibliographystyle{apa-good}.

Happy BibTeXing!