[Tex/LaTex] restate theorem (numbering issue)

theorems

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{thm-restate}
\usepackage{cleveref}
\declaretheorem[name=Theorem,numberwithin=section]{thm}

\begin{document}

\theoremstyle{definition}
\newtheorem{my}{Theorem}[section]
\section{First}

\begin{my}
This theorem should be 1.1 (which is correct) and the theorem below should be (1.2) which I will refer to later on in section 2.
\end{my}


\begin{restatable}{thm}{doubling}
\label{thm:doubling}
Let $s$ be a non-negative integer. Then $X \equiv \{-4,-3,-2,-1,0,3\} \pmod{12104\cdot2^s}$ implies $X \equiv \{-4,-3,-2,-1,0,3\} \pmod{12104\cdot2^{s+1}}$. Thus by induction $X \equiv \{-4,-3,-2,-1,0,3\}$.
\end{restatable}

\section{Second}

\noindent We recall \cref{thm:doubling}:

\doubling*
\end{document}

I adopted this answer from

Recalling a theorem

which is indeed very helpful. I played around with the command and have issues with the numbering.

Earlier I had fixed that \newtheorem{my}{Theorem}[section] and I wanted to apply the answer from "Recalling a theorem" to my so-called theorem so that it will appear later on in Section 2. I believe there's something wrong with either \begin{my} or \begin{restatable} that it gives same numbering for the theorems. Can someone help explain to me what is wrong with the command.

If there's something I need to change I prefer it be \declaretheorem[name=Theorem,numberwithin=section]{thm} because I have used

\theoremstyle{definition}
    \newtheorem{my}{Theorem}[section] 

all over my thesis.

Best Answer

I found a solution from this the documentation of package thmtools. In your case, I think

\declaretheorem[name=Theorem,numberwithin=section,sibling=theorem]{thm}

should do the trick.

Related Question