[Tex/LaTex] Custom equation numbering

equationsnumbering

I want to label an equation

\[ 1 + 2 + \cdots + i = \frac{i(i+1)}{2} \eqname{Inequality(i)} \label{ineq} \]

involving the variable "i" as a function of (i) so the expected output looks like

[LaTeX rendering of the above equation] (2.4)(i)

(which actually means there are "i" such equations). The (2.4) might refer to Equation 4 of Section 2. When I access the equation later, I would like it to appear as

Since Equation (2.4)(n+1) follows from Equation (2.4)(n), use induction…

(EDIT: Improved the wording to clarify the questions in comments. )

Best Answer

Let’s see if I guessed correctly what you wish to get:

Output of the following code

This output was generated by the following code:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}

\numberwithin{equation}{section}

\newcommand*{\myTagFormat}[2]{(\ref{#1})($#2$)}



\begin{document}

\section{First}

Just to include a couple of equations:
\begin{align}
      1 &= 1 \label{eq:one} \\
    1+2 &= 3 \label{eq:two}
\end{align}
Until now, we have equations \eqref{eq:one} and~\eqref{eq:two}.

\section{Second}

Still another equation of the same form:
\begin{equation}
    1+2+3 = 6 \label{eq:three}
\end{equation}
Generalizing equations \eqref{eq:one}, \eqref{eq:two}, and~\eqref{eq:three}, we 
claim that
% Little trick:
\refstepcounter{equation}\label{eq:base}% <-- Note!
\begin{equation}
    1+2+\dots+n = \frac{n(n+1)}{2}
    \tag*{\myTagFormat{eq:base}{n}}\label{eq:base-n}
\end{equation}
Now you can either:
\begin{itemize}
    \item
        reference equation~\ref{eq:base-n} directly (note that you must use
        \verb|\ref| instead of \verb|\eqref|, here), or
    \item
        say that equation~\myTagFormat{eq:base}{i+1} follows from
        equation~\myTagFormat{eq:base}{i} by adding $i+1$ on both sides of the
        latter.
\end{itemize}
One more equation to check that we haven't spoiled the numbering:
\begin{equation}
    x=y
\end{equation}

\end{document}