1

I'm using AUCTeX along with RefTeX in Emacs 25.1.1. My question is how to make AUCTeX to compile Bibliography without having to explicitly provide \bibliographystyle and \bibliography in every file.

For example, I have the following options enabled in .emacs

(require 'reftex)
(setq reftex-mode t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq reftex-default-bibliography '("/path-to/refLib.bib"))

And as expected when I perform C-c [ RefTeX is able to identify and insert citations. So here is an example of a simple LaTeX file file1.tex one citation from the RefTeX default bib file.

\documentclass[12pt]{article}
\usepackage{hyperref}
\tolerance=1000
\usepackage[margin=1in]{geometry}
\usepackage{enumitem}
\setlist[enumerate,itemize]{noitemsep,nolistsep,leftmargin=*}
\date{}
\title{Testing Bib}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 25.1.1 (Org mode 8.2.10)}}
\begin{document}

\maketitle
\section{Testing Bib Once}
\label{sec-1}
SCHEDULED \textit{<2017-03-31 Fri 11:03>}
\subsection{Modeling Updates}
\label{sec-1-1}
\begin{itemize}
This is a bibliography test \cite{hohenberg_inhomogeneous_1964}
\end{itemize}
% Emacs 25.1.1 (Org mode 8.2.10)
\end{document}

LaTeX compiles through C-c C-c LaTeX. However when I perform C-c C-c BibTeX it throws me an error as follows

I found no \bibdata command---while reading file file1.aux
I found no \bibstyle command---while reading file file1.aux

When AUCTeX+RefTeX are able to find citations to insert, I'm not sure what is the issue in compiling without explicitly specifying the BiBTeX file.

1

RefTeX manual says:

User Option: reftex-default-bibliography

List of BibTeX database files which should be used if none are specified. When reftex-citation is called from a document with 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.

I think you're abusing this variable since it is intended for non-LaTeX files. You could try to pass the information to compiler at command line with a file local variable like:

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-command-extra-options: "do-something-in-document"
%%% End:

I'm not sure if it is worth the effort, though.

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.