섹션 번호 없이 하위 정리가 있는 정리 번호 매기기

섹션 번호 없이 하위 정리가 있는 정리 번호 매기기

나는 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}

여기에 이미지 설명을 입력하세요

관련 정보