3

I have 2 equations. When I use \ref{} for the second equation, it gives the correct number but directs to the wrong place. How can I fix this? Thanks

\documentclass[12pt]{article}
\usepackage{amsmath}
\numberwithin{equation}{subsection}
\usepackage{hyperref}
\begin{document}
\section{Chapter 16}
\subsection{16.2}
\begin{equation}
\int_{C}f(x,y)ds=\int_{a}^{b}f\left(x(t),y(t)\right)\cdot |\vec{r}\,'(t)|\cdot dt
\label{2d}
\end{equation}
\subsection{16.3}
See \ref{2d}
\subsection{16.6}
\begin{equation}
|\vec{r}_x\times \vec{r}_y|=\sqrt{1+\left(\dfrac{\partial f}{\partial x}\right)^2+\left(\dfrac{\partial f}{\partial y}\right)^2} 
\label{area}
\end{equation}
\subsection{16.7}
See \ref{area}
\end{document}
4
  • 2
    Did you run latex twice?
    – Sigur
    Jul 31 '14 at 1:17
  • Welcome! Please provide a minimal example to facilitate the debugging. Sigur suggestion should sort it out!
    – anderstood
    Jul 31 '14 at 2:55
  • Looking at the aux file, both labels refer to equation.16.1, ignoring the subsection number. Not sure how to fix it yet. Jul 31 '14 at 3:34
  • It's not \theequation, and \subsection definitely calls \refstepcounter. Jul 31 '14 at 4:21
7

Put your \numberwithin{equation}{subsection} line after \usepackage{hyperref}. Apparently there is a conflict between amsmath and hyperref.

A very similar situation is described here: Hyperlinking problems when using subequations, hyperref and cleveref

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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