[Tex/LaTex] Numbering an equation when using \displaymath

labelsmath-mode

I am using the hyperref package and want to label a piecewise equation. However, I only know how to use \displaymath to do a piecewise equation and the \label doesn't put a number next to the equation. Any suggestions?

\documentclass[12pt]{amsart}

\usepackage{amsfonts,amssymb,amsmath,graphicx,hyperref}



\begin{document}


\begin{displaymath} \label{eq:torus}
   A_{T(p,q)}(z,w)  = \left\{
     \begin{array}{ll}
       w(w+2qz - \frac{1}{2}) & : p =2, q>2 \\
\\
       w(w + pqz - \frac{1}{2})(w+pqz) & : p,q > 2 
     \end{array}
   \right.
\end{displaymath}

\end{document}

Best Answer

The displaymath environment does not provide an equation number:

\begin{displaymath} \label{somelabel} 

will use the last counter being used in the \refstepcounter call and this is certainly not what is wanted here.

To get the labels it is necessary to use a numbering math environment, e.g. equation or align and then use the \begin{cases}...\end{cases} environment for the specific setup of a piecewise function.

\documentclass[12pt]{amsart}

\usepackage{amsfonts,amssymb,amsmath,graphicx,hyperref}

\begin{document}


%\begin{displaymath}  \label{eq:torus}
 %
%A_{T(p,q)}(z,w) = \left\{
%     \begin{array}{ll}
%       w(w+2qz - \frac{1}{2}) & : p =2, q>2 \\
%\\
%       w(w + pqz - \frac{1}{2})(w+pqz) & : p,q > 2 
%     \end{array}
%   \right.
%
%\end{displaymath}


\begin{equation}
  A_{T(p,q)}(z,w) = \begin{cases}
    w(w+2qz - \frac{1}{2}) & : p =2, q>2 \\
    w(w + pqz - \frac{1}{2})(w+pqz) & : p,q > 2  
  \end{cases} \label{eq:torus}
\end{equation}

\end{document}

enter image description here

Related Question