1

What rules should be used if all theorems, figures, definitions, observations and lemmas are to use a continuous counter for the individual section only.

1 Answers1

2

You can define the figure counter to change with section and declare all your theorem structure to use the figure counter. If you want these counters to be prefixed by the section counter, use \counterwithin in the place of \counterwithin*.:

\documentclass[l]{article}
\usepackage{xcharter}
\usepackage[demo]{graphics}%
\usepackage{mathtools, chngcntr}
\counterwithin{figure}{section}
\usepackage{amsthm}
\newtheorem{thm}[figure]{Theorem}%
\newtheorem{lemma}[figure]{Lemma}
\theoremstyle{definition}
\newtheorem{defn}[figure]{Definition}

\begin{document}

\section{A first section}

\begin{defn}
  A simple definition
\end{defn}
\begin{thm}
  The following assertion is true: %
  \[ a = a\]%
\end{thm}

\begin{figure}[!htbp]
  \centering
  \includegraphics{myfig}
  \caption{A figure}\label{Afig}
\end{figure}

\begin{lemma}
  The following assertion is true: %
  \begin{equation}\label{testeq}
    a = a\end{equation}
    \end{lemma}

    \section{Another lovely section}
    \begin{defn}
      A simple definition
    \end{defn}

    \begin{thm}
      The following assertion is true: %
      \[ b\,a = ba\]%
    \end{thm}
\end{document}

enter image description here

Bernard
  • 271,350