Don't use such label names like 1.5
they are error-prone because the equation number changes (this is exactly the point of having easy to remember names instead of numbers)
I am using zref
to store the chapter as well and extract it afterwards with \moreref
(as a wrapper to \zref@extract
)
\eqref
does not work with zref
-labels, so either redefine \eqref
or provide a wrapper as well.
\documentclass{book}
\usepackage{amsmath}
\numberwithin{equation}{section}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\usepackage[user]{zref}
\makeatletter
\zref@newprop{chapter}{\thechapter}
\zref@addprop{main}{chapter}
\newcommand{\moreref}[1]{%
\zref@ifrefundefined{#1}{%
}{%
(equation \zref@extract{#1}{chapter},\zref{#1})%
}%
}
\newcommand{\zeqref}[1]{%
equation \zref{#1}%
}
\makeatother
\begin{document}
\chapter{Number One}
\chapter{Number Two}
\section{A section}
\begin{equation}
\zlabel{someequation}
a = b + c.
\end{equation}
In \moreref{someequation} or \zeqref{someequation}
\end{document}
Update with an ugly hack
Explanation: The \morelabel
command sets two labels, a fake one and the real one.
Since equation
(or rather: amsmath
does not allow two labels inside of equation
and redefines \label
I used the outside label definition for the fake label, which is stored in \@currentlabel
.
The \longref
command extracts the more::#1
label then.
\documentclass{book}
\usepackage{amsmath}
\numberwithin{equation}{section}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\makeatletter
\let\latex@@label\label
\newcommand{\morelabelformat}{%
(equation \thechapter,\theequation)%
}
\newcommand{\morelabel}[1]{%
\let\@oldcurrentlabel\@currentlabel%
\edef\@currentlabel{\morelabelformat}
\latex@@label{more::#1}%
\let\@currentlabel\@oldcurrentlabel
\label{#1}%
}
\newcommand{\longref}[1]{%
\@ifundefined{r@more::#1}{%
% Do nothing!
}{%
\ref{more::#1}%
}%
}
\makeatother
\begin{document}
\chapter{Number One}
\chapter{Number Two}
\section{A section}
\begin{equation}
\morelabel{someequation}
a = b + c.
\end{equation}
In \longref{someequation} or \eqref{someequation}
\end{document}

\label
as it is confusing for anyone looking at the source when those numbers are different from the printed number. – David Carlisle Feb 10 '17 at 17:34\label
is not a good solution, and I need time to time to perform a context replacement in order to keep those numbers equal to the printed ones. But when there are too many equations it becomes impossible to invent name for each one, and the only identity that I'm capable to remember about an equation is its number in specific section inside specific chapter. – Ilia Feb 10 '17 at 19:19