[Tex/LaTex] Cross reference to align

aligncross-referencing

What I want to do is to make a cross reference to program (P) and still be able to make cross references to each separate line in the alignment.

\begin{align}
  (P)\quad \min &cx\label{objective}\\
  s.t.: & Ax\geq b\label{firstConst}\\
        & Dx\geq d\label{secondConst}\\
        & x\in\{0,1\}\label{binary}
 \end{aling}

I known that I can use gather-aligned to make a reference to the program, but then I do not have the possibility to make references to separate lines. Any suggestions?

Best Answer

You could use subequations to number the individual contraints, and tag the whole program with P. At least that is something I've seen in some books:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
  a = b
\end{equation}

\renewcommand{\theequation}{P}
\begin{subequations}\label{ip}
\renewcommand{\theequation}{\theparentequation.\arabic{equation}}
\begin{align}
  \min &\ cx\label{objective}\\
  \text{s.t.}\qquad Ax & \geq b\label{firstConst}\\
        Dx & \geq d\label{secondConst}\\
        x  & \in\{0,1\}\label{binary}
 \end{align}
\end{subequations}
\renewcommand{\theequation}{\arabic{equation}}
The binary program~\eqref{ip}, the objective~\eqref{objective}, the constraint~\eqref{firstConst}.

\begin{equation}
  c = d
\end{equation}
\end{document}

sample output

Related Question