Нумерация теорем с подтеоремой, без номера раздела

Нумерация теорем с подтеоремой, без номера раздела

Я использую 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

Заимствование subequationsиз amsmath:

\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}

введите описание изображения здесь

Связанный контент