1

I'm using thmtools package for define my own templates and I would like to restart theorem counters at each subsection. How I can get it?

Pd: I'm also using cleveref package.

MWE

\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}
  • @ChristianHupfer Yes, sorry. It was a little mistake. I have already solved. – Dog_69 Dec 22 '17 at 16:07
1

State that remark should be numbered within subsection and then renew \theremark, if you just want the number.

\declaretheorem[
  style=remark,
  within=subsection
]{remark}
\renewcommand{\theremark}{\arabic{remark}}
  • it would be possible define (modify) cref to get a citation like Section 1.2 Remark 1??? – Dog_69 Dec 22 '17 at 17:46

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.