This might be what you're after, using a counter that increments at every use and resets at the start of every \section
in your document. This can be modified, of course:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{chngcntr}% http://ctan.org/pkg/chngcntr
\newcounter{numrel}% Counter for numering relations
\counterwithin*{numrel}{section}% Counter resets at every section
\newcommand{\numrel}[1]{% Relation numbering
\stepcounter{numrel}% Increment numrel counter
\overset{(\roman{numrel})}{#1}% Print counter + relation
}
\begin{document}
\section{First section}
\begin{align*}
P(x) &= ax^2+bx+c \\
&\overset{(i)}{\leq} cx^3+dx^2+ex+f \\
&\overset{(ii)}{<} gx^4+hx^3+ix^2+jx+k
\end{align*}
\section{Second section}
\begin{align*}
P(x) &= ax^2+bx+c \\
&\numrel{\leq} cx^3+dx^2+ex+f \\
&\numrel{<} gx^4+hx^3+ix^2+jx+k
\end{align*}
\end{document}

In the example above, the first section uses \overset
while the second uses the newly defined \numrel
command, to show the similarities. It would also be possible to modify the code to accommodate for using references so that your document text will change according to the change of adding/removing a line in your equation. The chngcntr
package was used for more flexibility in formatting the counter resetting.
In order to accommodate the possibility to reference the counter within your text, here's a modified minimal example that uses the etoolbox
package to reset the counter at the end of the align*
environment, as well as some amsmath
counter manipulation using Multiply defined labels using hyperref. It uses two counters, the global counter to produce unique reference hooks (important for hyperref
), and a local counter which is actually displayed and reset for each equation. The \numrel{<rel>}{<lab>}
now takes two mandatory arguments. The first is the relation <rel>
while the second is the label <lab>
that may be referenced elsewhere:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage{hyperref}% https://ctan.org/pkg/hyperref
\newcounter{numrellocal}% Local counter for numering relations
\renewcommand{\thenumrellocal}{\roman{numrellocal}}% Counter numrellocal uses lowercase roman numerals
\newcounter{numrelglobal}% Global counter for numering relations
\renewcommand{\thenumrelglobal}{\roman{numrellocal}}% Counter numrelglobal uses lowercase roman numerals, but results in value from numrellocal
\makeatletter
\newcommand{\numrel}[2]{% Relation numbering
\stepcounter{numrellocal}% Increment local counter
\refstepcounter{numrelglobal}% Increment global counter and create correct reference hook, with label-text from local counter
\ltx@label{#2}% Label numrel counter
\overset{(\thenumrellocal)}{#1}% Print counter + relation
}
\makeatother
\AfterEndEnvironment{align*}{\setcounter{numrellocal}{0}}% Resets numrellocal at the end of align*
\begin{document}
\section{First section}
\begin{align*}
P(x) &= ax^2+bx+c \\
&\stackrel{(i)}{\leq} cx^3+dx^2+ex+f \\
&\stackrel{(ii)}{<} gx^4+hx^3+ix^2+jx+k
\end{align*}
\section{Second section}
\begin{align*}
P(x) &= ax^2+bx+c \\
&\numrel{\leq}{rel1} cx^3+dx^2+ex+f \\
&\numrel{<}{rel2} gx^4+hx^3+ix^2+jx+k
\end{align*}
If you look at (\ref{rel1}), you will notice it is different from (\ref{rel2}).
\begin{align*}
P(x) &= ax^2+bx+c \\
&\numrel{\leq}{rel3} cx^3+dx^2+ex+f \\
&\numrel{<}{rel4} gx^4+hx^3+ix^2+jx+k
\end{align*}
If you look at (\ref{rel3}), you will notice it is different from (\ref{rel4}).
\end{document}
