Martin Klimeš 88831e7ac3 | 4 years ago | |
---|---|---|
.. | ||
csl | 4 years ago | |
readme-author-year.org | 4 years ago | |
readme-unsrt.org | 4 years ago | |
readme.bib | 4 years ago | |
readme.org | 4 years ago |
http://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Facs-nano
http://docs.citationstyles.org/en/stable/primer.html#preface
CLOSED: [2015-12-11 Fri 18:05]
As a potential solution for citations in org-mode for non-LaTeX export, here we introduce csl (citation syntax lisp). The idea is heavily influenced by the xml-based Citation Syntax Language, but uses lisp sexps instead.
Briefly, there is a csl file that contains two variables: citation-style and bibliography-style. The citation-style defines how the in-text citations are represented for different types of citations. The bibliography-style defines how the bibliography is constructed.
What do we gain by this?
No need for external citeproc program, and hackability by org-mode experts.
Punctuation transposition and space chomping, i.e. put superscripts on the right side of punctuation if you want it, and remove whitespace before superscripts if you want it.
Total tunability of the citation format to different backends.
Easy to change bibliography format with the bibliographystyle link.
The use of Bibtex databases. These are plain text, and flexible.
The real code for this is too long to blog about. Instead, you should check it out here: https://github.com/jkitchin/org-ref/tree/master/citeproc
A book cite:kittel-2005-introd-solid.
An article cite:kitchin-2015-examp
A miscellaneous bibtex type cite:xu-suppor.
A technical report cite:2011-mater-genom
An MS thesis: cite:ding-2012-metal-oxide
A PhD thesis: cite:Hossein-thesis
in proceedings: cite:abolhasani-2011-model
There is work to do in supporting other types of entry types that are common in bibtex files.
Regular citation: cite:kitchin-2015-examp
citenum: See Ref. citenum:kitchin-2015-examp
citeauthor: citeauthor:kitchin-2015-examp
citeyear: citeyear:kitchin-2015-examp
There is work to do in supporting other types of citations.
You can specify that the cites within a citation are consistently sorted in the export.
a,b: cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien
b,a: cite:kitchin-2015-data-surfac-scien,kitchin-2015-examp
There is work to do for range collapsing, e.g. to turn 1,2,3 into 1-3.
I think citations should always be put in the sentence they logically belong to. LaTeX has a feature through natbib I think where for some styles, e.g. superscripts, the citations are moved to the right side of punctuation, and whitespace is chomped so the superscript is next to words, not separated by spaces. We can do that here too.
Citation at end of sentence cite:kitchin-2015-examp.
Citation in clause cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien, with a comma.
Citation in middle of cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien a sentence.
At the moment, you have to add a hook function to put the replacements in the document before parsing.
(add-to-list 'load-path ".") (require 'org-ref-citeproc) (when (file-exists-p "readme.html") (delete-file "readme.html")) (let ((org-export-before-parsing-hook '(orcp-citeproc))) (browse-url (org-html-export-to-html)))
#<process open ./readme.html>
An org export for footnotes. The footnotes don't go where I expect.
(add-to-list 'load-path ".") (require 'org-ref-citeproc) (let ((org-export-before-parsing-hook '(orcp-citeproc))) (org-open-file (org-org-export-to-org)))
Position saved to mark ring, go back with C-c &.
This looks promising. There is probably a lot of work to do to make this as robust as say citeproc-js or the Zotero handler. I am not sure if we could write this in a way to directly use the CSL. My feeling is it would not be as flexible as this, and we would have to add to it anyway.
Here are some remaining things that could be worked on if we continue this direction.
Other bibtex entries need to be tested out.
Remaining bibtex fields need to be defined.
Standardization of styling that can be done. Not all features described in my csl are supported, e.g. et. al. and probably others.
The author-year style needs name disambiguation somehow.
Hyperlinking in org, html.
Make sure export to other backends works. Can this make a LaTeX output with bibitems?
Can this work for notes-based styles?
You use a bibliographystyle link to specify a csl. These are similar to bibtex styles, and in some cases no change is needed for LaTeX export (although you may have to remove the citeproc hook function).
bibliographystyle:unsrt-footnote bibliography:readme.bib
These are sections I worked on developing the working approach.
Partially derived from http://nwalsh.com/tex/texhelp/bibtx-23.html
see also http://ctan.mirrors.hoobly.com/biblio/bibtex/base/btxdoc.pdf
Bibtex names have 4 parts:
First name, which also includes middle name/initial
von which is part of the last name, but in lower case letters
Last name
Jr.
Here are some acceptable formats for names in Bibtex.
"First von Last" "von Last, First" "von Last, Jr, First"
Note, it is also possible to have in Bibtex, in which case the von part becomes part of the last name.
"Jan A. {van Mieghem}" "{van Mieghem}, Jan A."
And also
De Gaulle, Charles Van Buren, Martin Scott Thomas, Kristin Bonham Carter, Helena Garcia Pascual, Antonio Del Negro, Marco Van Gogh, Vincent Della Francesca, Piero Charles {De Gaulle} Martin {Van Buren} Kristin {Scott Thomas} Helena {Bonham Carter} Antonio {Garcia Pascual} Marco {Del Negro} Vincent {Van Gogh} Piero {Della Francesca}
Dealing with these brackets is somewhat tricky. We cannot simply split on spaces with these present. A hack I will use is to replace them temporarily with something that looks like a name part, parse, and then put them back. Otherwise, we need a real recursive descent parser. I will use a uuid that starts with a capital letter. We develop an elisp function to parse these into a data structure: (first von last jr).
citeproc-parse-authorname
Here are examples of case 1.
(cl-loop for author in '("John R. Kitchin" "John von Kitchin" "John von de La von Kitchin" "John von de Kitchin Jr." "John {von de Kitchin}" "John Paul Jones" "Charles Louis Xavier Joseph de la Vallee Poussin" "Ludwig von Beethoven" "Jan A. {van Mieghem}" "Vincent {Van Gogh}" "Piero {Della Francesca}" "{Barnes and Noble}" "{Barnes & Noble}") collect (citeproc-parse-authorname author))
John R. | nil | Kitchin | nil |
John | von | Kitchin | nil |
John | von de La von | Kitchin | nil |
John | von de | Kitchin Jr. | nil |
John | nil | {von de Kitchin} | nil |
John Paul | nil | Jones | nil |
Charles Louis Xavier Joseph | de la | Vallee Poussin | nil |
Ludwig | von | Beethoven | nil |
Jan A. | nil | {van Mieghem} | nil |
Vincent | nil | {Van Gogh} | nil |
Piero | nil | {Della Francesca} | nil |
nil | {Barnes and Noble} | nil | |
nil | {Barnes & Noble} | nil |
Case 2.
(cl-loop for author in '("von Beethoven, Ludwig" "{van {M}ieghem}, Jan A." "De Gaulle, Charles" "Van Buren, Martin" "Scott Thomas, Kristin" "Bonham Carter, Helena" "Garcia Pascual, Antonio" "Del Negro, Marco" "Van Gogh, Vincent" "Della Francesca, Piero") collect (citeproc-parse-authorname author))
Ludwig | von | Beethoven | nil |
Jan A. | nil | {van {M}ieghem} | nil |
Charles | nil | De Gaulle | nil |
Martin | nil | Van Buren | nil |
Kristin | nil | Scott Thomas | nil |
Helena | nil | Bonham Carter | nil |
Antonio | nil | Garcia Pascual | nil |
Marco | nil | Del Negro | nil |
Vincent | nil | Van Gogh | nil |
Piero | nil | Della Francesca | nil |
And case 3
(cl-loop for author in '("von de la Kitchin, Sr., John Robert" "von Kitchin, Sr., John Robert") collect (citeproc-parse-authorname author))
John Robert | von de la | Kitchin | Sr. |
John Robert | von | Kitchin | Sr. |
I am pretty satisfied with that. This is a foundation for formatting author names in a bibliography. Note the bibtex function `bibtex-autokey-demangle-name' function has some similar code for getting a last name to use as the key.
From http://maverick.inria.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#names
(cl-loop for author in '("Aa Bb" "Aa" "Aa bb" "aa" "Aa bb Cc" "Aa bb Cc dd Ee" "Aa 1B cc dd" "Aa 1b cc dd" "Aa {b}B cc dd" "Aa {b}b cc dd" "Aa {B}b cc dd" "Aa {B}B cc dd" "Aa \\Bb{b} cc dd" "Aa \\bb{b} cc dd" "{Lastname with {,} in it}, Formerly Known as" "Aa {bb} cc Dd" "Aa bb {cc} Dd" "Aa {bb} Cc") collect (citeproc-parse-authorname author))
Aa | nil | Bb | nil |
nil | nil | Aa | nil |
Aa | nil | bb | nil |
nil | nil | aa | nil |
Aa | bb | Cc | nil |
Aa | bb Cc dd | Ee | nil |
Aa | 1B cc | dd | nil |
Aa | 1b cc | dd | nil |
Aa | {b}B cc | dd | nil |
Aa {b}b | cc | dd | nil |
Aa {B}b | cc | dd | nil |
Aa | {B}B cc | dd | nil |
Aa | \Bb{b} cc | dd | nil |
Aa | \bb{b} cc | dd | nil |
Formerly Known as | nil | {Lastname with {,} in it} | nil |
Aa {bb} | cc | Dd | nil |
Aa | bb | {cc} Dd | nil |
Aa {bb} | nil | Cc | nil |
I think this does about what it is supposed to do. Another function would be responsible for formatting the author name as required, e.g. putting initials in, the order of the names, etc…
Another function after that would be responsible for formatting a group of authors, e.g. specifying the delimiter between them, the trailing character after the authors, if et al should be used after some number of authors, etc…
Finally, I don't consider any transformations of the author strings, e.g. if there are LaTeX commands or other markup in them. This gets passed verbatim to what ever is next.
Make (1 2 3 4 7 9) be "1-4,7,9"
(defun collapse-range (cites) "CITES is a list of at least 3 numbers." (let (n (groups '())) (while cites (setq n (pop cites)) (if (and (caar groups) (= (- n 1) (elt (car groups) 0))) (setf (car groups) (append `(,n) (car groups))) (setf groups (append `((,n)) groups)))) ;; Now for each group (mapconcat 'identity (mapcar (lambda (lst) (cond ((>= (length lst) 3) (format "%s-%s" (car lst) (car (last lst)))) ((= (length lst) 2) (format "%s,%s" (nth 0 lst) (nth 1 lst))) (t (number-to-string (car lst))))) (mapcar 'reverse (reverse groups))) ","))) (collapse-range '(1 2))
1,2
This seems to be information about a CSL.
(let (xml) (setq xml (with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))) (xml-get-children xml 'info))
((info nil (title nil "ACS Nano") (title-short nil "ACS Nano") (id nil "http://www.zotero.org/styles/acs-nano") (link ((href . "http://www.zotero.org/styles/acs-nano") (rel . "self"))) (link ((href . "http://www.zotero.org/styles/american-chemical-society-with-titles") (rel . "template"))) (link ((href . "http://pubs.acs.org/paragonplus/submission/ancac3/ancac3_authguide.pdf") (rel . "documentation"))) (category ((citation-format . "numeric"))) (category ((field . "chemistry"))) (issn nil "1936-0851") (eissn nil "1936-086X") (summary nil "ACS style with et al in italics") (updated nil "2014-09-21T00:39:49+00:00") (rights ((license . "http://creativecommons.org/licenses/by-sa/3.0/")) "This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License")))
These seem to define inputs to a function that formats each field of an entry.
(let (xml) (setq xml (with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))) (xml-get-children xml 'macro))
((macro ((name . "editor")) (names ((variable . "editor")) (name ((sort-separator . ", ") (initialize-with . ". ") (name-as-sort-order . "all") (delimiter . "; ") (delimiter-precedes-last . "always"))) (et-al ((font-style . "italic"))) (label ((form . "short") (prefix . ", ") (text-case . "capitalize-first"))))) (macro ((name . "author")) (names ((variable . "author") (suffix . ".")) (name ((sort-separator . ", ") (initialize-with . ". ") (name-as-sort-order . "all") (delimiter . "; ") (delimiter-precedes-last . "always"))) (et-al ((font-style . "italic"))) (label ((form . "short") (prefix . ", ") (text-case . "capitalize-first"))))) (macro ((name . "publisher")) (group ((delimiter . ": ")) (text ((variable . "publisher"))) (text ((variable . "publisher-place"))))) (macro ((name . "title")) (choose nil (if ((type . "bill book graphic legal_case legislation motion_picture report song") (match . "any")) (text ((variable . "title") (text-case . "title") (font-style . "italic")))) (else nil (text ((variable . "title") (text-case . "title")))))) (macro ((name . "volume")) (group ((delimiter . " ")) (text ((term . "volume") (form . "short") (text-case . "capitalize-first"))) (text ((variable . "volume"))))) (macro ((name . "series")) (text ((variable . "collection-title")))) (macro ((name . "pages")) (label ((variable . "page") (form . "short") (suffix . " "))) (text ((variable . "page")))) (macro ((name . "book-container")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((term . "in") (text-case . "capitalize-first"))) (text ((variable . "container-title") (font-style . "italic"))))) (macro ((name . "issued")) (date ((variable . "issued") (delimiter . " ")) (date-part ((name . "year"))))) (macro ((name . "full-issued")) (date ((variable . "issued") (delimiter . " ")) (date-part ((name . "month") (form . "long") (suffix . " "))) (date-part ((name . "day") (suffix . ", "))) (date-part ((name . "year"))))) (macro ((name . "edition")) (choose nil (if ((is-numeric . "edition")) (group ((delimiter . " ")) (number ((variable . "edition") (form . "ordinal"))) (text ((term . "edition") (form . "short"))))) (else nil (text ((variable . "edition") (suffix . ".")))))))
This seems to define the layout of a citation in the text, how they are sorted, collapsed, and delimited.
,#+BEGIN_SRC emacs-lisp :results code (let (xml) (setq xml (with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))) (xml-get-children xml 'citation))
((citation ((collapse . "citation-number")) (sort nil (key ((variable . "citation-number")))) (layout ((delimiter . ",") (vertical-align . "sup")) (text ((variable . "citation-number"))))))
This seems to layout how the bibliography is constructed.
(let (xml) (setq xml (with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))) (xml-get-children xml 'bibliography))
((bibliography ((second-field-align . "flush") (entry-spacing . "0") (et-al-min . "11") (et-al-use-first . "10")) (layout ((suffix . ".")) (text ((variable . "citation-number") (prefix . "(") (suffix . ") "))) (text ((macro . "author") (suffix . " "))) (choose nil (if ((type . "article-magazine")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (suffix . "."))) (text ((macro . "edition"))) (text ((macro . "publisher"))) (text ((macro . "full-issued") (suffix . ","))) (text ((macro . "pages"))))) (else-if ((type . "thesis")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "genre")))) (text ((macro . "publisher"))) (text ((macro . "issued"))) (text ((macro . "volume"))) (text ((macro . "pages"))))) (else-if ((type . "bill book graphic legal_case legislation motion_picture report song") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "title"))) (text ((macro . "editor") (prefix . " "))) (text ((macro . "series"))) (text ((macro . "edition"))) (choose nil (if ((type . "report")) (group ((delimiter . " ")) (text ((variable . "genre"))) (text ((variable . "number")))))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "patent")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "number")))) (date ((variable . "issued") (form . "text"))))) (else-if ((type . "chapter paper-conference") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "book-container"))) (text ((macro . "editor"))) (text ((macro . "series"))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "webpage")) (group ((delimiter . " ")) (text ((variable . "title"))) (text ((variable . "URL"))) (date ((variable . "accessed") (prefix . "(accessed ") (suffix . ")") (delimiter . " ")) (date-part ((name . "month") (form . "short") (strip-periods . "true"))) (date-part ((name . "day") (suffix . ", "))) (date-part ((name . "year")))))) (else-if ((type . "article-journal")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (form . "short"))) (group ((delimiter . ", ")) (text ((macro . "issued") (font-weight . "bold"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page")))))) (else nil (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "container-title") (font-style . "italic")))) (group ((delimiter . ", ")) (text ((macro . "issued"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page"))))))))))
Here we get the layout of an entry.
(let (xml) (setq xml (with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))) (car (xml-get-children (car (xml-get-children xml 'bibliography)) 'layout)))
(layout ((suffix . ".")) (text ((variable . "citation-number") (prefix . "(") (suffix . ") "))) (text ((macro . "author") (suffix . " "))) (choose nil (if ((type . "article-magazine")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (suffix . "."))) (text ((macro . "edition"))) (text ((macro . "publisher"))) (text ((macro . "full-issued") (suffix . ","))) (text ((macro . "pages"))))) (else-if ((type . "thesis")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "genre")))) (text ((macro . "publisher"))) (text ((macro . "issued"))) (text ((macro . "volume"))) (text ((macro . "pages"))))) (else-if ((type . "bill book graphic legal_case legislation motion_picture report song") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "title"))) (text ((macro . "editor") (prefix . " "))) (text ((macro . "series"))) (text ((macro . "edition"))) (choose nil (if ((type . "report")) (group ((delimiter . " ")) (text ((variable . "genre"))) (text ((variable . "number")))))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "patent")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "number")))) (date ((variable . "issued") (form . "text"))))) (else-if ((type . "chapter paper-conference") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "book-container"))) (text ((macro . "editor"))) (text ((macro . "series"))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "webpage")) (group ((delimiter . " ")) (text ((variable . "title"))) (text ((variable . "URL"))) (date ((variable . "accessed") (prefix . "(accessed ") (suffix . ")") (delimiter . " ")) (date-part ((name . "month") (form . "short") (strip-periods . "true"))) (date-part ((name . "day") (suffix . ", "))) (date-part ((name . "year")))))) (else-if ((type . "article-journal")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (form . "short"))) (group ((delimiter . ", ")) (text ((macro . "issued") (font-weight . "bold"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page")))))) (else nil (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "container-title") (font-style . "italic")))) (group ((delimiter . ", ")) (text ((macro . "issued"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page"))))))))
#+END_SRC
(with-temp-buffer (insert-file-contents "acs-nano.csl") (libxml-parse-xml-region (point-min) (point-max)))
(style ((class . "in-text") (version . "1.0") (demote-non-dropping-particle . "sort-only") (page-range-format . "expanded") (default-locale . "en-US")) (info nil (title nil "ACS Nano") (title-short nil "ACS Nano") (id nil "http://www.zotero.org/styles/acs-nano") (link ((href . "http://www.zotero.org/styles/acs-nano") (rel . "self"))) (link ((href . "http://www.zotero.org/styles/american-chemical-society-with-titles") (rel . "template"))) (link ((href . "http://pubs.acs.org/paragonplus/submission/ancac3/ancac3_authguide.pdf") (rel . "documentation"))) (category ((citation-format . "numeric"))) (category ((field . "chemistry"))) (issn nil "1936-0851") (eissn nil "1936-086X") (summary nil "ACS style with et al in italics") (updated nil "2014-09-21T00:39:49+00:00") (rights ((license . "http://creativecommons.org/licenses/by-sa/3.0/")) "This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License")) (macro ((name . "editor")) (names ((variable . "editor")) (name ((sort-separator . ", ") (initialize-with . ". ") (name-as-sort-order . "all") (delimiter . "; ") (delimiter-precedes-last . "always"))) (et-al ((font-style . "italic"))) (label ((form . "short") (prefix . ", ") (text-case . "capitalize-first"))))) (macro ((name . "author")) (names ((variable . "author") (suffix . ".")) (name ((sort-separator . ", ") (initialize-with . ". ") (name-as-sort-order . "all") (delimiter . "; ") (delimiter-precedes-last . "always"))) (et-al ((font-style . "italic"))) (label ((form . "short") (prefix . ", ") (text-case . "capitalize-first"))))) (macro ((name . "publisher")) (group ((delimiter . ": ")) (text ((variable . "publisher"))) (text ((variable . "publisher-place"))))) (macro ((name . "title")) (choose nil (if ((type . "bill book graphic legal_case legislation motion_picture report song") (match . "any")) (text ((variable . "title") (text-case . "title") (font-style . "italic")))) (else nil (text ((variable . "title") (text-case . "title")))))) (macro ((name . "volume")) (group ((delimiter . " ")) (text ((term . "volume") (form . "short") (text-case . "capitalize-first"))) (text ((variable . "volume"))))) (macro ((name . "series")) (text ((variable . "collection-title")))) (macro ((name . "pages")) (label ((variable . "page") (form . "short") (suffix . " "))) (text ((variable . "page")))) (macro ((name . "book-container")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((term . "in") (text-case . "capitalize-first"))) (text ((variable . "container-title") (font-style . "italic"))))) (macro ((name . "issued")) (date ((variable . "issued") (delimiter . " ")) (date-part ((name . "year"))))) (macro ((name . "full-issued")) (date ((variable . "issued") (delimiter . " ")) (date-part ((name . "month") (form . "long") (suffix . " "))) (date-part ((name . "day") (suffix . ", "))) (date-part ((name . "year"))))) (macro ((name . "edition")) (choose nil (if ((is-numeric . "edition")) (group ((delimiter . " ")) (number ((variable . "edition") (form . "ordinal"))) (text ((term . "edition") (form . "short"))))) (else nil (text ((variable . "edition") (suffix . ".")))))) (citation ((collapse . "citation-number")) (sort nil (key ((variable . "citation-number")))) (layout ((delimiter . ",") (vertical-align . "sup")) (text ((variable . "citation-number"))))) (bibliography ((second-field-align . "flush") (entry-spacing . "0") (et-al-min . "11") (et-al-use-first . "10")) (layout ((suffix . ".")) (text ((variable . "citation-number") (prefix . "(") (suffix . ") "))) (text ((macro . "author") (suffix . " "))) (choose nil (if ((type . "article-magazine")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (suffix . "."))) (text ((macro . "edition"))) (text ((macro . "publisher"))) (text ((macro . "full-issued") (suffix . ","))) (text ((macro . "pages"))))) (else-if ((type . "thesis")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "genre")))) (text ((macro . "publisher"))) (text ((macro . "issued"))) (text ((macro . "volume"))) (text ((macro . "pages"))))) (else-if ((type . "bill book graphic legal_case legislation motion_picture report song") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "title"))) (text ((macro . "editor") (prefix . " "))) (text ((macro . "series"))) (text ((macro . "edition"))) (choose nil (if ((type . "report")) (group ((delimiter . " ")) (text ((variable . "genre"))) (text ((variable . "number")))))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "patent")) (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "number")))) (date ((variable . "issued") (form . "text"))))) (else-if ((type . "chapter paper-conference") (match . "any")) (group ((delimiter . "; ")) (text ((macro . "book-container"))) (text ((macro . "editor"))) (text ((macro . "series"))) (group ((delimiter . ", ")) (text ((macro . "publisher"))) (text ((macro . "issued")))) (group ((delimiter . ", ")) (text ((macro . "volume"))) (text ((macro . "pages")))))) (else-if ((type . "webpage")) (group ((delimiter . " ")) (text ((variable . "title"))) (text ((variable . "URL"))) (date ((variable . "accessed") (prefix . "(accessed ") (suffix . ")") (delimiter . " ")) (date-part ((name . "month") (form . "short") (strip-periods . "true"))) (date-part ((name . "day") (suffix . ", "))) (date-part ((name . "year")))))) (else-if ((type . "article-journal")) (group ((delimiter . " ")) (text ((macro . "title") (suffix . "."))) (text ((variable . "container-title") (font-style . "italic") (form . "short"))) (group ((delimiter . ", ")) (text ((macro . "issued") (font-weight . "bold"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page")))))) (else nil (group ((delimiter . ", ")) (group ((delimiter . ". ")) (text ((macro . "title"))) (text ((variable . "container-title") (font-style . "italic")))) (group ((delimiter . ", ")) (text ((macro . "issued"))) (text ((variable . "volume") (font-style . "italic"))) (text ((variable . "page"))))))))))
(add-to-list 'load-path ".") (require 'org-ref-citeproc) (require 'unsrt)
unsrt
My data cite:kitchin-2015-examp in Ref. citenum:kitchin-2015-data-surfac-scien.
A multicite cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien
(mapcar (lambda (link) (org-element-property :type link)) (orcp-collect-citations))
cite | citenum | cite |
I need a key to entry function
(orcp-key-to-entry "kitchin-2015-examp")
(("=type=" . "article") ("=key=" . "kitchin-2015-examp") ("author" . "Kitchin, John R.") ("title" . "Examples of Effective Data Sharing in Scientific Publishing") ("journal" . "ACS Catalysis") ("volume" . "5") ("number" . "6") ("pages" . "3894-3899") ("year" . "2015") ("doi" . "10.1021/acscatal.5b00538") ("url" . " http://dx.doi.org/10.1021/acscatal.5b00538 ") ("keywords" . "DESC0004031, early-career, orgmode, Data sharing ") ("eprint" . " http://dx.doi.org/10.1021/acscatal.5b00538 "))
(cdr (assoc "year" (orcp-key-to-entry "kitchin-2015-examp")))
2015
cite:wang-2013-immob-co2
cite:antony-2012-pathw-c
cite:weaver-2011-high-selec
The unique entries will make up the bibliography. They might get sorted in a variety of ways, e.g. unsorted, alphabetically, by year, etc…
(orcp-sort-entries-increasing-year (orcp-collect-unique-entries))
weaver-2011-high-selec | (type . article) |
(key . weaver-2011-high-selec) |
(author . Jason F. Weaver and Can Hakanoglu and Abbin Antony and Aravind\n Asthagiri) | (title . High Selectivity for Primary {C-H} Bond Cleavage of Propane\n $\gma$-mplexes on the {PdO}(101) Surface) | (keywords . alkane) | (journal . J. Am. Chem. Soc.) | (volume . 133) | (number . 40) | (pages . 16196-16200) | (year . 2011) | (doi . 10.1021/ja206599k) | (url . http://dx.doi.org/10.1021/ja206599k) | (date_added . Sat Nov 28 09:10:59 2015) |
antony-2012-pathw-c | (type . article) |
(key . antony-2012-pathw-c) |
(author . Abbin Antony and Aravind Asthagiri and Jason F. Weaver) | (title . Pathways for {C-H} Bond Cleavage of Propane $\gma$-mplexes on\n {PdO}(101)) | (keywords . alkane) | (journal . Phys. Chem. Chem. Phys.) | (volume . 14) | (number . 35) | (pages . 12202) | (year . 2012) | (doi . 10.1039/c2cp41900a) | (url . http://dx.doi.org/10.1039/c2cp41900a) | (date_added . Sat Nov 28 09:13:32 2015) |
wang-2013-immob-co2 | (type . article) |
(key . wang-2013-immob-co2) |
(author . Xianfeng Wang and Novruz G. Akhmedov and Yuhua Duan and David\n Luebke and Bingyun Li) | (title . Immobilization of Amino Acid Ionic Liquids Into Nanoporous\n Microspheres As Robust Sorbents for Co2 Capture) | (journal . J. Mater. Chem. A) | (volume . 1) | (number . 9) | (pages . 2978) | (year . 2013) | (doi . 10.1039/c3ta00768e) | (url . http://dx.doi.org/10.1039/C3TA00768E) | (date_added . Thu Dec 3 06:13:09 2015) | |
kitchin-2015-examp | (type . article) |
(key . kitchin-2015-examp) |
(author . Kitchin, John R.) | (title . Examples of Effective Data Sharing in Scientific Publishing) | (journal . ACS Catalysis) | (volume . 5) | (number . 6) | (pages . 3894-3899) | (year . 2015) | (doi . 10.1021/acscatal.5b00538) | (url . http://dx.doi.org/10.1021/acscatal.5b00538 ) | (keywords . DESC0004031, early-career, orgmode, Data sharing ) | (eprint . http://dx.doi.org/10.1021/acscatal.5b00538 ) |
kitchin-2015-data-surfac-scien | (type . article) |
(key . kitchin-2015-data-surfac-scien) |
(author . John R. Kitchin) | (title . Data Sharing in Surface Science) | (journal . Surface Science ) | (number . 0) | (pages . - ) | (year . 2015) | (doi . 10.1016/j.susc.2015.05.007) | (url . http://www.sciencedirect.com/science/article/pii/S0039602815001326) | (issn . 0039-6028) | (keywords . DESC0004031, early-career, orgmode, Data sharing ) |
cite:anderson-1977-raman
(orcp-sort-entries-alphabetical (orcp-collect-unique-entries))
anderson-1977-raman | (type . article) |
(key . anderson-1977-raman) |
(author . George R. Anderson) | (title . The {R}aman Spectra of Carbon Dioxide in Liquid Water and\n Water-D2) | (journal . J. Phys. Chem.) | (volume . 81) | (number . 3) | (pages . 273-276) | (year . 1977) | (doi . 10.1021/j100518a017) | (url . http://dx.doi.org/10.1021/j100518a017) | (month . 2) | (eprint . http://pubs.acs.org/doi/pdf/10.1021/j100518a017) |
antony-2012-pathw-c | (type . article) |
(key . antony-2012-pathw-c) |
(author . Abbin Antony and Aravind Asthagiri and Jason F. Weaver) | (title . Pathways for {C-H} Bond Cleavage of Propane $\gma$-mplexes on\n {PdO}(101)) | (keywords . alkane) | (journal . Phys. Chem. Chem. Phys.) | (volume . 14) | (number . 35) | (pages . 12202) | (year . 2012) | (doi . 10.1039/c2cp41900a) | (url . http://dx.doi.org/10.1039/c2cp41900a) | (date_added . Sat Nov 28 09:13:32 2015) |
kitchin-2015-examp | (type . article) |
(key . kitchin-2015-examp) |
(author . Kitchin, John R.) | (title . Examples of Effective Data Sharing in Scientific Publishing) | (journal . ACS Catalysis) | (volume . 5) | (number . 6) | (pages . 3894-3899) | (year . 2015) | (doi . 10.1021/acscatal.5b00538) | (url . http://dx.doi.org/10.1021/acscatal.5b00538 ) | (keywords . DESC0004031, early-career, orgmode, Data sharing ) | (eprint . http://dx.doi.org/10.1021/acscatal.5b00538 ) |
kitchin-2015-data-surfac-scien | (type . article) |
(key . kitchin-2015-data-surfac-scien) |
(author . John R. Kitchin) | (title . Data Sharing in Surface Science) | (journal . Surface Science ) | (number . 0) | (pages . - ) | (year . 2015) | (doi . 10.1016/j.susc.2015.05.007) | (url . http://www.sciencedirect.com/science/article/pii/S0039602815001326) | (issn . 0039-6028) | (keywords . DESC0004031, early-career, orgmode, Data sharing ) | |
wang-2013-immob-co2 | (type . article) |
(key . wang-2013-immob-co2) |
(author . Xianfeng Wang and Novruz G. Akhmedov and Yuhua Duan and David\n Luebke and Bingyun Li) | (title . Immobilization of Amino Acid Ionic Liquids Into Nanoporous\n Microspheres As Robust Sorbents for Co2 Capture) | (journal . J. Mater. Chem. A) | (volume . 1) | (number . 9) | (pages . 2978) | (year . 2013) | (doi . 10.1039/c3ta00768e) | (url . http://dx.doi.org/10.1039/C3TA00768E) | (date_added . Thu Dec 3 06:13:09 2015) | |
weaver-2011-high-selec | (type . article) |
(key . weaver-2011-high-selec) |
(author . Jason F. Weaver and Can Hakanoglu and Abbin Antony and Aravind\n Asthagiri) | (title . High Selectivity for Primary {C-H} Bond Cleavage of Propane\n $\gma$-mplexes on the {PdO}(101) Surface) | (keywords . alkane) | (journal . J. Am. Chem. Soc.) | (volume . 133) | (number . 40) | (pages . 16196-16200) | (year . 2011) | (doi . 10.1021/ja206599k) | (url . http://dx.doi.org/10.1021/ja206599k) | (date_added . Sat Nov 28 09:10:59 2015) |
This will be taking a key, and the unique replacements, and computing a replacement for that key.
(orcp-citation-author-year-label "anderson-1977-raman" (orcp-sort-entries-alphabetical (orcp-collect-unique-entries)))
Anderson 1977
citeauthor:wang-2013-immob-co2
citeyear:wang-2013-immob-co2
(orcp-get-citation-style 'vertical-align 'citenum) (cdr (assoc 'vertical-align (cdr (assoc 'citenum citation-style))))
baseline
(setq orcp-unique-bibliography-links (orcp-collect-unique-entries)) (mapcar (lambda (link) (list (org-element-property :type link) (orcp-get-text-replacement link)) ) (orcp-collect-citations))
cite | {}1 |
citenum | 2 |
cite | {}1,2 |
cite | {}3 |
cite | {}4 |
cite | {}5 |
cite | {}6 |
citeauthor | Wang |
citeyear | 2013 |
(orcp-author (nth 3 (orcp-collect-unique-entries)))
Antony, Abbin; Asthagiri, Aravind and Weaver, Jason F..
(let ((entry (nth 3 (orcp-collect-unique-entries)))) (concat (orcp-author entry) (orcp-title entry) (orcp-journal entry) (orcp-volume entry) (orcp-pages entry) (orcp-year entry) (orcp-doi entry)))
Antony, Abbin; Asthagiri, Aravind and Weaver, Jason F., /Pathways for {C-H} Bond Cleavage of Propane $\sigma$-complexes on {PdO}(101)/, Phys. Chem. Chem. Phys., 14*(35)*, pp. 12202 (2012).doi:10.1039/c2cp41900a.
(mapconcat 'identity (cl-loop for entry in (orcp-collect-unique-entries) collect (concat (orcp-author entry) (orcp-title entry) (orcp-journal entry) (orcp-volume entry) (orcp-pages entry) (orcp-year entry) (orcp-doi entry))) "\n\n")
Kitchin, John R., /Examples of Effective Data Sharing in Scientific Publishing/, ACS Catalysis, 5*(6)*, pp. 3894-3899 (2015). doi:10.1021/acscatal.5b00538. Kitchin, John R., /Data Sharing in Surface Science/, Surface Science , *(0)*, pp. - (2015). doi:10.1016/j.susc.2015.05.007. Wang, Xianfeng; Akhmedov, Novruz G.; Duan, Yuhua; Luebke, David and Li, Bingyun, /Immobilization of Amino Acid Ionic Liquids Into Nanoporous Microspheres As Robust Sorbents for Co2 Capture/, J. Mater. Chem. A, 1*(9)*, pp. 2978 (2013). doi:10.1039/c3ta00768e. Antony, Abbin; Asthagiri, Aravind and Weaver, Jason F., /Pathways for {C-H} Bond Cleavage of Propane $\sigma$-complexes on {PdO}(101)/, Phys. Chem. Chem. Phys., 14*(35)*, pp. 12202 (2012). doi:10.1039/c2cp41900a. Weaver, Jason F.; Hakanoglu, Can; Antony, Abbin and Asthagiri, Aravind, /High Selectivity for Primary {C-H} Bond Cleavage of Propane $\sigma$-complexes on the {PdO}(101) Surface/, J. Am. Chem. Soc., 133*(40)*, pp. 16196-16200 (2011). doi:10.1021/ja206599k. Anderson, George R., /The {R}aman Spectra of Carbon Dioxide in Liquid Water and Water-D2/, J. Phys. Chem., 81*(3)*, pp. 273-276 (1977). doi:10.1021/j100518a017. Zhu, Qingjun; Wegener, Staci L.; Xie, Chao; Uche, Obioma; Neurock, Matthew and Marks, Tobin J., /Sulfur As a Selective "soft" Oxidant for Catalytic Methane Conversion Probed By Experiment and Theory/, Nature chemistry, 5, pp. 104-109 (2013). doi:10.1002/ange.201311111. Lizzit, S.; Baraldi, A.; Groso, A.; Reuter, K.; Ganduglia-Pirovano, M. V.; Stampfl, C.; Scheffler, M.; Stichler, M.; Keller, C.; Wurth, W. and Menzel, D., /Surface Core-Level Shifts of Clean and Oxygen-Covered {Ru}(0001)/, Phys. Rev. B, 63*(20)*, pp. 205419 (2001). doi:10.1103/physrevb.63.205419.
cite:zhu-2013-sulfur,lizzit-2001-surfac-ru
cite:yeo-2012-in-situ,ye-2012-proces-charac
(orcp-formatted-bibliography)
1. Kitchin, John R., /Examples of Effective Data Sharing in Scientific Publishing/, ACS Catalysis, 5*(6)*, pp. 3894-3899 (2015). doi:10.1021/acscatal.5b00538. 2. Kitchin, John R., /Data Sharing in Surface Science/, Surface Science , *(0)*, pp. - (2015). doi:10.1016/j.susc.2015.05.007. 3. Wang, Xianfeng; Akhmedov, Novruz G.; Duan, Yuhua; Luebke, David and Li, Bingyun, /Immobilization of Amino Acid Ionic Liquids Into Nanoporous Microspheres As Robust Sorbents for Co2 Capture/, J. Mater. Chem. A, 1*(9)*, pp. 2978 (2013). doi:10.1039/c3ta00768e. 4. Antony, Abbin; Asthagiri, Aravind and Weaver, Jason F., /Pathways for {C-H} Bond Cleavage of Propane $\sigma$-complexes on {PdO}(101)/, Phys. Chem. Chem. Phys., 14*(35)*, pp. 12202 (2012). doi:10.1039/c2cp41900a. 5. Weaver, Jason F.; Hakanoglu, Can; Antony, Abbin and Asthagiri, Aravind, /High Selectivity for Primary {C-H} Bond Cleavage of Propane $\sigma$-complexes on the {PdO}(101) Surface/, J. Am. Chem. Soc., 133*(40)*, pp. 16196-16200 (2011). doi:10.1021/ja206599k. 6. Anderson, George R., /The {R}aman Spectra of Carbon Dioxide in Liquid Water and Water-D2/, J. Phys. Chem., 81*(3)*, pp. 273-276 (1977). doi:10.1021/j100518a017. 7. Zhu, Qingjun; Wegener, Staci L.; Xie, Chao; Uche, Obioma; Neurock, Matthew and Marks, Tobin J., /Sulfur As a Selective "soft" Oxidant for Catalytic Methane Conversion Probed By Experiment and Theory/, Nature chemistry, 5, pp. 104-109 (2013). doi:10.1002/ange.201311111. 8. Lizzit, S.; Baraldi, A.; Groso, A.; Reuter, K.; Ganduglia-Pirovano, M. V.; Stampfl, C.; Scheffler, M.; Stichler, M.; Keller, C.; Wurth, W. and Menzel, D., /Surface Core-Level Shifts of Clean and Oxygen-Covered {Ru}(0001)/, Phys. Rev. B, 63*(20)*, pp. 205419 (2001). doi:10.1103/physrevb.63.205419. 9. Yeo, Boon Siang and Bell, Alexis T., /In Situ {R}aman Study of Nickel Oxide and Gold-Supported Nickel Oxide Catalysts for the Electrochemical Evolution of Oxygen/, The Journal of Physical Chemistry C, 116*(15)*, pp. 8394-8400 (2012). doi:10.1021/jp3007415. 10. Chunbo, Y. E.; CHEN, Guangwen and YUAN, Quan, /Process Characteristics of \ce{CO2} Absorption By Aqueous Monoethanolamine in a Microchannel Reactor/, Chinese Journal of Chemical Engineering, 20*(1)*, pp. 111-119 (2012). doi:10.1016/s1004-9541(12)60370-x. 11. Kittel, Charles, /Introduction to Solid State Physics/, (2005).
cite:kittel-2005-introd-solid
(require 'unsrt) (assoc 'sort bibliography-style)
sort | quote | citation-number |
**
You run these to get the replacements
(orcp-collect-citations) (orcp-collect-unique-entries)
(cl-loop for link in *orcp-citation-links* for repl in (orcp-get-citation-replacements) collect (list repl (org-element-property :begin link) (org-element-property :end link)))
{}1 | 29467 | 29491 |
2 | 29499 | 29537 |
{}1,2 | 29552 | 29606 |
{}3 | 30578 | 30602 |
{}4 | 30604 | 30628 |
{}5 | 30630 | 30657 |
{}6 | 34705 | 34729 |
Wang | 39698 | 39728 |
2013 | 39730 | 39758 |
{}7,8 | 43188 | 43230 |
{}9,10 | 43232 | 43275 |
{}11 | 45939 | 45968 |
(orcp-formatted-bibliography)
1. Kitchin, John R., /Examples of Effective Data Sharing in Scientific Publishing/, ACS Catalysis, 5*(6)*, pp. 3894-3899 (2015). doi:10.1021/acscatal.5b00538. 2. Kitchin, John R., /Data Sharing in Surface Science/, Surface Science , *(0)*, pp. - (2015). doi:10.1016/j.susc.2015.05.007. 3. Wang, Xianfeng; Akhmedov, Novruz G.; Duan, Yuhua; Luebke, David and Li, Bingyun, /Immobilization of Amino Acid Ionic Liquids Into Nanoporous Microspheres As Robust Sorbents for Co2 Capture/, J. Mater. Chem. A, 1*(9)*, pp. 2978 (2013). doi:10.1039/c3ta00768e. 4. Antony, Abbin; Asthagiri, Aravind and Weaver, Jason F., /Pathways for {C-H} Bond Cleavage of Propane $\sigma$-complexes on {PdO}(101)/, Phys. Chem. Chem. Phys., 14*(35)*, pp. 12202 (2012). doi:10.1039/c2cp41900a. 5. Weaver, Jason F.; Hakanoglu, Can; Antony, Abbin and Asthagiri, Aravind, /High Selectivity for Primary {C-H} Bond Cleavage of Propane $\sigma$-complexes on the {PdO}(101) Surface/, J. Am. Chem. Soc., 133*(40)*, pp. 16196-16200 (2011). doi:10.1021/ja206599k. 6. Anderson, George R., /The {R}aman Spectra of Carbon Dioxide in Liquid Water and Water-D2/, J. Phys. Chem., 81*(3)*, pp. 273-276 (1977). doi:10.1021/j100518a017. 7. Zhu, Qingjun; Wegener, Staci L.; Xie, Chao; Uche, Obioma; Neurock, Matthew and Marks, Tobin J., /Sulfur As a Selective "soft" Oxidant for Catalytic Methane Conversion Probed By Experiment and Theory/, Nature chemistry, 5, pp. 104-109 (2013). doi:10.1002/ange.201311111. 8. Lizzit, S.; Baraldi, A.; Groso, A.; Reuter, K.; Ganduglia-Pirovano, M. V.; Stampfl, C.; Scheffler, M.; Stichler, M.; Keller, C.; Wurth, W. and Menzel, D., /Surface Core-Level Shifts of Clean and Oxygen-Covered {Ru}(0001)/, Phys. Rev. B, 63*(20)*, pp. 205419 (2001). doi:10.1103/physrevb.63.205419. 9. Yeo, Boon Siang and Bell, Alexis T., /In Situ {R}aman Study of Nickel Oxide and Gold-Supported Nickel Oxide Catalysts for the Electrochemical Evolution of Oxygen/, The Journal of Physical Chemistry C, 116*(15)*, pp. 8394-8400 (2012). doi:10.1021/jp3007415. 10. Chunbo, Y. E.; CHEN, Guangwen and YUAN, Quan, /Process Characteristics of \ce{CO2} Absorption By Aqueous Monoethanolamine in a Microchannel Reactor/, Chinese Journal of Chemical Engineering, 20*(1)*, pp. 111-119 (2012). doi:10.1016/s1004-9541(12)60370-x. 11. Kittel, Charles, /Introduction to Solid State Physics/, (2005).
(cl-loop for link in (org-element-map (org-element-parse-buffer) 'link 'identity) if (string= "bibliographystyle" (org-element-property :type link)) do ;; get path for style (let ((style (intern (org-element-property :path link))))) (load-library style) )