我正在使用thmtools
包定义自己的模板,并且想在每个子部分重新启动定理计数器。我该怎么做?
Pd:我也在使用cleveref
包。
平均能量损失
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm,thmtools}
\usepackage{etoolbox} % for \preto and \patchcmd
\usepackage{lipsum}
\usepackage{cleveref}
\declaretheoremstyle[%
spaceabove=\topsep,
spacebelow=\topsep,
headfont=\small\itshape,
bodyfont=\normalfont\small,
headpunct={.---},
postheadspace=1em,
headformat=\NAME\space\NUMBER,
headindent=\parindent
% qed=$\blacktriangleleft$
]{remark}
\declaretheorem[style=remark]{remark}
\makeatletter
\preto\remark{%
\patchcmd\cref@thmnoarg
{\trivlist}
{\list{}{\leftmargin\parindent\rightmargin\parindent}}
{}{}%
\patchcmd\cref@thmoptarg
{\trivlist}
{\list{}{\leftmargin\parindent\rightmargin\parindent}}
{}{}%
\patchcmd\thmt@original@endremark{\endtrivlist}{\endlist}{}{}%
}
\makeatother
\begin{document}
\section{A}
\lipsum[1]
\subsection{A.1}
\lipsum[2]
\begin{remark}
\lipsum[1]
\end{remark}
\subsection{A.2}
\lipsum[3]
\begin{remark}
\lipsum[1]
\end{remark}
\end{document}
答案1
如果只是想要号码的话,请注明remark
需要在 内编号subsection
,然后进行更新。\theremark
\declaretheorem[
style=remark,
within=subsection
]{remark}
\renewcommand{\theremark}{\arabic{remark}}