我如何改变子假设的编号样式?

我如何改变子假设的编号样式?

我想改变子假设的编号,以便假设 1 之后的子假设被编号为“子假设 1.1”。

我怎样才能做到这一点?

我现在的代码如下。

\usepackage{ntheorem} 
\theoremseparator{:} 
\newtheorem[number within=section]{hyp}{Hypothesis} 
\newtheorem {subhyp}{Subhypothesis}

谢谢

答案1

以下设置(可能)接近您想要的:

\usepackage{ntheorem}
\theoremseparator{:}
\newtheorem{hyp}{Hypothesis}[section]
\newtheorem{subhyp}{Subhypothesis}[hyp]

完整的 MWE(最小工作示例);使用 pdflatex、lualatex 或 xelatex 进行编译:

\documentclass{article}

\usepackage{ntheorem}
\theoremseparator{:}
\newtheorem{hyp}{Hypothesis}[section]
\newtheorem{subhyp}{Subhypothesis}[hyp]

\begin{document}

\setcounter{section}{3}
\begin{hyp}    aaa \label{hyp:aaa} \end{hyp}    % 3.1
\begin{subhyp} bbb \label{hyp:bbb} \end{subhyp} % 3.1.1
\begin{hyp}    uuu \label{hyp:uuu} \end{hyp}    % 3.2

\refstepcounter{section}
\begin{hyp}    ccc \label{hyp:ccc} \end{hyp}    % 4.1
\begin{subhyp} ddd \label{hyp:ddd} \end{subhyp} % 4.1.1
\begin{subhyp} eee \label{hyp:eee} \end{subhyp} % 4.1.2:

\end{document}

相关内容