# Theorem numbering with sub-theorem, without section number

I am using the IEEEtran class and \usepackage{amsthm}. How can I set a counter for the theorems, independent of the sections? Let's say my first theorem has three parts and my second theorem has two parts. How can I generate?:

Theorem 1.1

Theorem 1.2

Theorem 1.3

Theorem 2.1

Theorem 2.2

• We can use manual theorem number available here – Sus20200 Feb 12 '18 at 23:47
• What if the next theorem has no parts? It should be “Theorem 3”, I guess. – egreg Feb 13 '18 at 8:08

I suggest you create a dedicated counter variable -- called mythmcounter, say -- and create a dedicated theorem-like environment -- called mythm, say -- whose numbering is subordinated to the value of mythmcounter. Run the instruction \stepcounter{mythmcounter} as needed. \documentclass{IEEEtran}
\usepackage{amsthm}

\newcounter{mythmcounter}
\newtheorem{mythm}{Theorem}[mythmcounter]

\begin{document}

\stepcounter{mythmcounter}
\begin{mythm} abc \end{mythm}
\begin{mythm} def \end{mythm}

\stepcounter{mythmcounter}
\begin{mythm} ghi \end{mythm}
\begin{mythm} jkl \end{mythm}
\begin{mythm} mno \end{mythm}

\end{document}


I am not sure I understood the question in its full extent, but there should be subtheorems that have a theorem and a subtheorem number. The easiest way is to define a new subtheorem environment that uses the theorem counter as driver counter.

The first occurence of such a subtheorem needs a \setcounter{theorem}{1}, the next one (if followed directly a subtheorem) requires a \stepcounter{theorem} to force the resetting of the subtheorem counter. \documentclass{IEEEtran}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\newtheorem{subtheorem}{Subtheorem}[theorem]

\begin{document}

\section{Foo section}
\setcounter{theorem}{1}
\begin{subtheorem}{Part one}
\end{subtheorem}

\begin{subtheorem}{Part two}
\end{subtheorem}

\begin{subtheorem}{Part three}
\end{subtheorem}

\stepcounter{theorem}
\begin{subtheorem}{Part one}
\end{subtheorem}

\begin{subtheorem}{Part two}
\end{subtheorem}

\end{document}


Borrowing subequations from amsmath:

\documentclass{IEEEtran}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\makeatletter
\newcounter{parenttheorem}
\newenvironment{subtheorems}{%
\refstepcounter{theorem}%
\protected@edef\theparenttheorem{\thetheorem}%
\setcounter{parenttheorem}{\value{theorem}}%
\setcounter{theorem}{0}%
\def\thetheorem{\theparenttheorem.\arabic{theorem}}%
\ignorespaces
}{%
\setcounter{theorem}{\value{parenttheorem}}%
\ignorespacesafterend
}
\makeatother

\begin{document}

\begin{theorem}
This has no parts.
\end{theorem}

\begin{subtheorems}
\begin{theorem}
First part 2
\end{theorem}

\begin{theorem}
Second part 2
\end{theorem}
\end{subtheorems}

\begin{theorem}
This has no parts.
\end{theorem}

\begin{subtheorems}
\begin{theorem}
First part 4
\end{theorem}

\begin{theorem}
Second part 4
\end{theorem}

\begin{theorem}
Third part 4
\end{theorem}
\end{subtheorems}

\begin{theorem}
This has no parts.
\end{theorem}

\end{document} 