emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting org-bibtex links as \cite{} refs in Latex
@ 2012-03-23 17:23 Olivier Berger
  2012-03-27 20:41 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Berger @ 2012-03-23 17:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi.

Sorry in advance if this has already been covered.

AFAICT there's not yet a standard latex export for org-bibtex links.

I think that the following in org-bibtex.el :
 (org-add-link-type "bibtex" 'org-bibtex-open)
sets what's needed to navigate links like
[[bibtex:mybib.bib::abibtexref]] (or [[file:mybib.bib::abibtexref]] ?)
to the contents of the bibtex notice, but doesn't help with how the
latex export needs to be.

AFAIU, it lacks a second function that could be used to export the links.
So all that's needed is another function as :
(org-add-link-type "bibtex" 'org-bibtex-open 'org-bibtex-export) which
would render as \cite{abibtexref}.

Something like :
(defun org-bibtex-export (path desc format)
  (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
                   (match-string 1 path)))
         (path (substring path 0 (match-beginning 0))))
    (cond ((eq format 'latex)
           (if (or (not desc)
                   (equal 0 (search "bibtex:" desc)))
               (format "\\cite{%s}" search)
             (format "\\cite[%s]{%s}" desc search))))))

I think this can work (see more details in [0]), and maybe that wouldn't
be too hard to patch org-bibtex for something more generic ?

Is this reasonable ?

I'm not following the list regularly, so any feedback by email couldn't
hurt.

Best regards,

[0] http://www-public.it-sudparis.eu/~berger_o/weblog/2012/03/23/how-to-manage-and-export-bibliographic-notesrefs-in-org-mode/

-- 
Olivier BERGER 
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut TELECOM, SudParis (http://www.it-sudparis.eu/), Evry (France)

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

* Re: Exporting org-bibtex links as \cite{} refs in Latex
  2012-03-23 17:23 Exporting org-bibtex links as \cite{} refs in Latex Olivier Berger
@ 2012-03-27 20:41 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-03-27 20:41 UTC (permalink / raw)
  To: Olivier Berger; +Cc: emacs-orgmode

Hi Olivier,

Olivier Berger <olivier.berger@it-sudparis.eu> writes:

> Something like :
> (defun org-bibtex-export (path desc format)
>   (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
>                    (match-string 1 path)))
>          (path (substring path 0 (match-beginning 0))))
>     (cond ((eq format 'latex)
>            (if (or (not desc)
>                    (equal 0 (search "bibtex:" desc)))
>                (format "\\cite{%s}" search)
>              (format "\\cite[%s]{%s}" desc search))))))
>
> I think this can work (see more details in [0]), and maybe that wouldn't
> be too hard to patch org-bibtex for something more generic ?
>
> Is this reasonable ?

This is *very* reasonable and I would welcome a patch for such an 
export function.  

Thanks!

-- 
 Bastien

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

end of thread, other threads:[~2012-03-27 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 17:23 Exporting org-bibtex links as \cite{} refs in Latex Olivier Berger
2012-03-27 20:41 ` Bastien

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).