Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Citation sorting with additional citation text #292

Closed
garrettdashnelson opened this issue Jun 6, 2017 · 5 comments
Closed

Citation sorting with additional citation text #292

garrettdashnelson opened this issue Jun 6, 2017 · 5 comments

Comments

@garrettdashnelson
Copy link

This is something of an extension of #101.

When a CSL has a <sort> field set for the ordering of parenthetical citations, such as alphabetically by author, additional commentary in a parenthetical citation is disrupted.

For instance, the following:

A fascinating research tidbit [@Zanadu1999, p. 35; see for comparison @Aalto2005] ...

when rendered with an alphabetical-order citer (e.g., SAGE-Harvard) will produce

A fascinating research tidbit (see for comparison Aalto, 2005; Zanadu, 1999: 35)

Ideally the filter would divide citations up into sub-blocks at each point that it finds text which is not a citation reference, and order each sub-block according to the CSL's configuration. Thus, if we had a complex citation like:

Disagreements abound [@Xylax2016; see also @Yi2014; @Ang2017; for a contrary view, see @Mutt2012]

We would divide the citation up into three sub-blocks, alphabetically order each, and produce:

Disagreements abound (Xylax, 2016; see also Ang 2017; Yi 2014; for a contrary view, see Mutt, 2012)

@jgm
Copy link
Owner

jgm commented Jan 3, 2018

This seems quite sensible. I'm wondering how citeproc-js behaves.

@jgm
Copy link
Owner

jgm commented Jan 19, 2018

Test case

---
references:
- id: doe
  type: article
  author:
      family: Doe
  issued:
      year: 2007
- id: zoe
  type: article
  author:
      family: Zoe
  issued:
     - year: 2009
- id: roe
  type: article
  author:
      family: Roe
  issued:
     - year: 2007
csl: ../styles/sage-harvard.csl
...

[@zoe; @roe; see for comparison @doe, p. 3]

@jgm jgm closed this as completed in 31b463a Jan 19, 2018
@jgm
Copy link
Owner

jgm commented Jan 19, 2018

I've implemented this suggestion. I still don't know how citeproc-js behaves.

@njbart any comments?

@njbart
Copy link
Contributor

njbart commented Jan 19, 2018

In Zotero, if the selected CSL style file supports sorting of in-text citations (e.g., sage-harvard.csl), a checkbox “Keep Sources Sorted” becomes available in the “Add/edit sources” -> “Multiple sources” window, which, if unchecked, permits manual sorting of the individual references – but there seems to be no mechanism like the one that has just been implemented here automatically modifying the sorting of citations based on the occurrence of prefixes. (If the CSL style file does not support sorting of in-text citations (e.g., chicago-author-date.csl), the checkbox “Keep Sources Sorted” is not available.)

Currently I don’t see any reasons why the new pandoc-citeproc behaviour should be problematic. If anything crops up, I’m sure it could be made optional, e.g., via a command line switch …

@garrettdashnelson
Copy link
Author

In a few tests, the implementation seems to work perfectly.

jgm added a commit that referenced this issue Feb 1, 2018
This commit also includes the test for #292, which
wasn't added before.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants