Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to label equations in a alignat-environment which is embedded in a figure-environment and it won't compile. Example:

\documentclass[11pt,a4paper,twoside,openright]{book}

\usepackage{amsmath}

\begin{document}
 \begin{figure}
  \begin{alignat*}{2}
   a & = b  &  c & = d \\ \label{eq:1}
   e & = f  &  g & = h \\ \label{eq:2}
  \end{alignat*}
\caption{Equalities}
 \end{figure}

\end{document}

Error message:

! Package amsmath Error: Multiple \label's: label 'eq:1' will be lost.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.11   \end{alignat*}

Has anybody an idea how I can set the labels?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The \label commands work, if they are used in a numbered equation environment. Also they should put in the right lines:

\documentclass[11pt,a4paper,twoside,openright]{book}

\usepackage{amsmath}

\begin{document}
 \begin{figure}
  \begin{alignat}{2}
   a & = b  &  c & = d \label{eq:1}\\
   e & = f  &  g & = h \label{eq:2}
  \end{alignat}
\caption{Equalities}
 \end{figure}

\end{document}
share|improve this answer
    
Ups. Thank you. –  Jana Sep 9 '12 at 9:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.