15

I would like to know how can I get the suggestion when I do a \cite in Emacs-AUCTeX. The minibuffer tells me when I do C-c [ that:

No valid bibliography in this document, and no default available

So how can I set this default? I have a separated file with my bibtex references that is called by a master document, and I want the suggestion for any of the other files included.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mjsr
  • 7,410
  • 18
  • 57
  • 83
  • i dont have problem in the master document because it contains \bibliography command, but the child files don't see it. The Tex-Mater file variable that i define for the references its useless with citations – mjsr Apr 23 '10 at 13:55

5 Answers5

16

Have you tried: Ref -> Parse Dokument -> Entire Document? That solved the problem for me.

fabianfuchs
  • 105
  • 4
Judith
  • 161
  • 1
  • 3
4

The variable reftex-default-bibliography is what defines the default bibliography to use. I don't do much with mult-file documents, do you have reftex-plug-into-AUCTeX turned on?

Ivan Andrus
  • 5,221
  • 24
  • 31
  • yes that is the variable that i need it to modify. I wrote an answer with the details of how i do it, because for "size" i couldn't put it here like a comment. – mjsr Apr 23 '10 at 19:02
4

Yes, modifying this variable is a solution (I don't know if it is the "best solution"). I go to the ref menu -> Customize -> Browse Reftex Group -> Reftex Citacion Support -> Reftex Default Bibliography and then I add the path to the bib file (without the .bib extension) and it works!! These options create this in the init file:

(custom-set-variables

 '(reftex-default-bibliography (quote ("D:/mybibdirectory/mybibfile"))))
(custom-set-faces

 )

Well, perhaps that it works now that suggestions are going to appear in every document that I write. It would be good have a solution only for this document.

Reading the help file of reftex (reftex->finding files) also mentions make the next modifications in order to get the suggestions:

(setq reftex-bibpath-environment-variables
                '("D:/mybibdirectory/"))
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mjsr
  • 7,410
  • 18
  • 57
  • 83
  • 2
    You can use `add-file-local-variable` to set this (or any other variable) for the a single file. Something like `M-x add-file-local-variable RET reftex-default-bibliography RET ("D:/mybibdirectory/mybibfile") RET` should work. When you open the file next time it will ask if it should set those variables, and you can then mark them as permanently okay to use without prompting. – Ivan Andrus Jan 12 '12 at 00:21
2

You may also try the solution mentioned in Re: auctex - no valid bibliography?. It worked for me.

(It might help to check whether you have kpsewhich installed, before attempting to use this fix. The following command should output its path if you do have it installed:

$ which kpsewhich

)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sankalp
  • 499
  • 7
  • 4
0

When in the buffer of your non-master file, try to query for the name of a master file (again) with C-c _ (Control C + underscore) as explained in auctex manual

This will add the local variable TeX-master to the end of your file. Save your file, restart emacs and load your file again. Hopefully, you can now get references from the bibliography stated in your master file by calling C-c [ in the subfile.

Mysteriously, when I do this manually without letting auctex query for it, it does not work. I cannot see how the end result is different in the auto directory either. But somehow letting auctex query for the value made it work for me.

Tony
  • 542
  • 1
  • 4
  • 6
  • I do have the same problem as @mjsr, even being in the master buffer. And even if the TeX file and BibTeX file do have completely different names. Resetting the RefTeX system (`M-x reftex-reset-mode`) is the fastest cure to me. – Jan Nov 21 '18 at 16:11