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.

It seems like whenever I use \label{an-label} inside the align environment, and then use to refer to it using \refeq{an-label}, I get the section number instead of the equation number. This does not happen when I use the equation environment.

For example:

\begin{align}
f(x) & = x^2 \label{label1}
\end{align}

Equation \refeq{label1}

would display the section number instead of the equation number. I use mathtools. Is there any reason for this to happen?

When looking in google, it is stated in some web page that \begin{align} \end{align} should be used with the \label{} to name an equation, so I am not sure what I am doing wrong.

share|improve this question

closed as too localized by Marco Daniel, Joseph Wright Aug 19 '12 at 9:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Please provide a minimum example. I cannot reproduce your problem on TeX-Live 2010. –  Willie Wong Nov 18 '10 at 22:51
    
what Willie said - please provide a MWE. I cannot reproduce your problem in MiKTeX 2.8 or MiKTeX 2.9. –  Geoffrey Jones Nov 19 '10 at 10:37
4  
The problem might be with \refeq try using \ref or \eqref instead. –  Seamus Jan 6 '11 at 12:37

2 Answers 2

I don't know why you're using the align environment for a single equation instead of the equation environment. Anyway, I've tried this code and it works fine:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{Section 1}
\label{sec1}
 This is section \ref{sec1}.
 \section{Section 2}
 \label{sec2}
 This is section \ref{sec2}
 \begin{equation}
 2+2=4
 \end{equation}
\begin{equation}
 3+3=6
 \end{equation}
 \begin{align}
 f(x)&=x^2 \label{ali1}
 \end{align}
 Take a look at equation \eqref{ali1}.
\end{document}

I've tried using the "mathtools" package instead of "amsmath" but I didn't found any problem... I don't realize what is really happening...

share|improve this answer
    
+1 to make the Community user happy –  Hendrik Vogt Jan 6 '11 at 12:37

I had the same issues like Stefan, however with "gather". Since I found the answer to his issue and also could reproduce the "wrong" referencing, I would like to share my findings with you.

It depends where you put the \label in your equation environment. Working example: In this example, you get the correct label for the one label that you assign to the equations.

\begin{gather}
\arraycolsep=3pt
\medmuskip = 1mu
{^{O}{\dot{\psi}(t)}} = \int^{t}_{0} \frac{{^{O}\V{\tau}_{G,z}}}{{^{B}{J}_{zz}}} dt + {^{O}{\dot{\psi}(t=0)}}, \nonumber \\
{^{O}{\psi(t)}} = \int^{t}_{0} (\int^{t}_{0} \frac{{^{O}\V{\tau}_{G,z}}}{{^{B}{J}_{zz}}} dt + {^{O}{\dot{\psi}(t=0)}}) dt \nonumber \\
\label{calcAngularPosVel} + {^{O}{\psi}(t=0)}, \\
{^{O}{\dot{\psi}(t)}} = {^{B}{\dot{\psi}(t)}}, {^{O}{\psi(t)}} = {^{B}{\psi(t)}}. \nonumber 
\end{gather}
\ref{calcAngularPosVel}

Example with "wrong" reference: In this example, you would get the labeling of the section, not for the equation, since the label tries to reference the last line of all equations provided in the gather environment. Hovewer, the last equation line does not provide a label, since the \nonumber command suppresses this. Thus, latex cannot reference to this equation.

\begin{gather}
\arraycolsep=3pt
\medmuskip = 1mu
{^{O}{\dot{\psi}(t)}} = \int^{t}_{0} \frac{{^{O}\V{\tau}_{G,z}}}{{^{B}{J}_{zz}}} dt + {^{O}{\dot{\psi}(t=0)}}, \nonumber \\
{^{O}{\psi(t)}} = \int^{t}_{0} (\int^{t}_{0} \frac{{^{O}\V{\tau}_{G,z}}}{{^{B}{J}_{zz}}} dt + {^{O}{\dot{\psi}(t=0)}}) dt \nonumber \\
+ {^{O}{\psi}(t=0)}, \\
{^{O}{\dot{\psi}(t)}} = {^{B}{\dot{\psi}(t)}}, {^{O}{\psi(t)}} = {^{B}{\psi(t)}}. \nonumber
\label{calcAngularPosVel}  
\end{gather}
\ref{calcAngularPosVel}

So it depends where you put the \label command if you want to reference the entire system of equations with only one reference.

Hope this is of help for anyone.

share|improve this answer
    
I don't think this answers the question, as the OP is using some \refeq command (perhaps from easyeqn) and no \nonumber command, as you do. You should better open a new question and provide a self-answer, if you think others may profit from it, as this one has been closed for a reason. –  canaaerus Sep 14 '12 at 5:59

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