1

I asked this question already on TeX.SE, but I think, it is more related to Emacs.SE.

I am using the latest Aquamacs on MacOS (and I am wondering why all these emacs-related questions are posted in tex.stackexchange.com and not in emacs.stackexchange.com).

I hope, I have configured my Emacs correct. At least, this are the related definitions in .emacs:

(setq reftex-extra-bindings t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(require 'bibtex)
(bibtex-set-dialect 'biblatex)
(setq LaTeX-biblatex-use-Biber t)
(setq TeX-command-BibTeX "Biber")
(setq reftex-bibliography-commands
      '("bibliography" "nobibliography" "addbibresource")) 
(setq reftex-bibpath-environment-variables
      '(".:~/lib/texmf/bibtex/bib//:/usr/local/texlive/texmf-local/bibtex/bib//:/usr/local/texlive/2018/texmf-dist/bibtex/bib//"))
; (reftex-use-external-file-finders t)
(setq reftex-external-file-finders
      '(("tex" . "kpsewhich -format=.tex %f")
    ("bib" . "kpsewhich -format=.bib %f")))

Emacs starts without complaint.

Next, I set up this MWE (just to be complete ...) as file test.tex:

\documentclass{scrbook}

\usepackage[T1]{fontenc}
\usepackage[backend=biber,style=numeric]{biblatex}

\addbibresource{computer.bib}

\begin{document}

% Waiting to insert \cite{} here

\end{document}

I added the line \addbibresource{computer.bib} in the usual way: C-cRET addbi TABRET. At this point, by pressing the TAB, Emacs completes the command to \addbibresource and inserts this LaTeX-command into the buffer, while still in the Minibuffer, I am asked for options. I skipped that question, by pressing RET again. Now Emacs asks (still in the minibuffer) for the bibliography file to use. I typed comTAB and Emacs again completed to the full filename computer.bib, which I inserted by RET.

I suspect, that Emacs knew about the existence of ~/lib/texmf/bibtex/bib/JB/computer.bib and therefore was able to complete its filename, because I defined reftex-bibpath-environment-variables (as seen above).

Emacs is also instructed to automatically scan the LaTeX files. Hence, at this moment the auto-generated file auto/test.el shows:

(TeX-add-style-hook
 "test"
 (lambda ()
   (TeX-add-to-alist 'LaTeX-provided-package-options
                     '(("fontenc" "T1") ("biblatex" "backend=biber" "style=numeric")))
   (add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
   (add-to-list 'LaTeX-verbatim-environments-local "minted")
   (add-to-list 'LaTeX-verbatim-environments-local "Verbatim")
   (add-to-list 'LaTeX-verbatim-environments-local "Verbatim*")
   (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim")
   (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim*")
   (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim")
   (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim*")
   (add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
   (add-to-list 'LaTeX-verbatim-environments-local "VerbatimOut")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
   (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url")
   (TeX-run-style-hooks
    "latex2e"
    "scrbook"
    "scrbook10"
    "fontenc"
    "biblatex")
   (LaTeX-add-bibliographies
    "computer"))
 :latex)

I am lucky, that the second last entry shows the correct bibliography file "computer". A quick test in the terminal/shell gives

<funnyprompt>:~$ kpsewhich bib computer.bib
/Users/tmjb/Library/texmf/bibtex/bib/JB/computer.bib
<funnyprompt>:~$ grep texstudio `kpsewhich bib computer.bib`
@Online{texstudio, 
                 url = {http://texstudio.sourceforge.net/manual/current/usermanual_en.html},

This should proof that the file exists and contains an entry with the desired key "texstudio".

Next I move the cursor beneath \begin{document} and start to insert the \cite-command (again in the usual way): C-cc (this is a shortcut for me, same as C-c[). While in the minibuffer, RefTeX asks me to insert the regular expression. I insert texstudio, which I happen to know to exist in that given bibliography file. After pressing RET Emacs complains Sorry, no matches found. The cursor leaves the Minibuffer and is still waiting in the main buffer, but no text is inserted, not even the already defined command \cite.

The *Message*-buffer says:

Making completion list...
   (?=Help)

Scanning bibliography database test.bib
Sorry, no matches found

Why the heck does Emacs want to scan test.bib? This file does not exist anywhere. Neither was it defined anywhere (including the LaTeX file nor the emacs configuration files)!

What did I miss in my configuration, to have Emacs scanning the bibliography file, it was able to complete its filename.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.