用小数而不是整数来编号定理

用小数而不是整数来编号定理

请注意,定理以整数编号,如 1,2 ....,但我希望它以小数编号,如 1.0,1.1...我该如何实现?

答案1

如果“小数”指的是章节或部分计数器,则可以指定父计数器:

\newtheorem{yourtheorem}{Theorem}[name-of-counter]

MWE 如下:

\documentclass{article}

\usepackage{amsmath}
\newtheorem{yourthrm}{Theorem}[section]

\begin{document}

\section{the first section}
\begin{yourthrm}
    the first theorem
\end{yourthrm}
\begin{yourthrm}
    the second theorem
\end{yourthrm}

\section{the second section}
\begin{yourthrm}
    the third theorem
\end{yourthrm}

\end{document}

在此处输入图片描述

但它也可以是你喜欢的计数器:

\documentclass{article}

\newcounter{mycounter}
\setcounter{mycounter}{0}

\usepackage{amsmath}
\newtheorem{yourthrm}{Theorem}[mycounter]

\begin{document}

\begin{yourthrm}
    the first theorem
\end{yourthrm}
(counter increase here) \stepcounter{mycounter}
\begin{yourthrm}
    the second theorem
\end{yourthrm}
\begin{yourthrm}
    the third theorem
\end{yourthrm}
(counter increase here) \stepcounter{mycounter}
\begin{yourthrm}
    the fourth theorem
\end{yourthrm}

\end{document}

在此处输入图片描述

相关内容