如何引用方程的一部分?

如何引用方程的一部分?

当一个 displaymath 环境中有多个方程时,有时希望只引用其中一个,而不必将环境分解成更小的部分。以以下一组边界条件为例(其中最后三个标签不起作用,但在此处写出以说明此问题的目标):

\[\left\{\begin{array}{l l l l}
    (i)\label{eq:i}\quad        & \epsilon_1E_1^\perp=\epsilon_2E_2^\perp,\quad     &
    (ii)\label{eq:ii}\quad      & B_1^\perp=B_2^\perp,\\\\
    (iii)\label{eq:iii}\quad    & \mathbf{E}_1^\parallel=\mathbf{E}_2^\parallel,\quad   &
    (iv)\label{eq:iv}\quad      & \dfrac{1}{\mu_1}\mathbf{B}_1^\parallel=\dfrac{1}{\mu_2}\mathbf{B}_2^\parallel.
\end{array}\right.\]

在此处输入图片描述

如何分别引用上述四个方程式?在数学环境中列出列表是否可行?

答案1

这里有一种方法:创建自己的\mylabel,模仿常规的\label。以下是hyperref-兼容版本:

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath,hyperref}% http://ctan.org/pkg/{amsmath,hyperref}

\providecommand{\phantomsection}{}% In case hyperref is not loaded
\AtBeginDocument{\let\textlabel\label}% http://tex.stackexchange.com/q/9939/5764
\makeatletter
\newcommand{\mylabel}[2]{\raisebox{.7\normalbaselineskip}{\phantomsection}#1%
  \def\@currentlabel{#1}\textlabel{#2}}
\makeatother

\begin{document}

\[
  \left\{\begin{array}{l l l l}
    \mylabel{\text{(\textit{i})}}{eq:i}\quad        & \epsilon_1E_1^\perp=\epsilon_2E_2^\perp,\quad     &
    \mylabel{\text{(\textit{ii})}}{eq:ii}\quad      & B_1^\perp=B_2^\perp,\\\\
    \mylabel{\text{(\textit{iii})}}{eq:iii}\quad    & \mathbf{E}_1^\parallel=\mathbf{E}_2^\parallel,\quad   &
    \mylabel{\text{(\textit{iv})}}{eq:iv}\quad      & \dfrac{1}{\mu_1}\mathbf{B}_1^\parallel=\dfrac{1}{\mu_2}\mathbf{B}_2^\parallel.
  \end{array}\right.
\]
See~\ref{eq:i}, or~\ref{eq:iv}, or~\ref{eq:iii}, or~\ref{eq:ii}.
\end{document}

\mylabel{<to-print>}{<label>}打印并存储,<to-print>以便<label>您以后参考。

答案2

这个是基于 Werner 的想法,但只有在hyperref加载时才有效。

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\makeatletter
\newcommand{\mylabel}[2]{%
  \phantomsection#1%
  \@bsphack
  \begingroup
    \def\label@name{#2}%
    \label@hook
    \protected@write\@auxout{}{%
      \string\newlabel{#2}{%
        {#1}%
        {\thepage}%
        {\@currentlabelname}%
        {\@currentHref}{}%
      }%
    }%
  \endgroup
  \@esphack
}%

\makeatother
\begin{document}

\[
  \left\{\begin{array}{l l l l}
    \mylabel{(\textit{i})}{eq:i}\quad        & \epsilon_1E_1^\perp=\epsilon_2E_2^\perp,\quad     &
    \mylabel{(\textit{ii})}{eq:ii}\quad      & B_1^\perp=B_2^\perp,\\\\
    \mylabel{(\textit{iii})}{eq:iii}\quad    & \mathbf{E}_1^\parallel=\mathbf{E}_2^\parallel,\quad   &
    \mylabel{(\textit{iv})}{eq:iv}\quad      & \dfrac{1}{\mu_1}\mathbf{B}_1^\parallel=\dfrac{1}{\mu_2}\mathbf{B}_2^\parallel.
  \end{array}\right.
\]
See~\ref{eq:i}, or~\ref{eq:iv}, or~\ref{eq:iii}, or~\ref{eq:ii}.
\end{document} 

输出:

在此处输入图片描述

相关内容