How can I create a counter that when used under a section to count as follows
1.1
1.2
1.3
where the 1
is the section number and when used under a subsection to produce
1.1.1
1.1.2
1.1.3
where 1
is the section number and 1
is the subsection number?
The following is not a MWE. It doesn't compile, it is used to illustrate the use I am looking for.
\documentclass{article}
\begin{document}
\section{Section 1}
\Counter
% Should produce 1.1
\subsection{Subsection 1}
\Counter
% Should produce 1.1.1
\subsection{Subsection 2}
\Counter
% Should produce 1.2.1
\section{Section 2}
\Counter
% Should produce 2.1
\subsection{Subsection 1}
\Counter
% Should produce 2.1.1
\end{document}