我正在尝试在 amsmath align 环境中重新开始编号。我的 MWE 如下:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
The following equations should be numbered $(1)$ and $(2)$.
\begin{align}
7x - 15y &= 2 \\
x + 2y &= 3
\end{align}
The following should continue from the above numbering:
\begin{align}
4x - 5y &= 2 \\
6x + 7y &= 3
\end{align}
But the following should be numbered $(1)$ and $(2)$ and not continued from the above.
\begin{align}
7x - 6y &= 4 \\
5x + 7y &= 3
\end{align}
\end{document}
输出为:
我想要将编号为 (5) 和 (6) 的方程式编号为 (1) 和 (2)。
理想情况下,我希望编号方案“包含”在给定的一组相关方程中,这样一旦我重置编号计数器(比如说),它就不会影响全局编号方案。
请问我该如何实现这一点?
答案1
采用本地编号方案的通常方式是使用,尽管您可以根据需要subequation
保存并重置主计数器,但这里显示了两种形式。equation
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\newcounter{saveeqn}
\begin{document}
The following equations should be numbered $(1)$ and $(2)$.
\begin{align}
7x - 15y &= 2 \\
x + 2y &= 3
\end{align}
The following should continue from the above numbering:
\begin{align}
4x - 5y &= 2 \\
6x + 7y &= 3
\end{align}
But the following should be numbered $(1)$ and $(2)$ and not continued from the above.
\begin{subequations}
\begin{align}
7x - 6y &= 4 \\
5x + 7y &= 3
\end{align}
\end{subequations}
but you could do
\setcounter{saveeqn}{\value{equation}}\setcounter{equation}{0}
\begin{align}
7x - 6y &= 4 \\
5x + 7y &= 3
\end{align}
\setcounter{equation}{\value{saveeqn}}
and then
\begin{align}
7x - 6y &= 4 \\
5x + 7y &= 3
\end{align}
\end{document}
答案2
欢迎使用 TeX-SE!我个人不想这么做。但是,如果你真的想这么做,你可以使用\tag
。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
The following equations should be numbered $(1)$ and $(2)$.
\begin{align}
7x - 15y &= 2 \\
x + 2y &= 3
\end{align}
The following should continue from the above numbering:
\begin{align}
4x - 5y &= 2 \\
6x + 7y &= 3
\end{align}
But the following should be numbered $(1)$ and $(2)$ and not continued from the above.
\begin{align}
7x - 6y &= 4 \tag{1} \\
5x + 7y &= 3 \tag{2}
\end{align}
\end{document}