12

I am using natbib to manage my references, now I have a problem: my reference list always displays all author names of an article:

Marcel H. Schulz, Daniel R. Zerbino, Martin Vingron, and Ewan Birney. Oases: robust
de novo RNA-seq assembly across the dynamic range of expression levels. Bioinformatics
(Oxford, England), 28(8):1086–1092, April 2012. 7, 9, 10, 40

I set the options to be:

\usepackage[round, sort, numbers]{natbib}

\bibliographystyle{Latex/Classes/PhDbiblio-url2} 
\renewcommand{\bibname}{References} 
\bibliography{9_backmatter/references} 

And use cite{} to cite the references. I tried to used biblatex, but seems it is not compatible with natbib:

\usepackage[maxnames=3]{biblatex}

I want to display at most 3 authors in full name, otherwise display as et al. How to set it?

================

Edit: The file PhDbiblio-url2.bst can be found here: https://bitbucket.org/dekz/thesis/src/3f8d8507cddc/Latex/Classes/PhDbiblio-url2.bst

It seems like the lines here define the display of authors:

INTEGERS { nameptr namesleft numnames }

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

But how to set the numnames from the tex file?

5
  • 2
    How many authors are included in a citation and/or in an entry in the references section before the list is truncated to firstauthor et al is determined not by natbib but by the bibliography style file you load. Please provide a link to the file PhDbiblio-url2.bst; it doesn't seem to be available on the CTAN.
    – Mico
    Aug 11, 2013 at 14:02
  • @Mico. Thanks. The file is this: bitbucket.org/dekz/thesis/src/3f8d8507cddc/Latex/Classes/…
    – Joy
    Aug 11, 2013 at 16:00
  • One more question: How would you like to truncate the list of authors if there are more than three of them: Do you want to show just the first author followed by "et al", do you want to show the first three authors followed by "et al", or some other method?
    – Mico
    Aug 11, 2013 at 20:41
  • @Mico. Yes, I would like to get something like Marcel H. Schulz, et al. Oases: robust de novo RNA-seq assembly across the dynamic range of expression levels....
    – Joy
    Aug 12, 2013 at 7:34
  • If anyone else would like to use this .bst, you shall need to include hyperref to get things to work properly.
    – CPLB
    Aug 17, 2013 at 10:00

2 Answers 2

22
+50

I believe that you need to set the number of authors before et al. in the .bst itself, rather than from the LaTeX.

I think the below does what you want, I have adapted it from a .bst I created using makebst. Just replace format.names in your .bst.

FUNCTION {format.names}
{ 's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}{, jj}{, f{.}.}"
      format.name$
      '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" =
                {
                  " et~al" *
                }
                {
                  " and "
                  * t *
                }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

If you want to change the number of authors before the et al. is used, change #3 from three to the correct number. If you want to change the number of names that appear before et al. in the list, then change the #1 following nameptr on the line preceding #1 + = from one to the correct number.

2
  • 1
    Nice! You may want to state explicitly, even though it's probably obvious to the initiated, that one should replace the existing format.names function in the .bst file with the version you're providing.
    – Mico
    Aug 17, 2013 at 8:29
  • 1
    In case anybody else needs to see this, you should make a copy of your existing .bst file (let's say it's called bibstyle.bst, so the copy is bibstyle_copy.bst), place it in your working directory, and make the edit suggested above. Then call it via \bibliographystyle{bibstyle_copy}. Sep 6, 2022 at 21:59
4

OK. I solved it in a stupid way. In the bib file, for articles with more than 3 authors, remove other authors from the list and put others instead. Then the Reference shows at most 3 authors and et~al. But anyway, it is a bit tedious.

1
  • 6
    This is not a solution, I would not recommend this.... Oct 31, 2018 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .