[Tex/LaTex] Adapt BibTeX style to give all initials

bibtex

I'm using a modification of the plainyr BibTeX style. Although my bib-file contains all initials for some authors (e.g. B.D. McKay), I end up with just the first initial in my document (e.g. B. McKay). I thought about editing the BibTeX style myself, but after seeing the code, I decided against it. Maybe there are some people who are more knowledgeable in this area of expertise.

I want my final document to include the initials for all the names, and not just those of the first name.

This is the relevant code of the BibTeX style, or at least, I think it is the relevant code.

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

Best Answer

The BibTeX format.name$ function interprets B.D. as a single name, but B. D. as two initials. Thus you must have a space between each initial for BibTeX to correctly produce more than one initial in the output. Editing the database is the only way to sort this out.