我想使用thmtools
来陈述问题,我想在文本的后面重复这些问题。我使用 声明了问题环境\declaretheorem
,但我还使用 声明的定理环境\newtheorem
。我想让它们使用相同的计数器(子部分)进行编号,但这样做行不通。你能帮帮我吗?
\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}
答案1
这就是您想要实现的目标吗?
\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
看一下原始海报的第 4 行代码:
\declaretheorem[name=Question,numberwithin=subsection]{question}
将其替换为下面的行,使用兄弟代替数量:
\declaretheorem[name=Question,sibling=theorem]{question}
这应该足以让您获得所需的输出。