定理编号包含子定理,不包含章节编号

定理编号包含子定理,不包含章节编号

我正在使用IEEEtran类和\usepackage{amsthm}。如何设置与节无关的定理计数器?假设我的第一个定理有三个部分,第二个定理有两个部分。我该如何生成?:

定理 1.1

定理 1.2

定理 1.3

定理 2.1

定理 2.2

答案1

我建议您创建一个专用的计数器变量(例如mythmcounter称为),并创建一个专用的定理类环境(例如称为mythm),其编号从属于的值。根据需要mythmcounter运行该指令。\stepcounter{mythmcounter}

在此处输入图片描述

\documentclass{IEEEtran}
\usepackage{amsthm}

\newcounter{mythmcounter}
\newtheorem{mythm}{Theorem}[mythmcounter]

\begin{document}

\stepcounter{mythmcounter}
\begin{mythm} abc \end{mythm}
\begin{mythm} def \end{mythm}

\stepcounter{mythmcounter}
\begin{mythm} ghi \end{mythm}
\begin{mythm} jkl \end{mythm}
\begin{mythm} mno \end{mythm}

\end{document}

答案2

我不确定我是否完全理解了这个问题,但应该subtheorems有一个定理和一个子定理数。最简单的方法是定义一个subtheorem使用theorem计数器作为驱动计数器的新环境。

第一次出现这样的子定理时需要一个\setcounter{theorem}{1},下一次出现(如果直接跟随子定理)时需要一个\stepcounter{theorem}来强制重置子定理计数器。

在此处输入图片描述

\documentclass{IEEEtran}


\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\newtheorem{subtheorem}{Subtheorem}[theorem]

\begin{document}

\section{Foo section}
\setcounter{theorem}{1}
\begin{subtheorem}{Part one}
\end{subtheorem}


\begin{subtheorem}{Part two}
\end{subtheorem}


\begin{subtheorem}{Part three}
\end{subtheorem}

\stepcounter{theorem}
\begin{subtheorem}{Part one}
\end{subtheorem}


\begin{subtheorem}{Part two}
\end{subtheorem}


\end{document}

答案3

借用subequationsamsmath

\documentclass{IEEEtran}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}

\makeatletter
\newcounter{parenttheorem}
\newenvironment{subtheorems}{%
  \refstepcounter{theorem}%
  \protected@edef\theparenttheorem{\thetheorem}%
  \setcounter{parenttheorem}{\value{theorem}}%
  \setcounter{theorem}{0}%
  \def\thetheorem{\theparenttheorem.\arabic{theorem}}%
  \ignorespaces
}{%
  \setcounter{theorem}{\value{parenttheorem}}%
  \ignorespacesafterend
}
\makeatother

\begin{document}

\begin{theorem}
This has no parts.
\end{theorem}

\begin{subtheorems}
\begin{theorem}
First part 2
\end{theorem}

\begin{theorem}
Second part 2
\end{theorem}
\end{subtheorems}

\begin{theorem}
This has no parts.
\end{theorem}

\begin{subtheorems}
\begin{theorem}
First part 4
\end{theorem}

\begin{theorem}
Second part 4
\end{theorem}

\begin{theorem}
Third part 4
\end{theorem}
\end{subtheorems}

\begin{theorem}
This has no parts.
\end{theorem}

\end{document}

在此处输入图片描述

相关内容