我想在嵌入在图形环境中的 alignat 环境中标记方程式,但无法编译。示例:
\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{amsmath}
\begin{document}
\begin{figure}
\begin{alignat*}{2}
a & = b & c & = d \\ \label{eq:1}
e & = f & g & = h \\ \label{eq:2}
\end{alignat*}
\caption{Equalities}
\end{figure}
\end{document}
错误信息:
! Package amsmath Error: Multiple \label's: label 'eq:1' will be lost.
See the amsmath package documentation for explanation.
Type H <return> for immediate help.
...
l.11 \end{alignat*}
有人知道我该如何设置标签吗?
答案1
\label
如果在编号方程环境中使用这些命令,则它们会起作用。它们还应该放在正确的行中:
\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{amsmath}
\begin{document}
\begin{figure}
\begin{alignat}{2}
a & = b & c & = d \label{eq:1}\\
e & = f & g & = h \label{eq:2}
\end{alignat}
\caption{Equalities}
\end{figure}
\end{document}