[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] State of the art in citations
From: |
Clément B . |
Subject: |
Re: [O] State of the art in citations |
Date: |
Sat, 26 Apr 2014 20:26:51 +0200 |
User-agent: |
mu4e 0.9.9.5; emacs 24.3.50.1 |
Hi all,
> - Should I use biblatex instead of bibtex?
You should. It is very powerful and straightforward. The manual
is great.
As for citations, I find that the most flexible way is to define
my own link types, that allows control on both org formatting and
export
Let's say for example that you want to cite an entry of your .bib
file, which key is Chiles:2012:Geostatistics. Something like :
see Chilès 2012, p.145
Note (i) the "see" (ii) the "p.145", they are both part of the
citation. In this case, biblatex provides the following command
\cite[see][p.145]{Chiles:2012:Geostatistics}
For readability purposes, the citation should appear as is in the
org file, the "\cite{Chiles:2012:Geostatistics}" command should
only appear when exporting to LaTeX. Furthermore, this should be
a link to the entry in the .bib file, so the complete org link
would look like
[[ref:Chiles:2012:Geostatistics][(see for example Chilès 2012, p.145)]]
Where ref is a custom link type to the said bib file.
To do that, I have defined the following link-type in my init.el:
(org-add-link-type
"ref"
(lambda (key)
(org-open-file cby-references-file t nil key))
(lambda (path desc format)
(cond
((eq format 'html)
(format "(<cite>%s</cite>)" path))
((eq format 'latex)
(let* ((postnote (cby-org-link-get-postnote desc))
(prenote (cby-org-link-get-prenote desc)))
(cond
((and prenote postnote)
(format "\\cite[%s][%s]{%s}" prenote postnote path))
(postnote
(format "\\cite[%s]{%s}" postnote path))
(prenote
(format "\\cite[%s][]{%s}" prenote path))
(t
(format "\\cite{%s}" path))))))))
Some remarks :
1. `cby-references-file` is my master .bib file.
2. The html export is rather rudimentary, it simply takes the org
link description (%s) and puts it between <cite> markups.
3. To get the prenote (the "see") and postnote (the "p.145"), I
use very shaky functions (`cby-org-link-get-postnote`) that
strip the link description. I haven't come up with a proper
solution yet so here is one for reference :
(defun cby-org-link-get-postnote (desc)
"Extract postnote from org-mode link description. Postnote
starts at last ',' and ends at last ')'."
(let ((postnote (cadr (split-string desc "[,)]"))))
(if postnote
(copy-sequence
;; clean string
(replace-regexp-in-string "[ \t\n]" "" postnote)))))
4. To use the wide range of commands provided by biblatex, I also
have a "pref" link type that exports to "\parencite{}" and a
"tref" type that exports to "\texcite{}"
This is all work in progress, but custom link types make both
your org source file readable and export flexible.
> I use org-mode to write scientific papers, exporting mostly to LaTex/pdf
> (and sometimes to Word via ODT when I have to collaborate with less
> enlightened colleagues)
I also tried to do that, but do you have a way to get odt files
back to org ? I saw a package for that somewhere.
Bye,
Clément
- [O] State of the art in citations, Julian M. Burgos, 2014/04/25
- Re: [O] State of the art in citations,
Clément B . <=
- Re: [O] State of the art in citations, Clément B ., 2014/04/26
- Re: [O] State of the art in citations, Leonard Randall, 2014/04/27
- Re: [O] State of the art in citations, Clément B ., 2014/04/27
- Re: [O] State of the art in citations, Ken Mankoff, 2014/04/27
- Re: [O] State of the art in citations, Thomas S. Dye, 2014/04/27
- Re: [O] State of the art in citations, Ken Mankoff, 2014/04/27
- Re: [O] State of the art in citations, Clément B ., 2014/04/27
- Re: [O] State of the art in citations, John Kitchin, 2014/04/27
- Re: [O] State of the art in citations, Clément B ., 2014/04/27