Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline citation ordering not as expected #206

Open
slochower opened this Issue Apr 17, 2019 · 8 comments

Comments

Projects
None yet
3 participants
@slochower
Copy link
Collaborator

slochower commented Apr 17, 2019

<sort>
<key variable="citation-number"/>
</sort>

My understanding is these lines should sort inline citations like [8, 9, 10, 11] but I have a manuscript where the citations appear [10, 11, 8, 9] (https://slochower.github.io/smirnoff-host-guest-manuscript/v/a2fec1ee6bf387a1e664186f8ddd2c15facadcf7/). I'm not sure why this is the case.

I attempted to confirm the proper behavior in the Visual CSL Editor, but note: uploading the bundled build/assets/style.csl to the Visual CSL Editor for experimentation results in "Citeproc exception: TypeError: blob.strings is undefined". I haven't investigated the meaning of that error.

Also, this URL does not resolve:

<link href="http://www.zotero.org/styles/manubot" rel="self"/>

@dhimmel

This comment has been minimized.

Copy link
Member

dhimmel commented Apr 17, 2019

My understanding is these lines should sort inline citations like [8, 9, 10, 11] but I have a manuscript where the citations appear [10, 11, 8, 9]

I wonder if this behavior is related to http://docs.citationstyles.org/en/stable/specification.html#sorting

cs:citation and cs:bibliography may include a cs:sort child element before the cs:layout element to specify the sorting order of respectively cites within citations, and bibliographic entries within the bibliography. In the absence of cs:sort, cites and bibliographic entries appear in the order in which they are cited.

If we do find a way to get citations to sort within a series of citations, would we want this as the default behavior? Or is it useful that citations remain in the order of the raw markdown?

@slochower I am not sure why the order in your manuscript is not [9, 10, 8, 11], because 8 is the only work that has been cited prior in the text.

@slochower

This comment has been minimized.

Copy link
Collaborator Author

slochower commented Apr 17, 2019

I wonder if this behavior is related to http://docs.citationstyles.org/en/stable/specification.html#sorting

But we do have <sort> before <layout>.

@slochower I am not sure why the order in your manuscript is not [9, 10, 8, 11], because 8 is the only work that has been cited prior in the text.

Why wouldn't you expected 8 to be the first (followed by 9, 10, and then 11)? Maybe I'm misunderstanding the sorting.

@dhimmel

This comment has been minimized.

Copy link
Member

dhimmel commented Apr 17, 2019

The input is:

A complete description of the APR method has been characterized in the literature [@doi:10.1021/acs.jctc.5b00405; @doi:10.1002/jcc.23398; @doi:10.1007/s10822-014-9735-1; @doi:10.1021/ct5004109].

The output is:

A complete description of the APR method has been characterized in the literature [10,11,8,9].

However, this output corresponds to:

@doi:10.1007/s10822-014-9735-1; @10.1021/ct5004109; @doi:10.1021/acs.jctc.5b00405; @doi:10.1002/jcc.23398

So the input order is not preserved as I had assumed. Instead what I think is happening is that the rendered citations are being sorted as strings rather than numbers!

@adam3smith sorry to bug you, but any idea how we get our citation-numbers to sort as numbers rather than strings?

@slochower

This comment has been minimized.

Copy link
Collaborator Author

slochower commented Apr 17, 2019

Instead what I think is happening is that the rendered citations are being sorted as strings rather than numbers!

Ah, good insight!

Wonder if it could be related to something with pandoc-citeproc not recognizing the strings as numeric: jgm/pandoc-citeproc#208

@adam3smith

This comment has been minimized.

Copy link

adam3smith commented Apr 18, 2019

Yes, this appears to be the result of poorly written specifications and pandoc-citeproc reading them overly literally: citation-number is, for reasons I'm uncertain about, not listed as a number variable and should, as per the specs, therefore be parsed as a string during sort. That's obviously nonsense, though, and citeproc-js (and I assume most/all other processors) treat it as an integer when sorting. I'd appeal to John to change pandoc-citeproc's behavior, even though very technically it is correct.

cc @rmzelle who may know more on why this wasn't included as a number.

(to be clear -- I verified this issue with a local copy of pandoc)

@slochower

This comment has been minimized.

Copy link
Collaborator Author

slochower commented Apr 18, 2019

Looping in @jgm. Is it intentional that pandoc-citeproc treats citation-number as a string and not an integer, and therefore sorts citation-number alphabetically?

@dhimmel

This comment has been minimized.

Copy link
Member

dhimmel commented Apr 18, 2019

citation-number is, for reasons I'm uncertain about, not listed as a number variable and should, as per the specs, therefore be parsed as a string during sort.

@adam3smith are you referencing these lines in the csl-data.json schema?

@adam3smith

This comment has been minimized.

Copy link

adam3smith commented Apr 18, 2019

I was looking at the corresponding section in the specifications but that's just a different way of looking at the same thing, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.