Discussion:
[Bug-AUCTeX] 24.3.1; RefTeX fails to find multiple bib files in \bibliography{} (with commas)
Michael McNeil Forbes
2013-05-02 05:31:37 UTC
Permalink
When specifying multiple .bib files in the \bibliography{} command,
reftex fails to recognize and read these. Thus, the following works,
seaching for master.bib:

\bibliography{master}

however, the following, which first uses a file local.bib, then the
master.bib, fails (giving a "Sorry, no matches found" error when trying
to add a citation)

\bibliography{local,master}

I suspect that the comma is causing a problem, but have not been
able to track down exactly what should be changed

Is there a workaround?

Thanks,
Michael.
-------------

Emacs : GNU Emacs 24.3.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 AppKit 1138.51)
of 2013-03-08 on atago.hsd1.ma.comcast.net
Package: 24.3.1

current state:
==============
(setq
window-system 'mac
reftex-plug-into-AUCTeX t
)
Tassilo Horn
2013-05-02 10:16:54 UTC
Permalink
Michael McNeil Forbes <***@gmail.com> writes:

Hi Michael,
Post by Michael McNeil Forbes
When specifying multiple .bib files in the \bibliography{} command,
reftex fails to recognize and read these. Thus, the following works,
\bibliography{master}
however, the following, which first uses a file local.bib, then the
master.bib, fails (giving a "Sorry, no matches found" error when
trying to add a citation)
\bibliography{local,master}
I suspect that the comma is causing a problem, but have not been
able to track down exactly what should be changed
I've just tried it with emacs 24.3 and this sample document:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
\bibliography{bib1,bib2}
\end{document}
--8<---------------cut here---------------end--------------->8---

The \bibliography command was inserted with C-c RET bibliography. After
that, C-c [ lists all entries from both bib files.
Post by Michael McNeil Forbes
Is there a workaround?
If you first had just \bibliography{bib2} and then add the other file
manually, reftex can't know that. To make it pick up the new file, just
run `TeX-normal-mode' (C-c C-n).

Bye,
Tassilo
Tassilo Horn
2013-05-02 10:35:00 UTC
Permalink
[Sorry for the duplicate, I've forgotton to add Michael in my previous
response.]

Hi Michael,
Post by Michael McNeil Forbes
When specifying multiple .bib files in the \bibliography{} command,
reftex fails to recognize and read these. Thus, the following works,
\bibliography{master}
however, the following, which first uses a file local.bib, then the
master.bib, fails (giving a "Sorry, no matches found" error when
trying to add a citation)
\bibliography{local,master}
I suspect that the comma is causing a problem, but have not been
able to track down exactly what should be changed
I've just tried it with emacs 24.3 and this sample document:

\documentclass{article}
\begin{document}
\bibliography{bib1,bib2}
\end{document}

The \bibliography command was inserted with C-c RET bibliography. After
that, C-c [ lists all entries from both bib files.
Post by Michael McNeil Forbes
Is there a workaround?
If you first had just \bibliography{bib2} and then add the other file
manually, reftex can't know that. To make it pick up the new file, just
run `TeX-normal-mode' (C-c C-n).

Bye,
Tassilo
Michael McNeil Forbes
2013-05-02 17:59:13 UTC
Permalink
Hi Tassilo,
Post by Tassilo Horn
\documentclass{article}
\begin{document}
\bibliography{bib1,bib2}
\end{document}
Thanks. This indeed works if both bib1.bib and bib2.bib are files in the
same directory or on the BIBINPUT path. Sorry: the comma was
a red herring.

What is actually failing is reftex finding a bibliography in the standard
user location:

~/Library/texmk/bibtex/bib/

on Mac OS X. (Not sure the exact place on other OS's. Maybe this
is a bug only on Mac OS X) Putting bib2.bib there works find for
bibtex (kpsewhich finds it without problem) but causes reftex to miss it.

In my previous case, I had bib2.bib (called master.bib in my example)
in this location, but had also specified the equivalent of

(setq reftex-default-bibliography '("~/Library/texmf/bibtex/bib/bib2.bib"))

With this set, \bibliography{bib2} works, but \bibliography{bib1,bib2} fails.
If this is not set, then using bib2 is simply not found.

Steps to reproduce:

1) Create the following bib files:

bib1.bib
~/Library/texmkf/bibtex/bib/bib2.bib

2) Try editing the following tex file:

\documentclass{article}
\begin{document}
\bibliography{bib2}
\end{document}

RefTeX is not finding bib2.bib, even though it is found by kpsewhich.

3) Add the following to emacs startup file:

(setq reftex-default-bibliography '("~/Library/texmf/bibtex/bib/bib2.bib"))

Now the RefTeX works with the previous document, but
\bibliography{bib1,bib2} fails to find information in bib2.bib.
(Somehow in this case, reftex-default-bibliography is not used).

I also tried setting the following, but it did not change any behaviour:

(setq reftex-external-file-finders
'(("tex" . "/usr/texbin/kpsewhich -format=.tex %f")
("bib" . "/usr/texbin/kpsewhich -format=.bib %f")))

Thanks,
Michael.
Post by Tassilo Horn
Post by Michael McNeil Forbes
Is there a workaround?
If you first had just \bibliography{bib2} and then add the other file
manually, reftex can't know that. To make it pick up the new file, just
run `TeX-normal-mode' (C-c C-n).
Bye,
Tassilo
Tassilo Horn
2013-05-02 19:23:01 UTC
Permalink
Michael McNeil Forbes <***@gmail.com> writes:

Hi Michael,
Post by Michael McNeil Forbes
What is actually failing is reftex finding a bibliography in the
~/Library/texmk/bibtex/bib/
^
Is that a typo? I guess it should be texmf.
Post by Michael McNeil Forbes
on Mac OS X.
Ok, I see. On GNU/Linux, the standard user location seems to be
~/texmf/bibtex/bib/. But reftex only looks into the current directory,
BIBINPUTS, and TEXBIB. I'd like not to hard-code paths that might be
configured differently.
Post by Michael McNeil Forbes
I also tried setting the following, but it did not change any
(setq reftex-external-file-finders
'(("tex" . "/usr/texbin/kpsewhich -format=.tex %f")
("bib" . "/usr/texbin/kpsewhich -format=.bib %f")))
That's the default value, isn't it?

Anyway, using external file finders works for me, but you also need to
set `reftex-use-external-file-finders'.

Bye,
Tassilo
Michael McNeil Forbes
2013-05-02 19:34:34 UTC
Permalink
Post by Tassilo Horn
Post by Michael McNeil Forbes
What is actually failing is reftex finding a bibliography in the
~/Library/texmk/bibtex/bib/
^
Is that a typo? I guess it should be texmf.
Yes: ~/Library/texmf/bibtex/bib/
Post by Tassilo Horn
Ok, I see. On GNU/Linux, the standard user location seems to be
~/texmf/bibtex/bib/. But reftex only looks into the current directory,
BIBINPUTS, and TEXBIB. I'd like not to hard-code paths that might be
configured differently.
I believe these are part of the texlive specs, so it is probably reasonable
to support hardcoded values for these but not others.
Post by Tassilo Horn
Post by Michael McNeil Forbes
I also tried setting the following, but it did not change any
(setq reftex-external-file-finders
'(("tex" . "/usr/texbin/kpsewhich -format=.tex %f")
("bib" . "/usr/texbin/kpsewhich -format=.bib %f")))
That's the default value, isn't it?
It seems like it.
Post by Tassilo Horn
Anyway, using external file finders works for me, but you also need to
set `reftex-use-external-file-finders'.
This is what I was missing. Everything works if I

(setq reftex-use-external-file-finders t)

so this is a viable (and reasonable) workaround. The only thing remaining that might be
a bug is that `reftex-default-bibliography` is ignored when multiple bib files are specified.

Thanks for your help… sorry for the quasi-domesticated goose chase:-)
Post by Tassilo Horn
Bye,
Tassilo
Tassilo Horn
2013-05-02 19:53:04 UTC
Permalink
Post by Michael McNeil Forbes
Post by Tassilo Horn
Anyway, using external file finders works for me, but you also need
to set `reftex-use-external-file-finders'.
This is what I was missing. Everything works if I
(setq reftex-use-external-file-finders t)
so this is a viable (and reasonable) workaround.
Great!
Post by Michael McNeil Forbes
The only thing remaining that might be a bug is that
`reftex-default-bibliography` is ignored when multiple bib files are
specified.
`reftex-default-bibliography' is only intended to be used in non-LaTeX
files, like for example to insert citations in emails with Gnus or
Rmail.
Post by Michael McNeil Forbes
Thanks for your help… sorry for the quasi-domesticated goose chase:-)
You're welcome.

Bye,
Tassilo

Loading...