3.4.2 Quick Equation Macro

Suppose you would like to have a macro for quick equations. It could be defined like this:

\newcommand{\quickeq}[1]{\begin{equation} #1 \end{equation}}

and used like this:

Einstein's equation is \quickeq{E=mc^2 \label{eq:einstein}}.

We need to tell RefTeX that any label defined in the argument of the \quickeq is an equation label. Here is how to do this with lisp:

(setq reftex-label-alist '(("\\quickeq{}" ?e nil nil 1 nil)))

The first element in this list is now the macro with empty braces as an image of the macro arguments. ?e indicates that this is an equation label, the different nil elements indicate to use the default values for equations. The ‘1’ as the fifth element indicates that the context of the label definition should be the first argument of the macro.

Here is again how this would look in the customization buffer:

Reftex Label Alist: [Hide]
[INS] [DEL] Package or Detailed   : [Value Menu] Detailed:
            Environment or \macro : [Value Menu] String: \quickeq{}
            Type specification    : [Value Menu] Char  : e
            Label prefix string   : [Value Menu] Default
            Label reference format: [Value Menu] Default
            Context method        : [Value Menu] Macro arg nr: 1
            Magic words:
              [INS]
            [ ] Make TOC entry    : [Value Menu] No entry