子方程和定理环境的使用

子方程和定理环境的使用

我有一个相当棘手的(至少对我来说)方程编号问题。我有一份包含大量编号方程的文档。在文档的某个部分,我有一个引理(见下文),我希望能够使用 Lemma#(小写罗马数字的案例编号)格式引用每个案例。因此,在我的 MWE 中,我希望将第一个案例引用为“引理 1(i)”。我看到使用子方程包的希望,但无法完全使其发挥作用。如何做到这一点?

以下是 MWE:

\documentclass[11pt]{article}

\usepackage{amsmath,amssymb,amsthm}
\usepackage{mathrsfs,mathtools}
\newtheorem{lemma}{Lemma}
\begin{document}

Here's a numbered equation
\begin{equation}
E=mc^2
\end{equation}

\begin{lemma}[Explicit forms for $f(x)$]
\label{lem:forms_of_f}
\[
f(x)=%
\begin{cases}
1 &(\mathrm i)\\[0.5em]
\int_0^\infty e^{-x}\,\mathrm dx &(\mathrm{ii})\\[0.5em]
9\sum_{k=1}^\infty (10)^{-k} &(\mathrm{iii})
\end{cases}
\]
\end{lemma}

As you can see from Lemma \ref{reference case 1 as '1(i)'}, $f(x)=1$. However, Lemma \ref{reference case 2 as '1(ii)'}-\ref{reference case 3 as '1(iii)'} also show that $f(x)=1$. Here's another numbered equation
\begin{equation}
e^{\pi\mathrm i}=-1.
\end{equation}

\end{document}

答案1

您可以cases使用numcases以下方式对环境进行编号(从cases包裹)。然后你只需要调整equation计数器的格式并在环境之前/之后存储/恢复它numcases

在此处输入图片描述

\documentclass{article}

\usepackage{amsthm}
\usepackage{mathtools,cases}

\newtheorem{lemma}{Lemma}

\newcounter{saveeqncntr}

\begin{document}

Here's a numbered equation
\begin{equation}
  E = mc^2
\end{equation}

\begin{lemma}[Explicit forms for $f(x)$]
\label{lem:forms_of_f}
\begingroup
\setcounter{saveeqncntr}{\value{equation}}
\setcounter{equation}{0}
\renewcommand{\theequation}{\roman{equation}}
\begin{numcases}{f(x) =}
  1                                 \label{eqn:forms_of_f_i}  \\
  \int_0^\infty e^{-x}\,\mathrm{d}x \label{eqn:forms_of_f_ii} \\
  9\sum_{k = 1}^\infty (10)^{-k}    \label{eqn:forms_of_f_iii}
\end{numcases}
\setcounter{equation}{\value{saveeqncntr}}
\endgroup
\end{lemma}

As you can see from Lemma~\ref{lem:forms_of_f}\eqref{eqn:forms_of_f_i}, $f(x) = 1$. 
However, Lemma \ref{lem:forms_of_f}\eqref{eqn:forms_of_f_ii}--\ref{lem:forms_of_f}\eqref{eqn:forms_of_f_iii} 
also show that $f(x) = 1$. Here's another numbered equation
\begin{equation}
  e^{\pi\mathrm{i}} = -1.
\end{equation}

\end{document}

答案2

我建议一个extraequations环境并使用双重引用。

\documentclass{article}
\usepackage{amsmath,mathtools,empheq}

\newtheorem{lemma}{Lemma}

\newenvironment{extraequations}[1][\roman]
 {%
  \setcounter{parentequation}{\value{equation}}
  \setcounter{equation}{0}%
  \renewcommand{\theequation}{#1{equation}}%
  \ignorespaces
 }
 {%
  \setcounter{equation}{\value{parentequation}}%
  \ignorespacesafterend
 }

\begin{document}

Here's a numbered equation
\begin{equation}
E=mc^2
\end{equation}

\begin{extraequations}
\begin{lemma}[Explicit forms for $f(x)$]\label{lem:forms_of_f}
Text before the display, there should always be some
\begin{empheq}[left={f(x)=\empheqlbrace}]{align}
& 1 \label{case-i} \\[1ex]
& \int_0^\infty e^{-x}\,dx \label{case-ii} \\
& 9\sum_{k=1}^\infty (10)^{-k} \label{case-iii}
\end{empheq}
\end{lemma}
\end{extraequations}

As you can see from Lemma \ref{lem:forms_of_f}\eqref{case-i}, $f(x)=1$. 
However, Lemma \ref{lem:forms_of_f}\eqref{case-ii} also show that $f(x)=1$. 
Here's another numbered equation
\begin{equation}
e^{\pi i}=-1.
\end{equation}

\end{document}

在此处输入图片描述

如果你使用hyperref,你需要进一步的说明:

\newenvironment{extraequations}[1][\roman]
 {%
  \setcounter{parentequation}{\value{equation}}
  \setcounter{equation}{0}%
  \renewcommand{\theequation}{#1{equation}}%
  \renewcommand{\theHequation}{\theparentequation--#1{equation}}% to keep hyperref happy
  \ignorespaces
 }
 {%
  \setcounter{equation}{\value{parentequation}}%
  \ignorespacesafterend
 }

\begin{extraequations}[\alph]如果您想要按字母编号的额外方程式,您可以使用。

相关内容