4

I have a bst file that shortens entries with more than 5 authors to et al. but I would like to modify it to do so for more than 4 authors. I believe this is the relevant code snippet but how can I change it to get the modified behavior?
This question is similar to Changing BibTeX "format.names" function in .bst file to force "et al." citations for entries with more than 3 authors but since this bst file already successfully performs a similar function, perhaps the probability of this question getting an answer will be higher.

This syntax really is a BeaST... If someone could even just explain to me what is going on here I'd greatly appreciate it.

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

Source: http://mirror.unl.edu/ctan/macros/latex/contrib/nature/naturemag.bst

1 Answers1

0

For reasons that are entirely unclear to me changing #5 to #3 works. It seems that #5 and #4 have the same behavior... I would gladly accept an answer that explains what is going on here.

FUNCTION {format.names}
{ 'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}{, f.}{, jj}"
      format.name$
      bibinfo bibinfo.check
      't :=
      nameptr #1 >
        {
          nameptr #1
          #1 + =
          numnames #3
          > and
            { "others" 't :=
              #1 'namesleft := }
            'skip$
          if$
          namesleft #1 >
            { ", " * t * }
            {
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal emphasize *
                }
                {
                  "\&"
                  space.word * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}
  • 1
    # is just the prefix for integers in the .bst file syntax. So changing numnames #5 from #5 to #3 really should not give you what you want at all. Would you mind preparing a short MWE? – moewe Jan 02 '14 at 14:59