How can I open the equation selection buffer in RefTeX automatically when entering \eqref
in Emacs? I have the following line in my .emacs
file
(setq reftex-label-alist '((nil ?e nil "~\\eqref{%s}" nil nil)))
But this does not seem to work as I hoped
(http://www.gnu.org/software/emacs/manual/html_node/reftex)..
Now, entering \eqref
and then pressing enter, will just insert an empty
\eqref{}
into the buffer. What I would like to happen is the equation selection buffer in RefTeX to be opened, after which I will be able to choose the label to reference from that buffer..
(Note that entering \ref
(not \eqref
) works as expected, that is, first I get a question: "Label type: [ efinNst]" and after having chosen the type, the selection buffer is opened)
I am using GNU Emacs version 23.3.1 on Ubuntu 12.04.
My .emacs
init file is
(setq TeX-electric-escape t)
(setq reftex-label-alist '((nil ?e nil "~\\eqref{%s}" nil nil)))
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
Consider the sample file t.tex
\documentclass{amsart}
\begin{document}
\begin{align}
\label{eq:1}
1+1=2
\end{align}
\end{document}
Running emacs t.tex
produces the following in the Emacs message buffer:
Loading 00debian-vars...done
Loading /etc/emacs23/site-start.d/50auctex.el (source)...
Loading /usr/share/emacs/23.3/site-lisp/auctex.el (source)...done
Loading /usr/share/emacs/23.3/site-lisp/preview-latex.el (source)...done
Loading /etc/emacs23/site-start.d/50auctex.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...
Loading cjk-enc...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done
Loading /etc/emacs/site-start.d/50lilypond-data.el (source)...done
Loading /etc/emacs/site-start.d/50magit.el (source)...done
Loading /etc/emacs/site-start.d/50octave3.2-emacsen.el (source)...done
Loading /etc/emacs/site-start.d/50org-mode.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50thailatex.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Automatic display of crossref information was turned on
Applying style hooks... done
Sorting environment...
Removing duplicates... done
Best Answer
In order to override possible other
eqref
macro definitions, you should add a dummy(ignore)
to the definition of the macro. This code, in your.emacs
, does the trick: