RefTeX won't find my .bib file in local library tree
There are two ways to make RefTeX find your bibliography. I suggest to use both approaches for robustness.
To make RefTeX recognize your bibliography you can add it to the list
reftex-default-bibliography
. To do this add the following to your .emacs:;; So that RefTeX finds my bibliography (setq reftex-default-bibliography '("path/to/bibfile.bib"))
and replace
path/to/bibfile.bib
with the path to your bib file. Note that it is a list so that it can contain several paths if you want to point it to several bibliographies. This approach is good for accessing your .bib file via RefTeX in Org-mode.Another way to make RefTeX recognize the bibliography in
\addbibresource
you can add it to the variablereftex-bibliography-commands
by adding the following to your .emacs:;; So that RefTeX also recognizes \addbibresource. Note that you ;; can't use $HOME in path for \addbibresource but that "~" ;; works. (setq reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource"))
Both variables are documented in the manual.
Adding
%%% reftex-default-bibliography: ("path/to/bibfile.bib")
at the end of my file with other commands related to the file looks better to me.
I solved this problem by inserting '(reftex-use-external-file-finders t)
into my emacs init file.
It makes RefTeX use the appropriate command from reftex-external-file-finders
to find the file. In my case that is kpsewhich -format=.bib %f
.
The default is looking in the folders specified in the environment variables BIBINPUT
and TEXINPUT
.
I prefer this variant mainly because I expect that emacs and latex will use the same method for determining what bib file to use. It also feels more flexible, as you do not need to modify it if you create another central biblography.