3

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

2
  • 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
    Commented May 1, 2018 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
    Commented May 1, 2018 at 20:30

2 Answers 2

3

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}
2
  • 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
    Commented May 2, 2018 at 1:19
  • Order in which they are loaded? Commented May 2, 2018 at 3:24
0

Take a look at the Original Poster's 4th line of code:

\declaretheorem[name=Question,numberwithin=subsection]{question}

Replace that with the line below, use sibling instead of numberwithin:

\declaretheorem[name=Question,sibling=theorem]{question}

That should be enough for you to get the desired output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .