I'm using natbib package and plainnat style for my citations and references. Unfortunately, when I cite different papers of the same author, but different co-authors, the bibligraphy is sorted by the key.

For example:

enter image description here

The key for Ho, Meyn is Ho2006, for Ho, Lambling is Ho2011, and for Ho, Dreyfus is Ho2012. Certainly LaTeX is considering the keys before the second author last name.

How can I solve it???

  • 1
    The sorting appears to be by first author and year.
    – egreg
    Jul 1, 2017 at 17:17
  • @egreg How can I sort by firs author and then second author, etc Jul 1, 2017 at 20:38
  • i've never used it myself, but custom-bib, or the makebst facility, may be able to help you adjust the options you need. Jul 3, 2017 at 21:07
  • Please help us help you and add a minimal working example with bibliography (MWEB) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Sep 26, 2017 at 16:43

1 Answer 1


As mentioned in the comments above on your original post, the MWE is necessary for others to figure out what you're trying to achieve and how you're trying to achieve it. Without that, I cannot be sure that I'm answering your question, but I'll still provide some information here that you may find helpful.

The entries in your screenshot appear be of the article type. If this is true, then natbib with plainnat will sort these articles as follows. Note: I am using the 2007 version of plainnat.bst, which is the latest as of this posting in 2022.

  1. The presort function (starting at line #1313) applies the author.sort rule (in line #1326).

  2. The author.sort function (starting at line #1248) first tests whether the author field is empty. Since yours are not, the function passes your author field to the sort.format.names function.

  3. I pasted a copy of the sort.format.names function (starting at line #1207) below to assist in this explanation. From your example above, it looks like your entries have 6, 4, or 7 authors, respectively, looking at semicolons as delimiters and a period to end the author block. The code here looks to be working as you have shown in your screenshot, sorting by the first author, then the year for each of your entries. You will notice the function referring to the year field, which comes into play:

    a. After sorting by the first author AND

    b. There are more authors to go other than "others" AND

    c. There are more than two authors total AND

    d. The function is on the second author (second time through the while loop)

    e. THEN, sort by the year.

Note that the language in the BST file implements a postfix notation.

FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr #1 >
          "   "  *
          namesleft #1 = t "others" = and
            { "zzzzz" * }
            { numnames #2 > nameptr #2 = and
                { "zz" * year field.or.null * "   " * }
              t sortify *
        { t sortify * }
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=

Notwithstanding, there's an answer to a TeX Stack Exchange post here describing how to customize the plainnat.bst file to address author-less sorting.

You must log in to answer this question.

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