# Enumeration and Label issue with 'List of Equations / Table of Equations'

I finally managed to include a "List of Equations" in my LaTeX-Template. I use the Example from Lev Bishop here on Stackexchange .

The code looks like this:

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

\usepackage{amsmath}

\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]{%
\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}.

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

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

$$\tau=F\times r\label{eq:Torque}$$
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
$$\tau=qvBrsin\theta \label{eq:Magnetic}$$

\end{document}


But it still does not fit my problem perfectly:

I do use Chapter Enumerations up to 3-4 Sublevels, like this:

1. Chapter

1.1 Subchapter

1.1.1 Subsubchapter

etc.

Unfortunately in this case, my Equations do get the same enumeration. So any equations in Chapter 1.1.1 are numbered (1.1.1.1), (1.1.1.2), (1.1.1.x) etc.. I'd prefer an enumeration, that only counts within the Chapter: (1.1), (1.2), (1.x), etc.. No matter what subchapter I am in.

Anyone knows how to do that? Unfortunately I'm already a little overwhelmed by the used code for a List of Equations.

-
If I change article into chapter and add a \chapter command, equations are numbered (1.1.1), (1.1.2) and so on. With your code they are, as expected, (1.1), (1.2) and so on. –  egreg Jan 24 '12 at 13:09
A general reference is tex.stackexchange.com/questions/28333/… –  lockstep Jan 24 '12 at 17:41

You need to put \numberwithin{equation}{chapter} in your document preamble. This command changes the command \theequation and sets the equation counter to zero with every \chapter.