2

I'm new to latex and would appreciate some help with a problem I am having with generating a list of equations using the tocloft package. I would like the list to appear as the \listoftables \listoffigures functions appear. Im using the article document class and the tocloft package to generate a new list.

\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{figure}{\protect\numberline{\theequation}#1}\par}
\setlength{\cftmyequationsnumwidth}{2.5em}`

%followed by :

\section*{List of Illustrations}
\addcontentsline{toc}{section}{List of Illustrations} 
\listoffigures
\addcontentsline{toc}{subsection}{List of Figures} 
\listoftables
\addcontentsline{toc}{subsection}{List of Tables}
\listofmyequations
\addcontentsline{toc}{subsection}{List of Equations}`

this generates enter image description here

  • 1
    Do \usepackage[titles]{tocloft}, so the package doesn't seize the initiative and change the chapter headings. – egreg May 1 '16 at 15:55
2

Here is a suggestion using tocbasic instead tocloft.

\documentclass{article}
\usepackage{blindtext}% dummy text

\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}

\usepackage{tocbasic}
\usepackage{scrbase}
\renewcommand*{\tableofcontents}{\listoftoc[{\contentsname}]{toc}}
\renewcommand*{\listoffigures}{\listoftoc[{\listfigurename}]{lof}}
\renewcommand*{\listoftables}{\listoftoc[{\listtablename}]{lot}}

\DeclareNewTOC[
  type=myequation,
  name=Equation,
  listname={List of Equations},
  tocentrynumwidth=2.3em,% like figures and tables
  tocentryindent=1.5em,% like figures and tables
]{equ}
\newcommand{\myequations}[1]{%
  \addxcontentsline{equ}{myequation}[\theequation]{#1}}

\setuptoc{lof}{leveldown,totoc}
\setuptoc{lot}{leveldown,totoc}
\setuptoc{equ}{leveldown,totoc}

\begin{document}
\tableofcontents
\section*{List of Illustrations}
\addcontentsline{toc}{section}{List of Illustrations} 
\listoffigures
\listoftables
\listofmyequations
\section{A Section}
\blindtext
\begin{table}[htb]
  \centering\huge Table
  \caption{First table}
\end{table}
\Blindtext
\begin{table}[htb]
  \centering\centering\huge Table
  \caption{Second table}
\end{table}
\blindtext
\begin{equation}
  a^2+b^2=c^2
  \myequations{A first equation}
\end{equation}
\section{A second section}
\Blindtext
\begin{table}[htb]
  \centering\centering\huge Table
  \caption{Third table}
\end{table}
\Blindtext
\begin{equation}
  h=pq
  \myequations{A second equation}
\end{equation}
\end{document}

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.