假设有一个带有参数的方程,该参数在方程的标签中表示:
我正在寻找一种方法,如何使用两个不同的\lambda
(例如\lambda_1
和 )来引用此方程\lambda_2
。可以这样写
但我想用更短的形式来写
以这样的方式,$(E_{\lambda_1})$
和$(E_{\lambda_2})$
指的是方程,就像上面的变体一样。
以下是 MWE:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\begin{equation}
\label{1}
\tag{$E_\lambda$}
-u'' = \lambda u.
\end{equation}
It is possible to write: Consider \eqref{1} with $\lambda=\lambda_1$ and $\lambda=\lambda_2$.
But I would like to write: Consider $(E_{\lambda_1})$ and $(E_{\lambda_2})$.
\end{document}
答案1
一个适合我的简单解决方案是基于这个答案如下所示:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{hyperref}
\DeclareRobustCommand\lambind{\lambda}
\begin{document}
\begin{equation}
\label{1}
\tag{$E_{\lambind}$}
-u'' = \lambda u.
\end{equation}
It is possible to write: Consider \eqref{1} with $\lambda=\lambda_1$ and $\lambda=\lambda_2$.
But I would like to write: Consider {\renewcommand\lambind{\lambda_1}\eqref{1}} and {\renewcommand\lambind{\lambda_2}\eqref{1}}.
\end{document}