重置图形编号

重置图形编号

我将 定义MyChapter为章节的新计数器。我使用

\renewcommand{\thefigure}{\theMyChapter.\arabic{figure}}

用于图号。它在第 3 章之前工作正常,但从第 4 章开始它不会重置图号。例如,如果我在第 3 章中有 3 个图,第 4 章的第一个图的编号是 4.4,第二个图的编号是 4.5(这意味着它不会重置)。我该怎么办?

已编辑:文档如下所示:

\documentclass[a4paper, 11pt]{book}
\usepackage[a4paper,headsep=1cm, inner=3cm, outer=3cm, top=3.5cm, bottom=2.5cm]{geometry}
\usepackage[toc,page]{appendix} 
\usepackage{pstricks}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathcomp}
\usepackage{mathtools}
\usepackage{commath}
\usepackage{physics}
\usepackage{textcomp}
\usepackage{enumitem}
\usepackage{xepersian}

%%%%%%%%% Chapter Counter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{MyChapter}
\renewcommand{\theequation}{\theMyChapter.\arabic{equation}}
\numberwithin{figure}{MyChapter}
\def\MyChapterNumbering{\ifcase\theMyChapter صفرم\or یکم\or دوم\orدهم \fi }
\def\MyChapterNumberingg{\ifcase\theMyChapter  یکم\or دوم\or سوم\or چهارم\or دهم \fi }
\long\def\MyChapter#1{\setcounter{equation}{0}
\newpage
\vglue5cm
{\topicfont\small\noindent فصل \MyChapterNumberingg \\ \vglue1cm \noindent\large #1}
\vglue2cm
\noindent{}
\pagestyle{fancy}

\thispagestyle{empty}
\addcontentsline{toc}{section}{فصل \MyChapterNumberingg : #1}
\stepcounter{MyChapter}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    

\captionsetup{labelsep=period}
\pagestyle{empty}
\DefaultMathsDigits

\begin{document}
\tableofcontents
\pagenumbering{arabic}

 \MyChapter{test1} 

 \MyChapter{test2}  

\end{document}

相关内容