2

I want to use thmtools in order to state questions, that I want to repeat at a latter point of my text. I declared the question-environment using \declaretheorem, but I also use theorem-environments I declared with \newtheorem. I want to have them to be numbered with the same counter (subsection), but it does not work. Can you help me out please?

\documentclass{article}
\usepackage{amsmath,thmtools}
\newtheorem{theorem}{Theorem}[subsection]
\declaretheorem[name=Question,numberwithin=subsection]{question}
\begin{document}
\section{Section1}
\subsection{Subsection1}
\begin{theorem}
test1
\end{theorem}
\begin{theorem}
test2
\end{theorem}
\begin{restatable}{question}{questionone}
What it is all about?
\end{restatable}
\questionone*
\begin{theorem}
test 3
\end{theorem}

\begin{restatable}{question}{questiontwo}
Hmm?
\end{restatable}

\questiontwo*

\end{document}

theoremnumberingdoesntwork

  • That is not what you are doing, you are creating two separate counters both dominated by subsection. You're probably looking for a method of using a common counter, which should be described in the thmtools manual. Note that newtheorem in your case create a counter called theorem, so you just need to tell declaretheorem to use thst counter instead of creating a new one. – daleif May 1 '18 at 19:58
  • Thanks, if I change tell declaretheorem to use this counter, I get the problem, that it the first Question gets the number 1.1.2.1, but I actually want it to get number 1.1.3. Do you know an instant solution? – user153906 May 1 '18 at 20:30
2

Is this what you are trying to achieve?

demo

\documentclass{article}
\usepackage{amsmath,thmtools}
\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{question}[theorem]{Question}
\begin{document}
\section{Section1}
\subsection{Subsection1}
\begin{theorem}
test1
\end{theorem}
\begin{theorem}
test2
\end{theorem}
\begin{restatable}{question}{questionone}
What it is all about?
\end{restatable}
\questionone*
\begin{theorem}
test 3
\end{theorem}

\begin{restatable}{question}{questiontwo}
Hmm?
\end{restatable}

\questiontwo*

\end{document}
  • Thanks, that's what I was looking for and it works for me. I tried it this way before, but \newtheorem{question}[theorem]{Question} was in the cls.file, and I had the same problem as stated in my comment on my post. Do you know why? – user153906 May 2 '18 at 1:19
  • Order in which they are loaded? – John Kormylo May 2 '18 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.