Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
4.3 KiB

4 years ago
  1. * DONE Introduction to a citation processor in org-ref
  2. CLOSED: [2015-12-11 Fri 18:05]
  3. :PROPERTIES:
  4. :categories: emacs,orgref,orgmode,citations
  5. :date: 2015/12/11 18:05:43
  6. :updated: 2015/12/11 18:22:40
  7. :END:
  8. As a potential solution for citions 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.
  9. 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.
  10. What do we gain by this?
  11. 1. No need for external citeproc program, and hackability by org-mode experts.
  12. 2. 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.
  13. 3. Total tunability of the citation format to different backends.
  14. 4. Easy to change bibliography format with the bibliographystyle link.
  15. 5. The use of Bibtex databases. These are plain text, and flexible.
  16. 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
  17. ** Reference types
  18. - A book cite:kittel-2005-introd-solid.
  19. - An article cite:kitchin-2015-examp
  20. - A miscellaneous bibtex type cite:xu-suppor.
  21. There is work to do in supporting other types of entry types that are common in bibtex files.
  22. ** Citation types
  23. - Regular citation: cite:kitchin-2015-examp
  24. - citenum: See Ref. citenum:kitchin-2015-examp
  25. - citeauthor: citeauthor:kitchin-2015-examp
  26. - citeyear: citeyear:kitchin-2015-examp
  27. There is work to do in supporting other types of citations.
  28. ** Multiple citations and sorting within citation
  29. You can specify that the cites within a citation are consistently sorted in the export.
  30. - a,b: cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien
  31. - b,a: cite:kitchin-2015-data-surfac-scien,kitchin-2015-examp
  32. There is work to do for range collapsing, e.g. to turn 1,2,3 into 1-3.
  33. ** Space chomping and punctuation testing
  34. 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.
  35. - Citation at end of sentence cite:kitchin-2015-examp.
  36. - Citation in clause cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien, with a comma.
  37. - Citation in middle of cite:kitchin-2015-examp,kitchin-2015-data-surfac-scien a sentence.
  38. ** Building
  39. :PROPERTIES:
  40. :date: 2015/12/11 14:47:59
  41. :updated: 2015/12/11 14:48:26
  42. :END:
  43. At the moment, you have to add a hook function to put the replacements in the document before parsing.
  44. #+BEGIN_SRC emacs-lisp
  45. (add-to-list 'load-path ".")
  46. (require 'org-ref-citeproc)
  47. (let ((org-export-before-parsing-hook '(orcp-citeproc)))
  48. (browse-url (org-html-export-to-html)))
  49. #+End_src
  50. #+RESULTS:
  51. : #<process open ./readme-author-year.html>
  52. ** Summary thoughts
  53. 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.
  54. Here are some remaining things that could be worked on if we continue this direction.
  55. 1. Other bibtex entries need to be tested out.
  56. 2. Remaining bibtex fields need to be defined.
  57. 3. Standardization of styling that can be done. Not all features described in my csl are supported, e.g. et. al. and probably others.
  58. 4. The author-year style needs name disambiguation somehow.
  59. 5. Hyperlinking in html.
  60. 6. Make sure export to other backends works.
  61. 7. Can this work for notes-based styles?
  62. ** Bibliography
  63. 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).
  64. bibliographystyle:author-year
  65. bibliography:~/Dropbox/bibliography/references.bib