Getting LaTeX empheq to play along with Emacs' RefTeX and Preview modes

empheq is a LaTeX meta-environment for emphasizing equation-like environments with boxes and stuff. All funky – but by now, I am so spoiled by my Emacs/AUCTeX/Preview/RefTeX setup that I can’t work without it. Turns out the hacking is quick and not bloody at all:

Getting empheq to work with PreviewLaTeX

Just put this in you document preamble (thanks to David Kamstrup) ``

\usepackage[displaymath,floats,graphics,textmath]{preview}
\PreviewEnvironment[{[]{}}]{empheq}

Getting empheq to work with RefTeX

You basically need to put a term in reftex-label-alist. It is perhaps explained in the RefTeX manual, but I found this XEmacs page a few hundred times more readable. The upshot is to put this line in your .emacs: ``

(setq reftex-label-alist (quote (("empheq" ?e "eq:" nil nil nil))))

or put something to similar effect in the customization group.