我是 LaTeX 新手。我用它IEEEeqnarray
来对齐文档(已解决问题的汇编)中的方程式,我想将方程式编号更改为(x,y)
其中x
是问题编号,y
是方程式编号(每个问题都会重置)。此外,我会在环境中使用它enumerate
,所以我希望问题编号x
始终与item
数字匹配。
如果可能的话,请编辑下面的示例以使其按描述工作。我在文档中包含了我使用的软件包以确保兼容性。谢谢!
\documentclass[notitlepage]{article}
\usepackage{amsmath,amssymb,amsthm,mathrsfs}
\usepackage{IEEEtrantools,nccmath}
\usepackage[margin=1in]{geometry}
\begin{document}
This is a test file for custom equation numbering.
\begin{enumerate}
\item The equations below should be labeled (1.1), unlabeled, and labeled (1.2), in order from top to bottom.
\begin{IEEEeqnarray}{rCl}
1+1 & = & 2 \\
1+2 & = & 3 \nonumber \\
2+3 & = & 5
\end{IEEEeqnarray}
\item The equations below should be labeled (2.1), unlabeled, and labeled (2.2), in order from top to bottom.
\begin{IEEEeqnarray}{rCl}
3+5 & = & 8 \\
5+8 & = & 13 \nonumber \\
8+13 & = & 21
\end{IEEEeqnarray}
\end{enumerate}
\end{document}
答案1
您可以使用命令\numberwithin
from amsmath
。此命令接受两个参数,均应为计数器。每次增加时,使用\numberwithin{<counter1>}{<counter2>}
将重置。它还将重新定义数字 from 的显示方式,以“<counter1>
<counter2>
<counter1>
X。是“, 在哪里X是当前<counter2>
值,并且是是当前<counter1>
值。
以下示例应该适合您的具体情况。
\documentclass[notitlepage]{article}
\usepackage{amsmath,amssymb,amsthm,mathrsfs}
\usepackage{IEEEtrantools,nccmath}
\usepackage[margin=1in]{geometry}
\numberwithin{equation}{enumi}
\begin{document}
This is a test file for custom equation numbering.
\begin{enumerate}
\item The equations below should be labeled (1.1), unlabeled, and labeled (1.2), in order from top to bottom.
\begin{IEEEeqnarray}{rCl}
1+1 & = & 2 \\
1+2 & = & 3 \nonumber \\
2+3 & = & 5
\end{IEEEeqnarray}
\item The equations below should be labeled (2.1), unlabeled, and labeled (2.2), in order from top to bottom.
\begin{IEEEeqnarray}{rCl}
3+5 & = & 8 \\
5+8 & = & 13 \nonumber \\
8+13 & = & 21
\end{IEEEeqnarray}
\end{enumerate}
\end{document}