all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arash Esbati <arash@gnu.org>
To: "Philipp G. Haselwarter" <philipp@haselwarter.org>
Cc: 64768@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	[thread overview]
Message-ID: <861qgoy1f0.fsf@gnu.org> (raw)
In-Reply-To: <CALNu-QWOJnCAxYPvop439CXbfi_Sweh+CW=P3A0QTNfwmS-2Qw@mail.gmail.com> (Philipp G. Haselwarter's message of "Fri, 28 Jul 2023 11:58:32 +0200")

"Philipp G. Haselwarter" <philipp@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





  reply	other threads:[~2023-07-31  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 12:19 bug#64768: biblatex detection in reftex is too naive, multiple bib files are problematic Philipp G. Haselwarter
2023-07-27 19:10 ` Arash Esbati
2023-07-28  9:58   ` Philipp G. Haselwarter
2023-07-31  7:40     ` Arash Esbati [this message]
2023-08-31 20:24       ` Arash Esbati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861qgoy1f0.fsf@gnu.org \
    --to=arash@gnu.org \
    --cc=64768@debbugs.gnu.org \
    --cc=philipp@haselwarter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.