手动对 amsthm 中的假设进行编号并引用它们

手动对 amsthm 中的假设进行编号并引用它们

我遇到的情况是,有两个替代假设可以成立,以使某些估计正确。我想将它们编号为 2.a 和 2.b,并在文中引用它们(假设 1 已经存在)。到目前为止,我做了以下事情,这给出了假设编号 2 和 3:

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}

\theoremstyle{plain}
\newtheorem{assumption}{Assumption}

\begin{document}

\begin{assumption}[Comparability]\label{as:comparability} Individuals with the same $x_{it}$ vector are \textit{comparable} over time.\end{assumption}

\begin{assumption}[Comparability in differences; replacing Assumption \ref{as:comparability}]\label{as:comparabilityDiff} Differences between individuals $i$ and $j$ with the vectors $x_{it}$ and $x_{jt}$ are \textit{comparable} over time.\end{assumption}

What Assumption \ref{as:comparabilityDiff} implies economically can best be explained using an example…

有没有办法用 amsthm 包来实现这一点?我看过这篇文章 (关联),但不知道在这种情况下如何引用该定理。

答案1

类似这样的情况?我想这不是最好的解决方案,我会尝试稍后改进它。

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}

\usepackage{chngcntr}



\theoremstyle{plain}
\newtheorem{assumption}{Assumption}

\let\origtheassumption\theassumption

\begin{document}

\begin{assumption}[Comparability]\label{as:comparability} Individuals with the same $x_{it}$ vector are \textit{comparable} over time.\end{assumption}

\edef\oldassumption{\the\numexpr\value{assumption}+1}

\setcounter{assumption}{0}
\renewcommand{\theassumption}{\oldassumption.\alph{assumption}}
\begin{assumption}[Comparability in differences; replacing Assumption \ref{as:comparability}]\label{as:comparabilityDiff} 
  Differences between individuals $i$ and $j$ with the vectors $x_{it}$ and $x_{jt}$ are \textit{comparable} over time.
\end{assumption}

\begin{assumption}[Comparability in differences; replacing Assumption \ref{as:comparability}]\label{as:comparabilityDiffother} 
  Differences between individuals $i$ and $j$ with the vectors $x_{it}$ and $x_{jt}$ are \textit{comparable} over time.
\end{assumption}

\let\theassumption\origtheassumption

What Assumption \ref{as:comparabilityDiff} implies economically can best be explained using an example… and \ref{as:comparabilityDiffother}

\begin{assumption}{Foo}
bar
\end{assumption}

\end{document}

在此处输入图片描述

答案2

我遇到了类似的问题,由于我找不到其他解决方案,因此我将发布我所做的事情,以便将来可能遇到同样问题的人可以参考。想法:

  • 为所有需要与其他假设分离的假设创建一个“中间”假设环境
  • 使用\numberwithin此环境
  • 用于\stepcounter确保新环境中的编号一致

由于我不擅长使用 LaTeX,所以这种方法有点儿老套,但对我来说还是有用的。它的优点是,如果您再次需要带有额外命名的假设,您无需像我一样重新定义命令。

使用你的例子:

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}

\theoremstyle{plain}
\newtheorem{assumption}{Assumption}
\newtheorem{intassumption}{Assumption}
\numberwithin{intassumption}{assumption}
\renewcommand{\theintassumption}{\theassumption.\alph{intassumption}}

\begin{document}

\begin{assumption}[Comparability]\label{as:comparability} Individuals with the same $x_{it}$ vector are \textit{comparable} over time.\end{assumption}

\stepcounter{assumption}
\begin{intassumption}[Comparability in differences; replacing Assumption \ref{as:comparability}]\label{as:comparabilityDiff} Differences between individuals $i$ and $j$ with the vectors $x_{it}$ and $x_{jt}$ are \textit{comparable} over time.\end{assumption}

\begin{intassumption}[Comparability in differences; replacing Assumption \ref{as:comparability}]\label{as:comparabilityDiff} Differences between individuals $i$ and $j$ with the vectors $x_{it}$ and $x_{jt}$ are \textit{comparable} over time.\end{assumption}

What Assumption \ref{as:comparabilityDiff} implies economically can best be explained using an example…

\begin{assumption}{Foo}
bar
\end{assumption}

\end{document}

结果

相关内容