“方程式列表/方程式表”的枚举和标签问题

“方程式列表/方程式表”的枚举和标签问题

我终于设法在我的 LaTeX 模板中包含了一个“方程式列表”。我使用了 Lev Bishop 的示例在 Stackexchange 上

代码如下:

\documentclass[english]{article}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}

\usepackage{amsmath}
\usepackage[unicode=true, pdfusetitle,  bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,  breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]  {hyperref} 

\makeatletter
\numberwithin{equation}{section} 

% we use this for our refernces as well
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}

% redefinition of \equation for convenience
\let\oldequation = \equation
\let\endoldequation = \endequation
\AtBeginDocument{\let\oldlabel = \label}% \AtBeginDocument because hyperref redefines \label
\newcommand{\mynewlabel}[1]{\myequations{#1}\oldlabel{#1}}
\renewenvironment{equation}{%
\oldequation
\let\label\mynewlabel
}{\endoldequation}

% try to make a List of Equations,
% error is most likely in the @currentlabelname above
\usepackage{tocloft}
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}}
\setlength{\cftmyequationsnumwidth}{3em}

\makeatother

\begin{document}
\tableofcontents{}
\listofmyequations

\section{Brushless Motor Fundamentals}
\subsubsection{DC Motor Operation} Torque is generated in DC motors from the magnetic force, also known as the Lorentz force, which is produced when an electric current is passed through a coil in a magnetic field. This force is given by \ref{eq:Force}.

\begin{equation} 
F=q[E+(v\times B)]
\label{eq:Force}
\end{equation}

where F is the force perpendicular to the coil, E is the electric field in the coil, v is the velocity of the charged particles in the coil, and B is the magnetic field. From mechanics, torque is  

\begin{equation}
\tau=F\times r\label{eq:Torque}\end{equation}
If the electrical force in \ref{eq:Force} is ignored, and the remaining magnetic force is used in \ref{eq:Torque}, with the assumption that v is perpendicular to B, we find that
\begin{equation}
\tau=qvBrsin\theta
\label{eq:Magnetic}\end{equation}

\end{document} 

但它仍然不能完全解决我的问题:

我确实使用了最多 3-4 个子级别的章节枚举,如下所示:

  1. 章节

    1.1 子章节

    1.1.1 子章节

ETC。

不幸的是,在这种情况下,我的方程式确实得到了相同的枚举。因此,第 1.1.1 章中的任何方程式都编号为 (1.1.1.1)、(1.1.1.2)、(1.1.1.x) 等。我更喜欢只在章节内计数的枚举:(1.1)、(1.2)、(1.x) 等。无论我在哪个子章节中。

有人知道怎么做吗?不幸的是,我已经对方程列表的代码有点不知所措了。

答案1

您需要\numberwithin{equation}{chapter}在文档中放入前言。此命令会更改命令\theequation,并在每个命令后将计数器设置equation为零\chapter

相关内容