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

Can pandoc support multiple citations in org-ref style ? #7101

Closed
jiucenglou opened this issue Feb 18, 2021 · 9 comments
Closed

Can pandoc support multiple citations in org-ref style ? #7101

jiucenglou opened this issue Feb 18, 2021 · 9 comments

Comments

@jiucenglou
Copy link

jiucenglou commented Feb 18, 2021

Currently pandoc has basic support for the cite:citeKey. It looks like further improvement on recognition of citations in org-ref style is on hold because the official org-mode syntax is still work in progress. Nevertheless, for a typical manuscript, cite:citeKey is not enough, and continuous multiple citations such as cite:citeKey1,citeKey2 are very common. Can you consider make pandoc support multiple citations cite:citeKey1,citeKey2 in org-ref style ?

sample.bib

mango@localhost:~$ cat sample.bib
@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics"
}

@book{dirac,
    title = {The Principles of Quantum Mechanics},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    keywords = {physics}
}

Single citation in cite:citeKey org-ref style works

mango@localhost:~$ pandoc --bibliography=sample.bib --citeproc -f org -t native -s 
Test cite:einstein.
Pandoc (Meta {unMeta = fromList [("bibliography",MetaString "sample.bib")]})
[Para [Str "Test",Space,Cite [Citation {citationId = "einstein", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "Einstein",Space,Str "(1905)"],Str "."]
,Div ("refs",["references","csl-bib-body","hanging-indent"],[])
 [Div ("ref-einstein",["csl-entry"],[])
  [Para [Str "Einstein,",Space,Str "Albert.",Space,Str "1905.",Space,Span ("",[],[]) [Str "\8220",Span ("",["nocase"],[]) [Str "Zur",Space,Str "Elektrodynamik",Space,Str "bewegter",Space,Str "K",Span ("",["nocase"],[]) [Str "\246"],Str "rper"],Str ".",Space,Str "(",Span ("",[],[]) [Str "German"],Str ")",Space,Str "[",Span ("",[],[]) [Str "On"],Space,Str "the",Space,Str "Electrodynamics",Space,Str "of",Space,Str "Moving",Space,Str "Bodies]",Str ".",Str "\8221"],Space,Emph [Str "Annalen",Space,Str "Der",Space,Str "Physik"],Space,Str "322",Space,Str "(10):",Space,Str "891\8211\&921.",Space,Str "https://doi.org/",Link ("",[],[]) [Str "http://dx.doi.org/10.1002/andp.19053221004"] ("http://dx.doi.org/10.1002/andp.19053221004",""),Str "."]]]]

As shown below, multiple citations in cite:citeKey1,citeKey2 org-ref style do not work

mango@localhost:~$ pandoc --bibliography=sample.bib --citeproc -f org -t native -s
Test cite:einstein,dirac.
[WARNING] Citeproc: citation einstein,dirac not found
Pandoc (Meta {unMeta = fromList [("bibliography",MetaString "sample.bib")]})
[Para [Str "Test",Space,Cite [Citation {citationId = "einstein,dirac", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "(",Strong [Str "einstein,dirac?"],Str ")"],Str "."]]

pandoc is latest 2.11.4

mango@localhost:~$ pandoc --version
pandoc 2.11.4
Compiled with pandoc-types 1.22, texmath 0.12.1, skylighting 0.10.2,
citeproc 0.3.0.5, ipynb 0.1.0.1
User data directory: /home/mango/.local/share/pandoc or /home/mango/.pandoc
Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
@tarleb
Copy link
Collaborator

tarleb commented Feb 18, 2021

Thank you for raising this issue. It would be important for us to know whether the proposed syntax is supported by org-ref. I don't want to add more custom extensions to org-mode syntax, but I'd happily improve support for org-ref citations.test.

The section on citation handling in pandoc's org docs might also be of use.

@jiucenglou
Copy link
Author

jiucenglou commented Feb 18, 2021

Thank you for raising this issue. It would be important for us to know whether the proposed syntax is supported by org-ref. I don't want to add more custom extensions to org-mode syntax, but I'd happily improve support for org-ref citations.test.

The section on citation handling in pandoc's org docs might also be of use.

I am not sure if I made myself clear :D Please allow me to restate my question.
It looks like you have implemented cite:citeKey in pandoc, which is quite useful for a single citation. Would it be possible for you to implement cite:citeKey1,citeKey2, which should also be quite useful since multiple citations are common in writing manuscripts ? Thank you for your efforts !

@tarleb
Copy link
Collaborator

tarleb commented Feb 18, 2021

Right, I understand that. My question was whether org-ref supports that as well, because our answer depends on that fact.

@jiucenglou
Copy link
Author

jiucenglou commented Feb 18, 2021

whether org-ref supports that as well, because our answer depends on that fact.

As shown in John Kitchin's introduction to org-ref, cite:citeKey1,citeKey2 is the way to cite multiple bib entries.

The file (manuscript.org) can be downloaded in his corresponding blog, which shows the syntax mentioned above.

@tarleb
Copy link
Collaborator

tarleb commented Feb 18, 2021

Good, then it does makes sense to add support for this.

@tarleb
Copy link
Collaborator

tarleb commented Feb 18, 2021

After reading the code, I realized that this should already have been supported. So this is due to a bug.

@tarleb tarleb closed this as completed in 743f721 Feb 18, 2021
@tarleb
Copy link
Collaborator

tarleb commented Feb 18, 2021

Thanks for the report!

@jiucenglou
Copy link
Author

@tarleb Could you suggest how to use this fix ? It looks like that even the relatively newer pandoc/core docker image does not contain the fix. :D Can one download binaries from your "daily test" platform ? Does one have to build from source ?

@tarleb
Copy link
Collaborator

tarleb commented Mar 8, 2021

You could download and install the latest nightly build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants