我有以下align
环境来将一组方程式包装成一个组。
\begin{align}
AXA & = A \label{eq:5.4.1} \\
XAX & = X \label{eq:5.4.2} \\
AX & = (AX)^T \label{eq:5.4.3} \\
XA & = (XA)^T \label{eq:5.4.4} \\
AX & = XA \label{eq:5.4.5} \\
A^k & = XA^{k+1}, \; k = 0,1,2,\dots \label{eq:5.4.6} \\
\end{align}
我想将这些对齐的方程标记为 (1)、(2)……,以便我可以在文档中唯一地引用。
怎么做?
梅威瑟:
\documentclass{book}
\usepackage{amsmath}
\begin{document}
\chapter{First Chapter}
This equation should be counted usual.
\begin{equation}
Some\_other\_equation
\end{equation}
The following should count as (1), (2), \dots, ....
\begin{align}
AXA & = A \label{eq:5.4.1} \\
XAX & = X \label{eq:5.4.2} \\
AX & = (AX)^T \label{eq:5.4.3} \\
XA & = (XA)^T \label{eq:5.4.4} \\
AX & = XA \label{eq:5.4.5} \\
A^k & = XA^{k+1}, \; k = 0,1,2,\dots \label{eq:5.4.6} \\
\end{align}
This equation should be counted usual.
\begin{equation}
another\_equation
\end{equation}
\end{document}
电流输出:
预期输出:
答案1
您可以使用\begin{align*}
来抑制那里的编号并手动\tag
添加数字:
\begin{document}
\chapter{First Chapter}
This equation should be counted usual.
\begin{equation}
\text{Some other equation}
\end{equation}
The following should count as (1), (2), \dots
\begin{align*}
AXA & = A \label{eq:5.4.1} \tag{1}\\
XAX & = X \label{eq:5.4.2} \tag{2}\\
AX & = (AX)^T \label{eq:5.4.3} \tag{3}\\
XA & = (XA)^T \label{eq:5.4.4} \tag{4}\\
AX & = XA \label{eq:5.4.5} \tag{5}\\
A^k & = XA^{k+1}, \; k = 0,1,2,\dots \label{eq:5.4.6} \tag{6}
\end{align*}
This equation should be counted usual. Reference to \ref{eq:5.4.3}
\begin{equation}
\text{another equation}
\end{equation}
\end{document}
我还\\
从最后一个等式中删除了多余的部分align*
。
答案2
您可以使用subequations
环境,将此组中的方程编号设为(1.2a), (1.2b),…
。如果您希望将它们编号为(1.2₁),(1.2₂),…
,可以修补环境。它非常适合交叉引用,即使使用cleveref
:
\documentclass{book}
\usepackage{mathtools}
\usepackage{cleveref}
\makeatletter
\renewenvironment{subequations}{%
\refstepcounter{equation}%
\protected@edef\theparentequation{\theequation}%
\setcounter{parentequation}{\value{equation}}%
\setcounter{equation}{0}%
\def\theequation{\theparentequation\textsubscript{$ \mkern1mu $\arabic{equation}}}%
\ignorespaces
}{%
\setcounter{equation}{\value{parentequation}}%
\ignorespacesafterend
}
\makeatother
\begin{document}
\chapter{First Chapter}
This equation should be counted usual.
\begin{equation}
Some\_other\_equation
\end{equation}
The following should count as (1), (2), \dots, ....
\begin{subequations}
\begin{align}
AXA & = A \label{eq:5.4.1} \\
XAX & = X \label{eq:5.4.2} \\
AX & = (AX)^T \label{eq:5.4.3} \\
XA & = (XA)^T \label{eq:5.4.4} \\
AX & = XA \label{eq:5.4.5} \\
A^k & = XA^{k+1}, \; k = 0,1,2, ... \label{eq:5.4.6}
\end{align}
\end{subequations}
These equations (\crefrange{eq:5.4.1}{eq:5.4.6}) should be counted usual.
\begin{equation}
another\_equation
\end{equation}
\end{document}