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

1 Answer 1

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}}
1
  • it would be possible define (modify) cref to get a citation like Section 1.2 Remark 1???
    – Dog_69
    Dec 22, 2017 at 17:46

You must log in to answer this question.

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