# equation labels for reference

How can I reference to the equations in the alignat? The equation set is

\begin{alignat}{2}
\sigma_1 &= x + y  &\quad \sigma_2 &= \frac{x}{y} \\
\sigma_1' &= \frac{\partial x + y}{\partial x} & \sigma_2'
&= \frac{\partial \frac{x}{y}}{\partial x}
\end{alignat}


Now in my text I want to refer like this

As you can see, \ref{equation1} is above \ref{equation2}!

• Add a unique \label{} to each line of the equation. – Steven B. Segletes Dec 20 '14 at 19:35
• qnd you may want to use \eqref instead of just \ref. – barbara beeton Dec 20 '14 at 20:11

We would use \label{labelname} on a line (before the \\ command) to label a particular line. It is conventional to use the \eqref command in order to automatically wrap the reference with parentheses.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsthm,amssymb,mathtools}

\begin{document}

\begin{alignat}{2}
\sigma_1 &= x + y  &\quad \sigma_2 &= \frac{x}{y} \label{equation1}\\
\sigma_1' &= \frac{\partial x + y}{\partial x} & \sigma_2'
&= \frac{\partial \frac{x}{y}}{\partial x} \label{equation2}
\end{alignat}

As you can see, \eqref{equation1} is above \eqref{equation2}!
\end{document}


Since labels are not 'typed', it is also conventional to precede the label by eq: in order to indicate the label is an equation label. For example, we would use \label{eq:equation1} and \eqref{eq:equation1} or something to that effect.