I need special numbering for equations in my work, so I made it similar to figures numbering which egreg wrote here
This is my MWE:
\documentclass[12pt, a4paper, oneside, onecolumn]{article}
\usepackage{mathtools}
%numeriranje jednadžbe
\renewcommand{\theequation}{%
\ifnum\value{subsection}=0
\thesection.\arabic{figure}%
\else
\ifnum\value{subsubsection}=0
\thesubsection.\arabic{figure}%
\else
\thesubsubsection.\arabic{figure}%
\fi
\fi
}
\begin{document}
\section{Section}
\begin{equation}
\begin{split}
R' &= R/255 \\
G' &= G/255 \\
B' &= B/255
\end{split}
\end{equation}
\subsection{Subsection}
\begin{equation}
\begin{split}
C_{max} &= max(R', G', B') \\
C_{min} &= min(R', G', B') \\
\Delta &= C_{max} - C_{min}
\end{split}
\end{equation}
\end{document}
It gives me this type of numbering, which is good, but the number of equation is wrong:

If I use it in my document it looks like this:
The 2.1.2. part is fine, that's the number of my subsubsection, but the rest is wrong. It should be 2.1.2.1 and 2.1.2.2
Could you tell me what have I done wrong here?
{equation}not{figure}in each case, you are incrementing the equation counter then printing the figure one, change to print the equation counter – David Carlisle Sep 14 '13 at 18:33