1

I am using the ecology bibliography style with a .bib file created in zotero.

How can I set the limit for the number of authors to be shown in an authoryear-style citation call-out? I.e., if there are up to 3 authors, then the reference should be (A, B and C, 2015) and not (A et al. 2015 ); if there are more than 3 authors, the citation call-out should be (D et al. 2010) and not (D,E,F,G,H,I and J, 2015).

  • 1
    Welcome to TeX.SE. Is the bibliography style file ecology.bst available online? If so, where? – Mico Oct 5 '17 at 14:27
1

Assuming you obtained the file ecology.bst from a site such as https://schneider.ncifcrf.gov/ftp/ecology.bst, I suggest you proceed as follows:

  • Make a copy of the file ecology.bst and call the copy, say, ecology3.bst.

  • Open the file ecology3.bst in a text editor. (The editor you use to edit tex files will do fine.)

  • Locate the function format.lab.names. In my copy of the file, this function starts at line 1185.

  • Delete the entire function (ca 23 lines), and insert the following code instead:

    FUNCTION {format.lab.names}
    {'s :=
     "" 't :=
      #1 'nameptr :=
      s num.names$ 'numnames :=
      numnames 'namesleft :=
        { namesleft #0 > }
        { s nameptr
          "{vv~}{ll}" format.name$
          't :=
          nameptr #1 >
            {
              nameptr #2 =
              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 *
                    }
                    {
                      bbl.and
                      space.word * t *
                    }
                  if$
                }
              if$
            }
            't
          if$
          nameptr #1 + 'nameptr :=
          namesleft #1 - 'namesleft :=
        }
      while$
    }
    
  • Save the file ecology3.bst, either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the latter option, be sure to update the filename database of your TeX distribution suitably.

  • In your main tex file, change the instruction \bibliographystyle{ecology} to \bibliographystyle{ecology3} and perform a full recompilation (LaTeX, BibTeX, LaTeX, LaTeX) to fully propagate all changes.

Happy BibTeXing!


A full MWE:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{sample.bib}
@misc{ab,author="Anne Author and Brenda Buthor", year=3001}
@misc{abc,author="Anne Author and Brenda Buthor and Carla Cuthor", year=3002}
@misc{defg,author="Doris Duthor and Eudora Euthor and Francine Futhor and Greta Guthor", year=3003}
\end{filecontents}

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{ecology3}

\begin{document}
\citet{ab}

\citet{abc}

\citet{defg}
\bibliography{sample}
\end{document}
  • Aside: This answer is similar, but not identical, to the one given earlier on how to modify jf.bst, to perform truncation to "et al" only if there are four or more authors. The reason it's not a pure duplicate is because (a) the new answer omits the Oxford comma (as required by the OP) and (b) it makes direct use of the fact that the file ecology.bst was created with the help of the makebst utility, considerably simplifying the structure of the drop-in replacement code provided above. – Mico Oct 5 '17 at 15:23
  • @james - If this answer has fully solved the issue you were facing, please consider "accepting" my answer, by clicking on the checkmark symbol next to the answer. Thanks in advance. – Mico Oct 7 '17 at 1:33

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.