0

reftex-citep does not suggest any possible completions, even though the variable reftex-default-bibliography is set to the correct bibtex file.

What else do I need to do to get reftex to detect the bibtex entries?

Note: the same happens with the AuCTeX cite macro.

2
  • It seems that you might be a bit confused. reftex-default-bibiography isn't a variable but a function. I can't help you much, but please refer to reftex's manual by evaluating the following s-exp: (info "(reftex) Citations").
    – aadcg
    Nov 25 at 18:33
  • 2
    @aadcg: there is both a variable and a function named reftex-default-bibliography. The function returns the expanded value the variable. Presumably setting the variable is a necessary (but maybe not sufficient) condition for reftex to work.
    – NickD
    Nov 26 at 14:25
2

The doc for the reftex-default-bibliography variable says:

List of BibTeX database files which should be used if none are specified. When ‘reftex-citation’ is called from a document which has neither a ‘\bibliography{..}’ statement nor a ‘thebibliography’ environment, RefTeX will scan these files instead. Intended for using ‘reftex-citation’ in non-LaTeX files. The files will be searched along the BIBINPUTS or TEXBIB path.

Note that it is supposed to be a list of BibTeX database files. If you only have one, try saying

(setq reftex-default-bibliography '("/path/to/my/bibtex/file"))

EDIT: I downloaded Nelson Beebe's ACM Computing Surveys file from http://www.math.utah.edu/pub/tex/bib/compsurv.bib and added it to reftex-default-bibliography with:

(setq reftex-default-bibliography '("~/lib/bibtex/compsurv.bib"))

I put this in a file minimal.el.

In a brand new session of emacs (started with emacs -q -l minimal.el foo.tex), I enabled reftex with M-x reftex-mode, typed in Knuth and did M-x reftex-citep: that had Knuth filled in as the regexp value, so I just pressed RET. That gave me a *RefTex Select* buffer with four references, I did r SPG to restrict it to the single reference that contained the string SPG, typed a and I got this in the foo.tex buffer:

Knuth\cite{Knuth:1974:SPG}

I don't know much about RefTeX, but that seems to be all correct and working. If that's not what you did and/or expected, then maybe you can edit your question and add the exact behavior you expect and the exact behavior you get.

2
  • 1
    Thanks for your answer. But I was already aware that it needed to be a list, so I am already doing what you're saying.
    – Soap
    Nov 26 at 14:41
  • 1
    You should have added that detail (actually the explicit setting of the variable) to your question: that would prevent earnest but spurious answer attempts like mine :-) Anyway, this (setting a variable that is supposed to be a list to a non-list value) is a common mistake, so maybe it will help somebody in the future, even if it does not help you now.
    – NickD
    Nov 26 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.