我想通过在方程编号上添加星号(或其他符号)来将一些方程标记为特殊方程。我按如下方式实现此目的:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\markThisEquationSpecial}{\refstepcounter{equation}\tag{{\theequation}*}}
\begin{document}
Here is an important equation:
\begin{equation}
\label{eq:important}
S_{\text{EH}} = \int \frac{m_{p}^{2}}{2}R \sqrt{-g} d^{4}x\,.
\markThisEquationSpecial
\end{equation}
Here is an unimportant equation:
\begin{equation}
\label{eq:unimportant}
S_{\text{M}} = \int \frac{-1}{4}F_{ab}F^{ab} \sqrt{-g} d^{4}x\,.
\end{equation}
The unimportant equation is referenced as Eq.~\eqref{eq:unimportant}.
The important equation is referenced as Eq.~\eqref{eq:important}.
Notice that the asterisk has come along for the ride in the reference.
I would like it to appear as Eq.~(1).
\end{document}
如下所示:
我怎样才能防止星号出现在文本中\ref
?
或者,是否有某种方法可以将 放在(*)
等式的左边,镜像等式编号的位置(1)
,以此来标记等式的重要性?
答案1
这是一个相对简单的替代解决方案flalign
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathabx}% extra symbols
\begin{document}
Here is an important equation:
\begin{flalign}\label{eq:important}
\Asterisk && S_{\text{EH}} = \int \frac{m_{p}^{2}}{2}R \sqrt{-g} d^{4}x\,.&&
\end{flalign}
Here is an unimportant equation:
\begin{equation}
\label{eq:unimportant}
S_{\text{M}} = \int \frac{-1}{4}F_{ab}F^{ab} \sqrt{-g} d^{4}x\,.
\end{equation}
The unimportant equation is referenced as Eq.~\eqref{eq:unimportant}.
The important equation is referenced as Eq.~\eqref{eq:important}.
\end{document}
仔细想想,它在右侧也起作用。
\begin{flalign}\label{eq:important}
&& S_{\text{EH}} = \int \frac{m_{p}^{2}}{2}R \sqrt{-g} d^{4}x\,.&&\Asterisk
\end{flalign}
答案2
正如@Mico 在其评论中所说,添加*
到方程编号中而不用于引用会导致混淆。由于您不喜欢使用框架或阴影框等(例如 empheq 包提供的内容)来强调方程的重要性,那么请查看方程的重要性是否足够,如您在此处所见:
代码 :
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx,pifont}
\newcommand{\alert}[1][3em]{%
\marginpar[\raisebox{-#1}{\quad\huge\ding{43}\quad}]%
{\raisebox{-#1}{\quad\reflectbox{\huge\ding{43}}}}
}
\begin{document}
Here is an important equation:
\alert\begin{equation}
\label{eq:important}
S_{\text{EH}} = \int \frac{m_{p}^{2}}{2}R \sqrt{-g} d^{4}x\,.
\end{equation}
Here is an unimportant equation:
\begin{equation}
\label{eq:unimportant}
S_{\text{M}} = \int \frac{-1}{4}F_{ab}F^{ab} \sqrt{-g} d^{4}x\,.
\end{equation}
The unimportant equation is referenced as Eq.~\eqref{eq:unimportant}.
The important equation is referenced as Eq.~\eqref{eq:important} \dots and marked on page border with \ding{43}.
\end{document}
您可以\ding{43}
根据自己的喜好选择任何符号。
答案3
使用原始的“LaTeX \label
”,而不是更新的amsmath
\label
:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\markThisEquationSpecial}{%
\refstepcounter{equation}%
\tag{{\theequation}*}%
}
\makeatletter
\newcommand{\ltxlabel}{\ltx@label}% Original LaTeX \label
\makeatother
\begin{document}
Here is an important equation:
\begin{equation}
\label{eq:important}\ltxlabel{eq:important2}
S_{\text{EH}} = \int \frac{m_{p}^{2}}{2}R \sqrt{-g} d^{4}x\,.
\markThisEquationSpecial
\end{equation}
Here is an unimportant equation:
\begin{equation}
\label{eq:unimportant}
S_{\text{M}} = \int \frac{-1}{4}F_{ab}F^{ab} \sqrt{-g} d^{4}x\,.
\end{equation}
The unimportant equation is referenced as Eq.~\eqref{eq:unimportant}.
The important equation is referenced as Eq.~\eqref{eq:important}.
Notice that the asterisk has come along for the ride in the reference.
I would like it to appear as Eq.~\eqref{eq:important2}.
\end{document}