用户达莱夫发布了一种关于如何在使用时增加方程数量的好方法subequations
。
最小工作示例(MWE):
\documentclass{scrbook}
\usepackage{amsmath}
\newcommand\StepSubequations{
\stepcounter{parentequation}
\gdef\theparentequation{\arabic{parentequation}}
\setcounter{equation}{0}
}
\begin{document}
First, some normal equation:
\begin{equation}
content...
\end{equation}
And in following the subequations:
\begin{subequations}
\begin{align}
1 &= 1\\
2 &= 2\\
\StepSubequations
3 &= 3\\% from here a new equation number should begin
4 &= 4
\end{align}
\end{subequations}
\begin{equation}
\label{eq:1}
a=b
\end{equation}
\end{document}
结果截图:
问题说明:
如您所见,scrbook
使用自定义编号方案,例如chapternumber.equationnumber
。使用计数器修改达莱夫不幸的是,这不起作用。
是否还有一个选项可以考虑通用scrbook
编号方案subequations
?
在上面的例子中,子方程编号应如下所示:
0.2a
、0.2b
和0.3a
以0.3b
匹配 的编号方案scrbook
。
答案1
您随时可以将 \thechapter 添加到表示中:
\documentclass{scrbook}
\usepackage{amsmath}
\newcommand\StepSubequations{
\stepcounter{parentequation}
\gdef\theparentequation{\thechapter.\arabic{parentequation}}
\setcounter{equation}{0}
}
\begin{document}
First, some normal equation:
\begin{equation}
content...
\end{equation}
And in following the subequations:
\begin{subequations}
\begin{align}
1 &= 1\\
2 &= 2\\
\StepSubequations
3 &= 3\\% from here a new equation number should begin
4 &= 4
\end{align}
\end{subequations}
\begin{equation}
\label{eq:1}
a=b
\end{equation}
\end{document}
答案2
作为对 Ulrikes 回答的评论,
我们可以简单地复制方程编号的正常格式并对其进行修补以使用parentequation
\documentclass{scrbook}
\usepackage{amsmath}
\usepackage{etoolbox}
\let\sillymacro\theequation % copy definition, then patch,
% \ERROR does not exist, so doc will not compile if patch fails
\patchcmd\sillymacro{equation}{parentequation}{\typeout{patched ok}}{\ERROR}
\newcommand\StepSubequations{
\stepcounter{parentequation}
% \gdef\theparentequation{\arabic{parentequation}}
\gdef\theparentequation{\sillymacro}%
\setcounter{equation}{0}
}
\begin{document}
...