zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)
MIT License
62 stars 7 forks source link

Sorting the citations #45

Closed hvoss49 closed 9 months ago

hvoss49 commented 9 months ago

Describe the bug With two citations of the same year by the same author we get for example <author>1988a, 1988b when using biblatex and an authoryear style. With citation-style-language we get it the other way round (see screenshot)

Additional information

To Reproduce

\documentclass[]{article}
\usepackage{citation-style-language} 
\cslsetup{style=turabian-author-date} 
%\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}

\cite{nietzsche:ksa,nietzsche:ksa1} 
\printbibliography

\end{document}

Screenshots

Bildschirmfoto 2023-10-03 um 21 40 21
zepinglee commented 9 months ago

The turabian-author-date.csl doesn't have a <sort> element in <citation> and thus the cites appear in the order that they are cited.

https://github.com/citation-style-language/styles/blob/cb7b29955429a5a62bfdf82f5d16932ee41f7314/turabian-author-date.csl#L605-L606

I don't have access to the Turabian style but the Chicago Manual of Style 17th ed. says (in § 15.30):

Two or more references in a single parenthetical citation are separated by semicolons. The order in which they are given may depend on what is being cited, and in what order, or it may reflect the relative importance of the items cited. If neither criterion applies, alphabetical or chronological order may be appropriate. Unless the order is prescribed by a particular journal style, the decision is the author’s.

(Armstrong and Malacinski 1989; Beigl 1989; Pickett and White 1985)

hvoss49 commented 9 months ago

Ah, I See. The style elsevier-harvard.csl does it. But I am not familiar with XML so I can't use the code snippet for turabian.

zepinglee commented 9 months ago

Ah, I See. The style elsevier-harvard.csl does it. But I am not familiar with XML so I can't use the code snippet for turabian.

This is my edit: https://github.com/zepinglee/csl-styles/commit/bdbed1b3c53b6ce119044fdee80dceea309b2d7c.

hvoss49 commented 8 months ago

I am sorry, I can't get right. It is still "(Nietzsche 1988b, 1988a). Here are my files: https://hvoss.org/turabian.zip

zepinglee commented 8 months ago

I am sorry, I can't get right. It is still "(Nietzsche 1988b, 1988a). Here are my files: https://hvoss.org/turabian.zip

Ah, my mistake. It turns out this is not easy to implement in CSL. I'll discuss with the CSL folks.

zepinglee commented 8 months ago

I post the issue at https://discourse.citationstyles.org/t/sorting-citation-items-by-year-suffix/1830.

zepinglee commented 8 months ago

Thanks to Sebastian Karcher's suggestion of adding citation sort <key>s identical to the ones in <bibliography>. Now the style works as expected (https://gist.github.com/zepinglee/8a8355e465e4424cf7bd4a105da919a6).

Screenshot 2023-10-10 at 22 14 57
hvoss49 commented 8 months ago

thanks, it is fine now!