1

Today I encountered a problem getting a cross-reference of one of my equation inside the empheq package.

I use the gather environment inside my empheq equation and would like to label both equation and get a cross-reference of my equation (2). The usual way with label does not work and the package documentation does not provide a satisfying answer either. Is it possible to achieve this cross-reference?

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{empheq}
\usepackage{xcolor}

\newcommand*{\p}{\partial}

\begin{document}

\begin{empheq}[box = \fcolorbox{black}{white}]{gather}\label{eq:CE1}
    \frac{\p}{\p t}\int\limits_{V(t)} \rho \,\mathrm{d}V + \int\limits_{\p V(t)}\rho \mathbf{u} \cdot \mathrm{d}\mathbf{S} = 0 \\
    \frac{\p \rho}{\p t} + \nabla \cdot \left(\rho \mathbf{u}\right) = 0
\end{empheq}

For incompressible flows, the equation \eqref{eq:CE1} simplifies to
\begin{equation}\label{eq:CE2}
    \mathbf{\nabla} \cdot \mathbf{u} = 0
\end{equation}

\end{document}
  • 2
    try \label{eq:CE1} after \\ of first equation – touhami Mar 18 '16 at 17:16
  • Sweet, worked fine. Haven't thought about that. :) thank you – montju Mar 18 '16 at 17:18
  • @touhami, please convert your comment to an answer or suggest to close it as solved by comment. – Zarko Mar 18 '16 at 17:26
  • @Zarko It's left to the OP to dicide. – touhami Mar 18 '16 at 17:30
  • I'm happy with the answer - you can close the question if touhami is not converting his comment to an answer :) – montju Mar 18 '16 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.