Suppose you want to make figures not directly with the figure environment, but with a macro like
\newcommand{\myfig}[5][tbp]{% \begin{figure}[#1] \epsimp[#5]{#2} \caption{#3} \label{#4} \end{figure}}
which would be called like
\myfig[htp]{filename}{caption text}{label}{1}
Now we need to tell RefTeX that the fourth argument of the
\myfig
macro is itself a figure label, and where to find
the context.
(setq reftex-label-alist '(("\\myfig[]{}{}{*}{}" ?f nil nil 3)))
The empty pairs of brackets indicate the different arguments of the
\myfig
macro. The ‘*’ marks the label argument. ?f
indicates that this is a figure label which will be listed together with
labels from normal figure environments. The nil
entries for
prefix and reference format mean to use the defaults for figure labels.
The ‘3’ for the context method means to grab the third macro argument:
the caption.
As a side effect of this configuration, reftex-label
will now
insert the required naked label (without the \label
macro) when
point is directly after the opening parenthesis of a \myfig
macro
argument.
Again, here the configuration in the customization buffer:
[INS] [DEL] Package or Detailed : [Value Menu] Detailed: Environment or \macro : [Value Menu] String: \myfig[]{}{}{*}{} Type specification : [Value Menu] Char : f Label prefix string : [Value Menu] Default Label reference format: [Value Menu] Default Context method : [Value Menu] Macro arg nr: 3 Magic words: [INS] [ ] Make TOC entry : [Value Menu] No entry