[Tex/LaTex] RefTeX won’t find the .bib file in local library tree

auctexbiberbiblatexemacsreftex

RefTeX gives out the following error when trying to insert a citation:

  No valid bibliography in this document, and no default available

I keep a master .bib file in ~/Library/texmf/bibtex/bib/master_bib.bib. Biblatex-biber recognize the file when I run it, so a bibliography is generated. The problem is that RefTeX does not recognize the file and yields the above error. I have also placed the .bib file in the same directory as the .tex file, with the same results.

This post seemed promising https://tex.stackexchange.com/questions/23780/reftex-wont-detect-my-bib-file but that one self-resolved automagically.

The RefTeX manual (p.20) says that

If you do not use BibTEX, but the document contains an explicit
thebibliography environment, RefTEX will collect its information from
there.

however, I don't see where or how I could include this.

How can I get this to work?

Here's a MWE:

\documentclass{article}

\usepackage[
    backend=biber, 
    style=authoryear, 
    maxcitenames=2, 
    sorting=nyt,
    backref=true
    ]{biblatex}
    \addbibresource{master_bib.bib}

\begin{document}
    Some text. \parencite{Mays:2005, Chow:1998}

\printbibliography
\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: xetex
%%% End:

I'm running Emacs 24, with AUCTeX 11.86, TeX Live 2011 from MacTeX.

Best Answer

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 variable reftex-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.