我想创建两个层次的定理。目标是得到如下的东西:
Research Question 1: bla bla
Research Question 2: bla bla
然后在文章的另一部分,我想做这样的事情:
Research Question 1.1 bla bla
Research Question 1.2 bla bla
Research Question 2.1 bla bla
Research Question 2.2 bla bla
我使用了以下代码:
\newtheorem{researchquestion}{Research Question}
\makeatletter
\newenvironment{subresearchquestion}[1]{%
\def\subtheoremcounter{#1}%
\refstepcounter{#1}%
\protected@edef\theparentnumber{\csname the#1\endcsname}%
\setcounter{parentnumber}{\value{#1}}%
\setcounter{#1}{0}%
\expandafter\def\csname the#1\endcsname{\theparentnumber.\Alph{#1}}%
\ignorespaces
}{%
\setcounter{\subtheoremcounter}{\value{parentnumber}}%
\ignorespacesafterend
}
\makeatother
\newcounter{parentnumber}
然而,结果并不完全是应该的样子:研究问题 1:bla bla 研究问题 2:bla bla
然后在文章的另一部分,我想做这样的事情:
Research Question 3.1 bla bla
Research Question 3.2 bla bla
Research Question 4.1 bla bla
Research Question 4.2 bla bla
我怎样才能实现子定理真的是子定理?我尝试了这种方法:如何按层次对子定理进行编号?但问题是定理编号受章节编号影响。我希望这两件事是独立的。
答案1
也可以看看从定理编号中删除章节编号
\documentclass{article}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{subtheorem}{Sub-Theorem}[theorem]
\renewcommand{\thetheorem}{\arabic{theorem}}
\renewcommand{\thesubtheorem}{\arabic{theorem}.\arabic{subtheorem}}
\begin{document}
\section{Introduction}
\begin{theorem}
Yada yada yada.
\end{theorem}
\begin{subtheorem}
Yada yada yada.
\end{subtheorem}
\begin{subtheorem}
Yada yada yada.
\end{subtheorem}
\begin{theorem}
Yada yada yada.
\end{theorem}
\begin{subtheorem}
Yada yada yada.
\end{subtheorem}
\begin{subtheorem}
Yada yada yada.
\end{subtheorem}
\end{document}