## LaTeX forum ⇒ General ⇒ Adding "List of Equations" into an existing latex style sty

LaTeX specific issues not fitting into one of the other forums of this category.
abuhawa
Posts: 4
Joined: Sat Feb 13, 2021 8:26 am

### Adding "List of Equations" into an existing latex style sty

I am catching up with Latex, but this one really annoyed me. I was provided with the standard *.sty file and the main.tex which I attached here.

The standard sty file does not contain page for "List of Equations." By following the guide from https://latex.org/forum/viewtopic.php?t=428 I managed to generate the page by adding the following code into the *.sty file.
%%%%%   List of Equations
\renewcommand{\listequationsname}{\normalsize\normalfont\centering\vspace*{-0.5in} LIST OF EQUATIONS}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}\par}
\addcontentsline{toc}{section}{LIST OF EQUATIONS}
\listofmyequations
\fi

In the main.text and chapters, I have each equation with \myequations label.
$$\frac{D\rho}{Dt}+\rho(\bigtriangledown \cdot \overrightarrow{\rm V}) = 0 \label{eqn:conversation of mass}$$
\myequations{conversation of mass}

Where $\rho$ is density, $V$ is velocity and, $\bigtriangledown$ is gradient operator.

$$\rho \frac{DV}{Dt} = -\bigtriangledown P + \rho g + \mu \bigtriangledown^{2}V \label{eqn:conservation of momentum}$$
\myequations{conservation of momentum}

I would like to ask the following:

1. How do I add the word Equation to each of the equation on the "List of Equations" page.
2. Why the page number is the same xiv for List of Figures and List of Equations?
Attachments
ToC.png (92.02 KiB) Viewed 639 times
list of equation.png (117.96 KiB) Viewed 639 times

abuhawa
Posts: 4
Joined: Sat Feb 13, 2021 8:26 am
I finally nailed it, miss several line of codes to make into a new page.

%%%%%   List of Equations
\iffigurespage
\newcommand{\listequationsname}{\normalsize\normalfont\centering\vspace*{-0.5in} LIST OF EQUATIONS}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{Equation \protect\numberline{\theequation} #1}\par} %add the word "Equation"
\clearpage %this is to add new page
\phantomsection %this is to add new page, without these command, the page will be the same as the previous
\addcontentsline{toc}{section}{LIST OF EQUATIONS}
\listofmyequations
\fi

Bartman
Posts: 179
Joined: Fri Jan 03, 2020 2:39 pm
With your approach, the indentation of this list no longer matches the indentation of the other lists if the text entered needs more than one line.

The command \newlistof creates, among other things, the command \cftXpresnum (X serves as a placeholder), which can prepend the word to any list entry. The necessary informations can be found in sections 2.3 and 2.4 of the documentation of tocloft.

abuhawa
Posts: 4
Joined: Sat Feb 13, 2021 8:26 am
Bartman wrote:With your approach, the indentation of this list no longer matches the indentation of the other lists if the text entered needs more than one line.

The command \newlistof creates, among other things, the command \cftXpresnum (X serves as a placeholder), which can prepend the word to any list entry. The necessary informations can be found in sections 2.3 and 2.4 of the documentation of tocloft.

I encountered exactly what you said. You can see below.
Any recommendation or alternative method?
Attachments
toc-equation.png (96.14 KiB) Viewed 144 times

abuhawa
Posts: 4
Joined: Sat Feb 13, 2021 8:26 am
I have found the solution.Add the following
\setlength{\cftmyequationsnumwidth}{2.5em}% Width of equation number in List of Equations

The overall code in the style (*.sty) file:
%%%%%   List of Equations
\iffigurespage
\newcommand{\listequationsname}{\normalsize\normalfont\centering\vspace*{-0.5in} LIST OF EQUATIONS}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{myequations}{Equation \protect\numberline{\theequation} ##1}\par}
\setlength{\cftmyequationsnumwidth}{2em}% Width of equation number in List of Equations
\clearpage %this is to add new page
\phantomsection %this is to add new page, without these command, the page will be the same as the previous
\addcontentsline{toc}{section}{LIST OF EQUATIONS}
\listofmyequations
\fi


Credit to:
https://tex.stackexchange.com/questions/173102/table-of-equations-like-list-of-figures

Return to “General”

### Who is online

Users browsing this forum: No registered users and 7 guests