emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: State of the art in citations
@ 2014-04-26 18:26 Clément B.
  2014-04-28  1:53 ` Richard Lawrence
  0 siblings, 1 reply; 22+ messages in thread
From: Clément B. @ 2014-04-26 18:26 UTC (permalink / raw)
  To: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: State of the art in citations
@ 2014-04-27 14:53 Clément B.
  2014-04-27 15:26 ` Ken Mankoff
  0 siblings, 1 reply; 22+ messages in thread
From: Clément B. @ 2014-04-27 14:53 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: emacs-orgmode

Hi Ken,

> When I export this to LaTeX, it is not treated as a proper
> LaTeX citation. The text is just the "%A (%y)" part. Is there
> some way to export so that the ref:%l turns into a \cite{%l}?

The "ref" is a custom link type, you can define those in org with
`org-add-link-type`, and they allow control over the export
behaviour. See the previous posts in this thread for an example.

Bye,

Clément

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: State of the art in citations
@ 2014-04-26 16:56 Clément B.
  2014-04-27 13:08 ` Leonard Randall
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Clément B. @ 2014-04-26 16:56 UTC (permalink / raw)
  To: julian; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* State of the art in citations
@ 2014-04-25 12:11 Julian M. Burgos
  2014-04-25 15:42 ` Grant Rettke
  0 siblings, 1 reply; 22+ messages in thread
From: Julian M. Burgos @ 2014-04-25 12:11 UTC (permalink / raw)
  To: emacs-orgmode

Dear list,

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 keep my references in a .bib file, and so
far I have been using bibtex in a more or less standard way, using
reftex to insert citations in the documents.  

I am planning in revamping the way I deal with citations, and I was
wondering if I can get your opinions in what is the "state of the art"
in using citations in org-mode, in particular

- Should I use biblatex instead of bibtex?  
- Are there any contributed packages that I should consider?
- What would be the best way to get citations into html or odt?

Any comments or tips will be welcomed!
All the best,

Julian

-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnun/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian@hafro.is

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2014-04-29 15:38 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-26 18:26 State of the art in citations Clément B.
2014-04-28  1:53 ` Richard Lawrence
  -- strict thread matches above, loose matches on Subject: below --
2014-04-27 14:53 Clément B.
2014-04-27 15:26 ` Ken Mankoff
2014-04-27 16:05   ` Clément B.
2014-04-27 16:10     ` Ken Mankoff
2014-04-26 16:56 Clément B.
2014-04-27 13:08 ` Leonard Randall
2014-04-27 14:14   ` Clément B.
2014-04-27 14:41     ` Ken Mankoff
2014-04-27 16:01     ` Thomas S. Dye
2014-04-27 16:16       ` Ken Mankoff
2014-04-27 16:57         ` Clément B.
2014-04-27 19:20           ` John Kitchin
2014-04-27 21:30             ` Clément B.
2014-04-28 13:57             ` Julian M. Burgos
2014-04-28 13:56   ` Julian M. Burgos
2014-04-29  9:30 ` Vikas Rawal Lists
2014-04-29 15:36   ` Richard Lawrence
2014-04-29  9:30 ` Vikas Rawal Lists
2014-04-25 12:11 Julian M. Burgos
2014-04-25 15:42 ` Grant Rettke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).