GNU bug report logs -
#38762
26.3; reftex-citation-format doesn't know biblatex fields
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38762 in the body.
You can then email your comments to 38762 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-auctex <at> gnu.org
:
bug#38762
; Package
auctex
.
(Fri, 27 Dec 2019 15:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Andrew Francis Swann <swann <at> math.au.dk>
:
New bug report received and forwarded. Copy sent to
bug-auctex <at> gnu.org
.
(Fri, 27 Dec 2019 15:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
For local citations outside a tex file I have
(setq reftex-cite-format
"[%4a, \\textit{%t}, %b %e, %u, %r %h %j \\textbf{%v} (%y), %p %<]" )
but when the database file is in biblatex format, the journal name is not in the field journal, accessed by %j, but rather in the field journaltitle, that is not detected. E.g. the entry
@Article{Abels:slice,
author = {Abels, H.},
title = {Parallelizability of proper actions, global
{$K$}-slices and maximal compact subgroups},
journaltitle = {Math. Ann.},
year = 1974,
volume = 212,
pages = {1--19}
}
produces the local citation
[Abels, \textit{Parallelizability of proper actions, global {$K$}-slices and maximal compact subgroups}, \textbf{212} (1974), 1--19]
with no journal name.
Emacs : GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G1012))
of 2019-11-06
Package: 26.3
current state:
==============
(setq
window-system 'ns
reftex-plug-into-AUCTeX t
)
--
Andrew Swann | Associate Professor | Tel +45 871 55767 | swann <at> math.au.dk | http://home.math.au.dk/swann/ | Department of Mathematics, Aarhus University, Ny Munkegade 118, Bldg 1530, DK-8000 Aarhus C, Denmark | Dept +45 871 50000
Merged 38761 38762.
Request was from
Ikumi Keita <ikumi <at> ikumi.que.jp>
to
control <at> debbugs.gnu.org
.
(Sat, 11 Jul 2020 17:16:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#38762
; Package
auctex
.
(Mon, 06 May 2024 20:27:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 38762 <at> debbugs.gnu.org (full text, mbox):
Andrew Francis Swann <swann <at> math.au.dk> writes:
> For local citations outside a tex file I have
>
> (setq reftex-cite-format
> "[%4a, \\textit{%t}, %b %e, %u, %r %h %j \\textbf{%v} (%y), %p %<]" )
>
> but when the database file is in biblatex format, the journal name is
> not in the field journal, accessed by %j, but rather in the field
> journaltitle, that is not detected. E.g. the entry
>
> @Article{Abels:slice,
> author = {Abels, H.},
> title = {Parallelizability of proper actions, global
> {$K$}-slices and maximal compact subgroups},
> journaltitle = {Math. Ann.},
> year = 1974,
> volume = 212,
> pages = {1--19}
> }
>
> produces the local citation
>
> [Abels, \textit{Parallelizability of proper actions, global
> {$K$}-slices and maximal compact subgroups}, \textbf{212} (1974),
> 1--19]
>
> with no journal name.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
Can you please eval this function and try it again?
--8<---------------cut here---------------start------------->8---
(defun reftex-format-citation (entry format)
"Format a citation from the info in the BibTeX ENTRY according to FORMAT."
(unless (stringp format) (setq format "\\cite{%l}"))
(if (and reftex-comment-citations
(string-match "%l" reftex-cite-comment-format))
(error "reftex-cite-comment-format contains invalid %%l"))
(while (string-match
"\\(\\`\\|[^%]\\)\\(\\(%\\([0-9]*\\)\\([a-zA-Z]\\)\\)[.,;: ]*\\)"
format)
(let ((n (string-to-number (match-string 4 format)))
(l (string-to-char (match-string 5 format)))
rpl b e)
(save-match-data
(setq rpl
(cond
((= l ?l) (concat
(reftex-get-bib-field "&key" entry)
(if reftex-comment-citations
reftex-cite-comment-format
"")))
((= l ?a) (reftex-format-names
(reftex-get-bib-names "author" entry)
(or n 2)))
((= l ?A) (car (reftex-get-bib-names "author" entry)))
((= l ?b) (reftex-get-bib-field "booktitle" entry "in: %s"))
((= l ?B) (reftex-abbreviate-title
(reftex-get-bib-field "booktitle" entry "in: %s")))
((= l ?c) (reftex-get-bib-field "chapter" entry))
((= l ?d) (reftex-get-bib-field "edition" entry))
((= l ?e) (reftex-format-names
(reftex-get-bib-names "editor" entry)
(or n 2)))
((= l ?E) (car (reftex-get-bib-names "editor" entry)))
((= l ?h) (reftex-get-bib-field "howpublished" entry))
((= l ?i) (reftex-get-bib-field "institution" entry))
((= l ?j) (cond ((not (string-empty-p
(reftex-get-bib-field "journal" entry)))
(reftex-get-bib-field "journal" entry))
((not (string-empty-p
(reftex-get-bib-field "journaltitle" entry)))
(reftex-get-bib-field "journaltitle" entry))
(t "")))
((= 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
(reftex-get-bib-field "pages" entry)
"[- .]+")))
((= 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
(reftex-get-bib-field "title" entry)))
((= l ?v) (reftex-get-bib-field "volume" entry))
((= l ?y) (reftex-get-bib-field "year" entry)))))
(if (string= rpl "")
(setq b (match-beginning 2) e (match-end 2))
(setq b (match-beginning 3) e (match-end 3)))
(setq format (concat (substring format 0 b) rpl (substring format e)))))
(while (string-match "%%" format)
(setq format (replace-match "%" t t format)))
(while (string-match "[ ,.;:]*%<" format)
(setq format (replace-match "" t t format)))
format)
--8<---------------cut here---------------end--------------->8---
This is the corresponding diff:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 34f40ba689f..5d7c93a4717 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1048,7 +1048,13 @@ reftex-format-citation
((= l ?E) (car (reftex-get-bib-names "editor" entry)))
((= l ?h) (reftex-get-bib-field "howpublished" entry))
((= l ?i) (reftex-get-bib-field "institution" entry))
- ((= l ?j) (reftex-get-bib-field "journal" entry))
+ ((= l ?j) (cond ((not (string-empty-p
+ (reftex-get-bib-field "journal" entry)))
+ (reftex-get-bib-field "journal" entry))
+ ((not (string-empty-p
+ (reftex-get-bib-field "journaltitle" entry)))
+ (reftex-get-bib-field "journaltitle" entry))
+ (t "")))
((= l ?k) (reftex-get-bib-field "key" entry))
((= l ?m) (reftex-get-bib-field "month" entry))
((= l ?n) (reftex-get-bib-field "number" entry))
--8<---------------cut here---------------end--------------->8---
TIA. Best, Arash
Reply sent
to
Arash Esbati <arash <at> gnu.org>
:
You have taken responsibility.
(Tue, 07 May 2024 14:04:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Andrew Francis Swann <swann <at> math.au.dk>
:
bug acknowledged by developer.
(Tue, 07 May 2024 14:04:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 38762-done <at> debbugs.gnu.org (full text, mbox):
Hi Andrew,
Andrew Francis Swann <swann <at> math.au.dk> writes:
> Thank you for looking at this. Yes, your code fixes the problem.
> Much appreciated.
Thanks for testing and your feedback. I installed a slightly modified
change on Emacs master (ead72523). This will be available with Emacs
30.
Again, sorry it took so long. Closing.
Best, Arash
Reply sent
to
Arash Esbati <arash <at> gnu.org>
:
You have taken responsibility.
(Tue, 07 May 2024 14:04:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Andrew Francis Swann <swann <at> math.au.dk>
:
bug acknowledged by developer.
(Tue, 07 May 2024 14:04:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 05 Jun 2024 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 339 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.