如何在每一章开始新的定理计数?

如何在每一章开始新的定理计数?

我想要什么?[那种编号方式]

1   How to do squats

Theorem 1. Put your barbell on your shoulders.
Theorem 2. Squat.

2   How to do bench press

Theorem 1. Lean on a bench.
Theorem 2. Push.

我得到了什么

在此处输入图片描述

使用此 MWE:

\documentclass[10pt]{article}
\usepackage[russian]{babel} 
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}

\section{How to do squats}

\begin{theorem}\normalfont
Put your barbell on your shoulders.
\end{theorem}

\begin{theorem}\normalfont
Squat.
\end{theorem}

\section{How to do bench press}

\begin{theorem}\normalfont
Lean on a bench.
\end{theorem}

\begin{theorem}\normalfont
Push.
\end{theorem}

\end{document}

答案1

只需将以下内容添加到您的代码中

\makeatletter
\@addtoreset{theorem}{section}
\makeatother

现在可以使用的版本

\documentclass[10pt]{article}
\usepackage[russian]{babel} 
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\makeatletter
\@addtoreset{theorem}{section}
\makeatother

\begin{document}

\section{How to do squats}

\begin{theorem}\normalfont
Put your barbell on your shoulders.
\end{theorem}

\begin{theorem}\normalfont
 Squat.
\end{theorem}

\section{How to do bench press}

\begin{theorem}\normalfont
 Lean on a bench.
\end{theorem}

\begin{theorem}\normalfont
 Push.
\end{theorem}

\end{document}

答案2

\newtheorem{theorem}{Theorem}[section]

\newtheorem实际上有三种不同的语法。

相关内容