# Using \eqref with RefTeX

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)))
(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
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

• If you use AUCTeX C-c ) e does the trick, without even writing \eqref. – giordano Jun 11 '13 at 10:40
• Yes that works fine.. Thank you! (Is it possible to get the other method (in my question) also to work?) – Håkon Hægland Jun 11 '13 at 10:42
• I don't know, on my Emacs that works as you expect. You should give more information about your configuration. – giordano Jun 11 '13 at 10:45
• I see.. I updated my question with information about my configuration.. – Håkon Hægland Jun 11 '13 at 10:50
• Just to understand: C-c ) e works but C-c C-m eqref RET doesn't word? Is C-c C-m eqref RET at least able to autocomplete with known citation keys? – giordano Jun 11 '13 at 12:20

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:
(add-hook 'LaTeX-mode-hook