# equation number problem

I'm relatively new to TeX/LaTeX, writing classroom notes. here's what I got:

$$\label{eqn:constantspeed} v=\frac{s}{t}$$

It is very important to remember that Equation \ref{eqn:constantspeed} only works for objects moving at \emph{constant speed}.


The pdf output has (3.1) as the number on the left side of the page where the equation is but in the text that follows, it shows "Equation 3". Please tell me what I'm doing wrong and how to make the numbers match. Thank you.

-
Please add to your question a complete minimal working example illustrating the problem. –  Gonzalo Medina Mar 25 '12 at 3:56
to reinforce Gonzalo's comment, different document classes handle the equation referencing in different ways. identifying the document class and relevant packages is absolutely essential to solving the problem. –  barbara beeton Mar 25 '12 at 13:20

The equation number is only 3.1, but the correct referring is (3.1), as you mention. To achieve this, we use \eqref{eqn:constantspeed} instead of \ref{eqn:constantspeed}. As well, in that case we usually omit the word Equation since the parentheses themselves stres that it's an equation reference.

-
I think the OP's main concern is the lack of congruence between the eqution's number as shown in the equation and as shown by \ref. –  Mico Mar 25 '12 at 6:24
Sorry, I misread the question, you're right. –  tohecz Mar 25 '12 at 15:53

Your example works fine in a standard \documentclass{book} environment. Just try

\documentclass{book}
\begin{document}
\chapter{}
\chapter{}
\chapter{}
$$\label{eqn:constantspeed} v=\frac{s}{t}$$
It is very important to remember that Equation \ref{eqn:constantspeed} only works for objects moving at \emph{constant speed}.
\end{document}


and you get Equation 3.1 as you want. This suggests that you have an old .aux file sitting around or you are including some other package in the preamble (before \begin{document}) that interferes with standard enumeration.

-
or some other document class than book –  barbara beeton Mar 25 '12 at 13:18

There are two things which I infer from your question:

• You want to have a reference like (1) and you do not mind typing Equation by yourself.

Solution: You can load amsmath or a better mathtools package and use Equation~\eqref{eqn:constantspeed}. This will produce Equation (1).

• You do not want to type Equation by yourself but want it to be added automatically. But the parenthesis () can be sacrificed.

Solution: You can load hyperref and use \autoref{eqn:constantspeed}. This will produce Equation 1.

The following MWE illustrates these examples.

% ----------------------------------------------------------------
% BookClass (This is a LaTeX2e document)  ***********************
% ----------------------------------------------------------------
\documentclass{book}
\usepackage{mathtools,hyperref}
%-----------------------------------
\begin{document}
\chapter{First chapter}
\chapter{Second chapter}
\chapter{Third chapter}
%-----------------------------------
$$\label{eq:constantspeed} v=\frac{s}{t}$$
%-----------------------------------
It is very important to remember that Equation~\eqref{eq:constantspeed} only works for   objects moving at \emph{constant speed}. This reference uses the \verb|\eqref{eq:constantspeed}| feature offered by \verb|amsmath| package.
\par
It is very important to remember that \autoref{eq:constantspeed} only works for objects moving at \emph{constant speed}. This reference uses the \verb|\autoref{eq:constantspeed}| feature offered by \verb|hyperref| package.
\end{document}
% ----------------------------------------------------------------


-