None of the existing examples that I found for listing equations does include the equations in the \align environement. How can I also include both equation types in the same list of equations? Here is a MWE:
\documentclass[english]{article}
\setcounter{secnumdepth}{2}
%\setcounter{tocdepth}{1}
\usepackage{amsmath}
\usepackage{tocloft}
\usepackage{xstring}
\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]{%
\StrBehind{#1}{eq:}[\Str]% remove "eq:" from labels
\myequations{\Str}\oldlabel{#1}}
\renewenvironment{equation}{%
\oldequation
\let\label\mynewlabel
}{\endoldequation}
% redefinition of \eqnarray for convenience
\let\oldeqnarray = \eqnarray
\let\endoldeqnarray = \endeqnarray
%\AtBeginDocument{\let\oldlabel = \label}% \AtBeginDocument because hyperref redefines \label
\newcommand{\mynewlabelarray}[1]{%
\StrBehind{#1}{eq:}[\Str]% remove "eq:" from labels
\myequations{\Str}\oldlabel{#1}}
\renewenvironment{eqnarray}{%
\oldeqnarray
\let\label\mynewlabelarray
}{\endoldeqnarray}
\newcommand{\listequationsname}{\normalsize 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{Section title}
\begin{equation}
F=q[E+(v\times B)]
\label{eq:Force}
\end{equation}
\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}
\begin{align}
\min_{u_{i}(t),y_i, i=1...N}!!!!!! J(u_i(t),y_i) &:= \sum_{i=1}^N \int_0^{T} R_i(u_{i}(t),t) dt \label{eq:objective function}\
+& \xi \int_{0}^{T} \left(\theta\frac{M - I(t)}{M}K(t) - D(t)\right)^2 dt + \sum_{i=1}^N \gamma_i y_i \notag\
- & \sum_{i=1}^N p_{i} \int_{T_i}^{T} u_i(t-T_i)dt \notag\
+& h\int_{0}^T \left[\theta\frac{M - I(t)}{M}K(t) - D(t)\right]^+ dt, \notag
\end{align}
subject to
\begin{align}
K(t)& = \sum_{i=1}^N u_i(t-T_i), & \quad t\in [0,T] \label{eq:2} \
u_i(t) &\le % \theta_i S_i(t) y_i =
\theta_i (M_i - I_i(t)) y_i, & \ \ i = 1\ldots N \quad t\in [0,T-T_i] \label{eq:ui}\
u_i(t) & = 0, & i = 1\ldots N \quad t\in [T-T_i,T] \label{eq:uio}\
\dot{I}_i(t)& = f_i(I_i(t)), & i = 1 \ldots N \quad t\in [0,T]& \label{eq:dotIi}\
\dot{I}(t)& = f(I(t)), &\quad t\in [0,T] \label{eq:dotI}\
u_i(t) & \ge 0, & i = 1 \ldots N \quad t\in [0,T]& \label{eq:const5}\
K(t)& \ge 0, &\quad t\in [0,T]& \
y_i &\in {0,1}, & i = 1 \ldots N& \label{eq:const6}
\end{align}
%where
\begin{equation}\label{eq:capacity constraint}
u^{j}i(t) \leq Min{p\in C^{j}{i}} \sum{k \in {K^{j}_{ip}}} u^{j+1}_k(t-T_k)
\end{equation}
\end{document}


aligninequation(which would be a syntax error)?alignedisn't involved in equation numbering at all, it is just a layout construct likearrayor\fracif you mean you don't want\label{eq:objective function}\myequations{Objective function}do\newcommand\myeq[1]{\label{eq:#1}\myequations{#1}}and use\myeq{Objective function}which is 10000 times safer than redefining\label– David Carlisle Mar 11 '23 at 15:48alignenvironment inside anequationenvironment? For sure, that's not the case in the code I posted. – Mico Mar 11 '23 at 16:17