2

The setup

\theoremstyle{definition}
 \newtheorem{definition}{Definition}[section]
 \theoremstyle{plain}
 \newtheorem{theorem}[definition]{Theorem}
 \newcounter{nremarkctr}
 \newcommand*{\nremarkname}{Remark \textnormal{\thenremarkctr}}
 \newenvironment{nremark}[1][\nremarkname]
 {\refstepcounter{nremarkctr}
 \begin{proof}[#1]\renewcommand*{\qedsymbol}{\(\diamond\)}}
 {\end{proof}}
 \numberwithin{nremarkctr}{section}

creates in Section 3 the following numbering:

Definition 3.1

Theorem 3.2

Theorem 3.3

Definition 3.4

Remark 3.1

but I want

Definition 3.1

Theorem 3.2

Theorem 3.3

Definition 3.4

Remark 3.5

I know that the reason for this is that I used \numberwithin{nremarkctr}{section}, but rather need something like \numberwithin{nremarkctr}{definition}, which is motivated from \newtheorem{theorem}[definition]{Theorem}. But this does not work. How can I get the desired numbering?

4

You don't want to play with \counterwithin but use the correct counter (definition):

\documentclass[]{article}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\theoremstyle{plain}
\newtheorem{theorem}[definition]{Theorem}
\newcommand*{\nremarkname}{Remark \textnormal{\thedefinition}}
\newenvironment{nremark}[1][\nremarkname]
  {%
    \refstepcounter{definition}%
    \begin{proof}[#1]\renewcommand*{\qedsymbol}{\(\diamond\)}%
  }
  {\end{proof}}

\begin{document}
\section{Foo}
\begin{definition}
  foo
\end{definition}
\begin{theorem}
  foo
\end{theorem}
\begin{theorem}
  foo
\end{theorem}
\begin{definition}
  foo
\end{definition}
\begin{nremark}
  foo
\end{nremark}
\end{document}

enter image description here

6

Don't abuse proof:

\documentclass{article}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\theoremstyle{plain}
\newtheorem{theorem}[definition]{Theorem}
\theoremstyle{remark}
\newtheorem{innernremark}[definition]{Remark}
\newenvironment{nremark}
  {\par\pushQED{\qed}\renewcommand\qedsymbol{$\diamond$}\innernremark}
  {\popQED\endinnernremark}

\begin{document}
\section{Foo}
\begin{definition}
  foo
\end{definition}
\begin{theorem}
  foo
\end{theorem}
\begin{theorem}
  foo
\end{theorem}
\begin{definition}
  foo
\end{definition}
\begin{nremark}
  foo
\end{nremark}
\end{document}

enter image description here

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.