3

I want to sort chronologically a list of references using the apalike.bst style, since this order seems more natural for showing in a CV. I tried to follow the approach outlined in https://tex.stackexchange.com/a/33332/56546 but without success (I really do not understand too much about .bst syntax). Any help on how to conveniently hack apalike.bst to do the job?

PS. I know that I can perform this switching to the biblatex package, but for the moment I would like to solve the problem without it, since I am using multibib.

EDIT: The kind of sorting I am looking for is: 1) by year of publication; 2) by alphabetical order of the author's surnames. I do not care about sorting by month after year in 1), but it is OK.

  • By chronological ordering, do you mean sorting the bibliographic items by year and month, or sorting the way the items are cited in the body of the document? – Mico Aug 27 '14 at 11:16
  • @Mico I mean sorting by year (I do not care about month, but it is OK). I edit the question to incorporate this clarification. – epsilone Aug 27 '14 at 11:18
3

I modified the apalike.bst entry for bib.sort.order and merely swapped sort.label (which had been first) with year field.or.null sortify, to read as

FUNCTION {bib.sort.order}
{ year field.or.null sortify
  "    "
  *
  sort.label
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

Thus, with the following MWE,

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{junk.bib}
@ARTICLE{bake67,
        TITLE   = "Prediction and scaling of reflected impulse from
                        strong blast waves",
        AUTHOR  = "Baker, W. E.",
        JOURNAL = "International Journal of Mechanical Sciences",
        VOLUME  = "9",
        NUMBER  = "1",
        PAGES   = "45--51",
        YEAR    = "1967"                        }
@ARTICLE{Acme72,
        TITLE   = "Prediction and scaling of reflected impulse from
                        strong blast waves",
        AUTHOR  = "Acme, W. E.",
        JOURNAL = "International Journal of Mechanical Sciences",
        VOLUME  = "9",
        NUMBER  = "1",
        PAGES   = "45--51",
        YEAR    = "1972"                        }
@ARTICLE{cake71,
        TITLE   = "Prediction and scaling of reflected impulse from
                        strong blast waves",
        AUTHOR  = "Cake, W. E.",
        JOURNAL = "International Journal of Mechanical Sciences",
        VOLUME  = "9",
        NUMBER  = "1",
        PAGES   = "45--51",
        YEAR    = "1971"                        }
@ARTICLE{Delta71,
        TITLE   = "Prediction and scaling of reflected impulse from
                        strong blast waves",
        AUTHOR  = "Delta, W. E.",
        JOURNAL = "International Journal of Mechanical Sciences",
        VOLUME  = "9",
        NUMBER  = "1",
        PAGES   = "45--51",
        YEAR    = "1971"                        }
\end{filecontents}
\begin{document}
cite \cite{bake67, Acme72, cake71, Delta71}
\bibliographystyle{apalike}
\bibliography{junk}
\end{document}

I get the following result, sorted by year and, within a year, by surname:

enter image description here

If you wish the reverse order (chronologically descending), then the line near the end of the apalike.bst file that reads

ITERATE {call.type$}

must be changed to

REVERSE {call.type$}

Of course, this means that, within a given year, surnames will likewise be sorted in reverse order, too (alphabetically backwards).


When using the original definition, which was

%                               Now that the label is right we sort for real,
%                               on sort.label then year then title.  This is
%                               for the second sorting pass.
FUNCTION {bib.sort.order}
{ sort.label
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

the result is sorted by surname as

enter image description here

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.