[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] reftex-cite-format accessing URL
From: |
Tassilo Horn |
Subject: |
Re: [AUCTeX] reftex-cite-format accessing URL |
Date: |
Mon, 21 Jan 2013 13:18:18 +0100 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) |
"Stephen J. Barr" <address@hidden> writes:
Hi Stephen,
> I would like to use reftex-cite-format to create a link of the format
>
> [%a](%url) %t
>
> Is there a way to get the URL from my bibtex database?
Yes, you can get any field using
(reftex-get-bib-field "field-name" entry)
I've just added access to the "note" (%N) and "url" (%U) fields to
reftex in emacs' bzr repo. This is the patch.
--8<---------------cut here---------------start------------->8---
--- lisp/textmodes/reftex-cite.el 2013-01-01 09:11:05 +0000
+++ lisp/textmodes/reftex-cite.el 2013-01-21 12:14:56 +0000
@@ -1043,6 +1043,7 @@
((= l ?k) (reftex-get-bib-field "key" entry))
((= l ?m) (reftex-get-bib-field "month" entry))
((= l ?n) (reftex-get-bib-field "number" entry))
+ ((= l ?N) (reftex-get-bib-field "note" entry))
((= l ?o) (reftex-get-bib-field "organization" entry))
((= l ?p) (reftex-get-bib-field "pages" entry))
((= l ?P) (car (split-string
@@ -1050,6 +1051,7 @@
"[- .]+")))
((= l ?s) (reftex-get-bib-field "school" entry))
((= l ?u) (reftex-get-bib-field "publisher" entry))
+ ((= l ?U) (reftex-get-bib-field "url" entry))
((= l ?r) (reftex-get-bib-field "address" entry))
((= l ?t) (reftex-get-bib-field "title" entry))
((= l ?T) (reftex-abbreviate-title
=== modified file 'lisp/textmodes/reftex-vars.el'
--- lisp/textmodes/reftex-vars.el 2013-01-01 09:11:05 +0000
+++ lisp/textmodes/reftex-vars.el 2013-01-21 12:14:56 +0000
@@ -1125,12 +1125,12 @@
%e Works like %a, but on list of editor names. (%2e and %E work a well)
It is also possible to access all other BibTeX database fields:
-%b booktitle %c chapter %d edition %h howpublished
-%i institution %j journal %k key %m month
-%n number %o organization %p pages %P first page
-%r address %s school %u publisher %t title
-%v volume %y year
-%B booktitle, abbreviated %T title, abbreviated
+%b booktitle %c chapter %d edition %h howpublished
+%i institution %j journal %k key %m month
+%n number %N note %o organization %p pages
+%P first page %r address %s school %u publisher
+%U url %t title %v volume %y year
+%B booktitle, abbreviated %T title, abbreviated
Usually, only %l is needed. The other stuff is mainly for the echo area
display, and for (setq reftex-comment-citations t).
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo