# Equation number referral doesn't appear within the empheq/array environment?

Why doesn't the equation number referral appear within the empheq/array environment ? In this example I left out the formulas within the empheq environment (the problem remains with the formulas added).

\documentclass{article}
\usepackage{amsmath}
\usepackage{empheq}

\begin{document}

\begin{empheq}{align}
\label{eq:1}
\left\{\!\!\begin{array}{l}
\text{An equation reference should appear after the question mark, but doesn't ? \eqref{eq:2}}\\
\text{This doesn't work either : \eqref{eq:2}}
\end{array}\right.
\end{empheq}

I can definitely refer to the equation though, like this : \eqref{eq:2}.

\begin{empheq}{align}
\label{eq:2}
1+1=2
\end{empheq}

It compiles without throwing an error.

\end{document}

-
You need to compile the document twice. First time a (??) is displayed, upon subsequent run, the equation number will appear. –  Peter Grill Nov 7 '12 at 20:22
I did - makes no difference. –  Petoetje59 Nov 7 '12 at 20:24
Nothing is displayed, not even the (??). –  Petoetje59 Nov 7 '12 at 20:25
And do not remove the temporary files generated during the first run. –  Peter Grill Nov 7 '12 at 20:25
I didn't remove anything, as I said, it doesn't throw up any error, but does not work. –  Petoetje59 Nov 7 '12 at 20:26

The problem goes away if you use (\ref{whatever}) in place of \eqref{whatever}. I have no idea why this happens, though.

-
Works, but does not retain the brackets, but these can be added separately. THX. –  Petoetje59 Nov 7 '12 at 21:13

The main problem is that empheq redefines \maketag@@@ because it need to separate the display from the eqn numbers. But \eqref also make use of this macro to typeset the reference to an eqn numbers. The fix below seem to do the trick and will be build into the next empheq release

\makeatletter
\MHInternalSyntaxOn
\renewenvironment{empheq}[2][]{%
\let\savedmaketag\maketag@@@
\renewcommand\eqref[1]{\textup{%
\let\maketag@@@\savedmaketag%
\tagform@{\ref{##1}}}%
}
\setkeys{EmphEqEnv}{#2}\setkeys{\EQ_options_name:}{#1}%
\EmphEqMainEnv}{\endEmphEqMainEnv}
\MHInternalSyntaxOff
\makeatother

-