The zref
package allows for an extention of the regular 2-part \label
-\ref
system into any number of properties/elements. The following MWE creates a new property list (called special
) and adds section
and equation
counters (in \arabic
format) to this list for referencing:

\documentclass[10pt,a4paper,fleqn]{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\usepackage{zref}% http://ctan.org/pkg/zref
\makeatletter
\zref@newlist{special}% Create a new property list called special
\zref@newprop{section}{\arabic{section}}% Section property holds \arabic{section}
\zref@addprop{special}{section}% Add a section property to special
\zref@newprop{equation}{\arabic{equation}}% Equation property holds \arabic{equation}
\zref@addprop{special}{equation}% Add an equation property to special
\newcommand*{\eqnref}[1]{\zref@extractdefault{#1}{equation}{??}}
\newcommand*{\secref}[1]{\zref@extractdefault{#1}{section}{??}}
\newcommand*{\spref}[2][section]{\zref@extractdefault{#2}{#1}{??}}
\newcommand*{\splabel}[1]{\zref@labelbylist{#1}{special}}%
\makeatother
\hypersetup{colorlinks}
\numberwithin{equation}{section}
\setlength{\parindent}{0pt}
\begin{document}
\section{Start}
\lipsum[1]
\section{Halfway}
The equation \eqref{ThisOne} is Equation~\eqnref{ThisOne} in Section~\secref{ThisOne}.
\section{End}
A famous formula:
\begin{equation}
x_1, x_2 = \frac{ -b \pm \sqrt{b^2 - 4ac} }{ 2a }
\end{equation}
And another one:
\begin{equation}
\sin^2(\varphi) + \cos^2(\varphi) = 1
\label{ThisOne}\splabel{ThisOne}
\end{equation}
\end{document}
zref
labels are set using \splabel
, while equations are referenced using \eqnref
and sections using \secref
. These are specific implementations of a more general \spref[<type>]{<refname>}
(where <type>
defaults to section
). Since the macros used are expandable, fmtcount
can also be used to provide ordinal references:
\usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
%...
\newcommand*{\eqnref}[1]{\ordinalnum{\zref@extractdefault{#1}{equation}{??}}}

Hyper-referencing is also possible, if needed.
With the addition of
\let\oldlabel\label
\renewcommand{\label}[1]{\oldlabel{#1}\splabel{#1}}%
in your preamble, you only have to use one \label
command to obtain the desired referencing output rather than \label
+ \splabel
.