GNU bug report logs - #64768
biblatex detection in reftex is too naive, multiple bib files are problematic

Previous Next

Package: emacs;

Reported by: "Philipp G. Haselwarter" <philipp <at> haselwarter.org>

Date: Fri, 21 Jul 2023 12:21:02 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: "Philipp G. Haselwarter" <philipp <at> haselwarter.org>
Cc: 64768 <at> debbugs.gnu.org
Subject: bug#64768: biblatex detection in reftex is too naive, multiple bib files are problematic
Date: Mon, 31 Jul 2023 09:40:03 +0200
"Philipp G. Haselwarter" <philipp <at> haselwarter.org> writes:

> In main.tex, I have the line "\input{mypreamble}", and in
> mypreamble.tex, there's a line with "\usepackage{biblatex}". I also
> have several "\addbibresource{foo.bib}", "\addbibresource{bar.bib}",
> etc, either in main.tex or in mypreamble.tex . I would want reftex to
> be aware of the references in foo.bib and bar.bib whenever main.tex is
> set as TeX-master, i.e. either while editing main.tex directly or
> while editing some-section.tex, where some-section.tex sets TeX-master
> to main.tex.

Thanks the clarification.  \addbibresource is a preamble only command
and AFAIU, RefTeX looks for this macro only in the main file; it doesn't
go through each \input'ed file in order to find any \addbibresource.

I'd suggest you change your setup a little and rename your
mypreamble.tex to mypreamble.sty and replace there:

  \usepackage{biblatex}

with

  \RequirePackage{biblatex}

and delete any \addbibresource calls.  Now you do this in your main.tex:

  \usepackage{mypreamble}
  \addbibresource{foo.bib}
  \addbibresource{bar.bib}

Now the final step is to write a small AUCTeX style file for your
mypreamble.sty called mypreamble.el which looks like this:

  (TeX-add-style-hook
   "mypreamble"
   (lambda ()
     (TeX-run-style-hooks "biblatex"))
   :latex)

and save this file in the directory specified in the variable
`TeX-style-private' (or adjust it accordingly first).

Now restart Emacs and open your main.tex.  AUCTeX should load
mypreamble.el and biblatex.el subsequently which gets an entry in
`TeX-active-styles' and you should be done.

Best, Arash




This bug report was last modified 1 year and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.