# All \ref{} to an equation refer to the section, not to the labeled equation [closed]

I am writing a document in LaTeX using TeXShop on OS X Mavericks. My .tex file looks like this:

\documentclass[11pt,titlepage]{article}
\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=3.0cm]{geometry}
\newcommand{\agfauthor}[1]{%
\begin{center}by #1\end{center}}
\newenvironment{Abstract}{\begin{center}\textbf{Abstract}\end{center}%
\begin{quote}}{\end{quote}}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{url}
\usepackage{graphicx}
\usepackage[margin=35pt,labelfont=bf,textfont=it]{caption}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{float}
\usepackage{subfig}
\usepackage{epstopdf}
\usepackage{booktabs}
\setlength\parindent{1cm}
\usepackage{enumerate}
\usepackage{parskip}
\usepackage{siunitx}

% To get slash frac to scale to font size.
\newcommand{\slfrac}[2]{\left.#1\middle/#2\right.}

% Give figures number after section, not cumulative number
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{equation}{section}

\usepackage[style=authoryear,backend=biber,natbib=true]{biblatex}

\begin{document}
Hello

1+1=2

\end{document}
\label{equation}
(I just added an example to what I originally did for others to see)


I was just made aware of an annoying error. When I label an equation and refer to it (using \label and \ref), the reference in the .pdf text is the number of the section or subsection, not that of the equation in question.

It is starting to get really annoying and I have never had this problem before. I have also tried to delete all .aux files etc. but it didn't help.

Does anyone have any idea on how to fix this or know what the problem is?

-

## closed as off-topic by Christoph, Torbjørn T., tohecz, Werner, SperavirMar 2 at 0:24

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Is the problem remain if you comment both \counterwithin? –  Sigur Oct 31 '13 at 18:46
your example code doesn't seem to have a example of the problem, it has no equation or ref commands, please edit the code to show the problem. –  David Carlisle Oct 31 '13 at 19:30
Are you using $$\label{Alabel}<equation>$$ or perhaps the \label is after ? –  egreg Oct 31 '13 at 21:04
I imagine you've added the label in the wrong place- without a complete MWE to demonstrate the problem, it'll be hard to tell, though :) –  cmhughes Nov 1 '13 at 3:27
This question appears to be off-topic because it is too localized, the \label was behind the . –  Christoph Mar 1 at 23:56
show 1 more comment