0

In the document I'm working on I have a list of figures, list of tables, and I just added a list of equations. For the figures and tables, I'm using the tocloft package. Here's a snippet of the code that I have:

    \usepackage{tocloft}

    \renewcommand{\cftfigleader}{}
    \renewcommand{\cftfigafterpnum}{\cftparfillskip}
    \renewcommand{\cfttableader}{}
    \renewcommand{\cfttabafterpnum}{\cftparfillskip}
    \renewcommand{\cftequleader}{}
    \renewcommand{\cftequafterpnum}{\cftparfillskip}

    % ============== TOC AND LISTS ===========
\renewcommand{\contentsname}{\hfill\bfseries\large Table of Contents\hfill}   
\renewcommand{\cftaftertoctitle}{\hfill}

\makeatletter
\renewcommand{\@dotsep}{10000}
\makeatother
\renewcommand{\cftchapaftersnum}{.}%
\tableofcontents
\setcounter{tocdepth}{3}
\newpage


\captionsetup[table]{labelsep=none}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Tables}}
\renewcommand{\thetable}{\arabic{table}.} 
{\renewcommand{\addvspace}[1]{} \listoftables}
\newpage

\renewcommand{\cftloftitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Figures}}
\renewcommand{\thefigure}{\arabic{figure}.}
{\renewcommand{\addvspace}[1]{} \listoffigures}
\newpage

\newcommand{\listofequationsname}{List of Equations}
\newlistof[section]{myequations}{equ}{\listofequationsname}

\newcommand{\myequations}[1]{%
   \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}}
   
   \setlength{\cftmyequationsindent}{1.5em}
   \setlength{\cftmyequationsnumwidth}{2.3em}
   \renewcommand{\cftequtitlefont}{\hspace*{\fill}\large\bfseries}
   \renewcommand{\cftafterequtitle}{\hspace*{\fill}}
   
   \addcontentsline{toc}{section}{\textbf{List of Equations}}
  
\listofmyequations
\newpage

I'm able to get the correct format that I need for the List of Figures and List of Tables using this code.

enter image description here

However, since the tocloft package doesn't handle equations, I haven't figured out how to do the same thing for my list of equations. I need to eliminate the dot separators and have the page number immediately after the listing just as the List of Figures.

enter image description here

I'm still a LaTeX newbie so thanks in advance for your help.

Here is a working example that shows a couple of tables with the format that I need in the List of Tables. It has two equations in the List of Equations with the format I am trying to change.

\documentclass[12pt, floatsintext]{report}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{xcolor}
\usepackage{trace}
\usepackage{caption}
\DeclareCaptionLabelSeparator{none}{ }
\usepackage{csquotes}
\usepackage{lmodern}
\usepackage{float}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{url}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{indentfirst}
\usepackage{fancyhdr}
\usepackage{tocloft}%

% set page numbers just after chapter titles
\renewcommand{\cftchapleader}{}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}

% set page numbers just after section titles
\renewcommand{\cftsecleader}{}
\renewcommand{\cftsecafterpnum}{\cftparfillskip}

\renewcommand{\cftsubsecleader}{}
\renewcommand{\cftsubsecafterpnum}{\cftparfillskip}

\renewcommand{\cftfigleader}{}
\renewcommand{\cftfigafterpnum}{\cftparfillskip}
\renewcommand{\cfttableader}{}
\renewcommand{\cfttabafterpnum}{\cftparfillskip}
\renewcommand{\cftequleader}{}
\renewcommand{\cftequafterpnum}{\cftparfillskip}


\newcommand{\atoc}[1]{\addtocontents{toc}{\bigskip #1\par}}

\setmainfont{Times New Roman}  

\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\large\bfseries\filcenter}{\chaptertitlename\ \thechapter}{20pt}{\large}
\titlespacing*{\chapter}
  {0pt}{30pt}{20pt}
\counterwithout{figure}{chapter}\counterwithout{table}{chapter}

\begin{document}

\newgeometry{left=4.0cm, right=2.54cm, top=2.54cm, bottom=2.54cm}

\setcounter{page}{1}
\pagenumbering{roman}
\pagestyle{plain}


%=======================================================
% ============== TOC AND LISTS ===========
\renewcommand{\contentsname}{\hfill\bfseries\large Table of Contents\hfill}   
\renewcommand{\cftaftertoctitle}{\hfill}

\makeatletter
\renewcommand{\@dotsep}{10000}
\makeatother
\renewcommand{\cftchapaftersnum}{.}%
\tableofcontents
\setcounter{tocdepth}{3}
\newpage


\captionsetup[table]{labelsep=none}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Tables}}
\renewcommand{\thetable}{\arabic{table}.} 
{\renewcommand{\addvspace}[1]{} \listoftables}
\newpage

\renewcommand{\cftloftitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Figures}}
\renewcommand{\thefigure}{\arabic{figure}.}
{\renewcommand{\addvspace}[1]{} \listoffigures}
\newpage

\newcommand{\listofequationsname}{List of Equations}
\newlistof[section]{myequations}{equ}{\listofequationsname}

\newcommand{\myequations}[1]{%
   \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}}
   
   \setlength{\cftmyequationsindent}{1.5em}
   \setlength{\cftmyequationsnumwidth}{2.3em}
   \renewcommand{\cftequtitlefont}{\hspace*{\fill}\large\bfseries}
   \renewcommand{\cftafterequtitle}{\hspace*{\fill}}
   
   \addcontentsline{toc}{section}{\textbf{List of Equations}}
  
\listofmyequations
\newpage

%=======================================================
% ============== CHAPTERS ===========
\newgeometry{left=4.0cm, right=2.54cm, top=2.54cm, bottom=2.54cm}
\setlength{\parindent}{36pt}
\doublespacing
\setcounter{page}{1}
\pagenumbering{arabic}

\pagestyle{fancy}
\fancyhf{}
\fancyheadoffset{0cm}
\renewcommand{\headrulewidth}{0pt} 
\renewcommand{\footrulewidth}{0pt}
\fancyhead[R]{\thepage}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyhead[R]{\thepage}%
}

\atoc{\textbf{Chapters}}
\chapter{Introduction}

\begin{table}[H]
    \begin{tabular}{l l}
        \textbf{1}  &  First Item \\
        \textbf{2}  &  Second Item \\
        \textbf{3}  &  Third Item 
    \end{tabular}
    \caption{Simple Table 1}
    \label{tab:simple_list1}
\end{table}


\begin{table}[H]
    \begin{tabular}{l l}
        \textbf{1}  &  First Item \\
        \textbf{2}  &  Second Item \\
        \textbf{3}  &  Third Item 
    \end{tabular}
    \caption{Simple Table 2}
    \label{tab:simple_list2}
\end{table}


\begin{equation} \label{eq:bellman_eq}
    \scalebox{1.5}{%
    $Q(s_{t'}, a_{t}) = E[r_{t+1} + \gamma r_{t+2} +\gamma^2 r_{t+3} + ...| s_{t'}, a_{t}] $}
\end{equation}
\myequations{Bellman Equation}

\begin{equation} \label{eq:bayestheorem_eq}
    \scalebox{1.2}{%
    $P(M|E) = \frac{P(E|M)P(M)}{P(E)} $}
\end{equation}
\myequations{Bayes' Theorem}
\end{document}

3
  • Please provide a complete MWE (from documentclass to \end{document}) that we can compile that shows your problem. What class are you using (presumably not letter)? Where does \captionsetup come from? You have provided no equations. Jun 13, 2022 at 16:50
  • I will create a better example. The document class is report.
    – vcooper08
    Jun 13, 2022 at 17:40
  • Updated the question with a MWE.
    – vcooper08
    Jun 13, 2022 at 18:21

1 Answer 1

0

Replace eqn with myequations in two lines

\renewcommand{\cfteqnleader}{}
\renewcommand{\cfteqnafterpnum}{\cftparfillskip}

(currently I get errors complaining \cfteqnleader and \cfteqnafterpnum are undefined), then move them under

\newlistof[section]{myequations}{equ}{\listofequationsname}

Full example (it's a bit messy)

% !TeX TS-program = xelatex
\documentclass[12pt, floatsintext]{report}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{xcolor}
\usepackage{trace}
\usepackage{caption}
\DeclareCaptionLabelSeparator{none}{ }
\usepackage{csquotes}
\usepackage{lmodern}
\usepackage{float}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{url}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{indentfirst}
\usepackage{fancyhdr}
\usepackage{tocloft}%

% set page numbers just after chapter titles
\renewcommand{\cftchapleader}{}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}

% set page numbers just after section titles
\renewcommand{\cftsecleader}{}
\renewcommand{\cftsecafterpnum}{\cftparfillskip}

\renewcommand{\cftsubsecleader}{}
\renewcommand{\cftsubsecafterpnum}{\cftparfillskip}

\renewcommand{\cftfigleader}{}
\renewcommand{\cftfigafterpnum}{\cftparfillskip}
\renewcommand{\cfttableader}{}
\renewcommand{\cfttabafterpnum}{\cftparfillskip}

\newcommand{\atoc}[1]{\addtocontents{toc}{\bigskip #1\par}}

\setmainfont{Times New Roman}  

\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\large\bfseries\filcenter}{\chaptertitlename\ \thechapter}{20pt}{\large}
\titlespacing*{\chapter}
  {0pt}{30pt}{20pt}
\counterwithout{figure}{chapter}\counterwithout{table}{chapter}

\begin{document}

\newgeometry{left=4.0cm, right=2.54cm, top=2.54cm, bottom=2.54cm}

\setcounter{page}{1}
\pagenumbering{roman}
\pagestyle{plain}


%=======================================================
% ============== TOC AND LISTS ===========
\renewcommand{\contentsname}{\hfill\bfseries\large Table of Contents\hfill}   
\renewcommand{\cftaftertoctitle}{\hfill}

\makeatletter
\renewcommand{\@dotsep}{10000}
\makeatother
\renewcommand{\cftchapaftersnum}{.}%
\tableofcontents
\setcounter{tocdepth}{3}
\newpage


\captionsetup[table]{labelsep=none}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Tables}}
\renewcommand{\thetable}{\arabic{table}.} 
{\renewcommand{\addvspace}[1]{} \listoftables}
\newpage

\renewcommand{\cftloftitlefont}{\hspace*{\fill}\large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\addcontentsline{toc}{section}{\textbf{List of Figures}}
\renewcommand{\thefigure}{\arabic{figure}.}
{\renewcommand{\addvspace}[1]{} \listoffigures}
\newpage

\newcommand{\listofequationsname}{List of Equations}
\newlistof[section]{myequations}{equ}{\listofequationsname}

\renewcommand{\cftmyequationsleader}{}
\renewcommand{\cftmyequationsafterpnum}{\cftparfillskip}

\newcommand{\myequations}[1]{%
   \addcontentsline{equ}{myequations}{\protect\numberline{\theequation}#1}}
   
   \setlength{\cftmyequationsindent}{1.5em}
   \setlength{\cftmyequationsnumwidth}{2.3em}
   \renewcommand{\cftequtitlefont}{\hspace*{\fill}\large\bfseries}
   \renewcommand{\cftafterequtitle}{\hspace*{\fill}}
   
   \addcontentsline{toc}{section}{\textbf{List of Equations}}
  
\listofmyequations
\newpage

%=======================================================
% ============== CHAPTERS ===========
\newgeometry{left=4.0cm, right=2.54cm, top=2.54cm, bottom=2.54cm}
\setlength{\parindent}{36pt}
\doublespacing
\setcounter{page}{1}
\pagenumbering{arabic}

\pagestyle{fancy}
\fancyhf{}
\fancyheadoffset{0cm}
\renewcommand{\headrulewidth}{0pt} 
\renewcommand{\footrulewidth}{0pt}
\fancyhead[R]{\thepage}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyhead[R]{\thepage}%
}

\atoc{\textbf{Chapters}}
\chapter{Introduction}

\begin{table}[H]
    \begin{tabular}{l l}
        \textbf{1}  &  First Item \\
        \textbf{2}  &  Second Item \\
        \textbf{3}  &  Third Item 
    \end{tabular}
    \caption{Simple Table 1}
    \label{tab:simple_list1}
\end{table}


\begin{table}[H]
    \begin{tabular}{l l}
        \textbf{1}  &  First Item \\
        \textbf{2}  &  Second Item \\
        \textbf{3}  &  Third Item 
    \end{tabular}
    \caption{Simple Table 2}
    \label{tab:simple_list2}
\end{table}


\begin{equation} \label{eq:bellman_eq}
    \scalebox{1.5}{%
    $Q(s_{t'}, a_{t}) = E[r_{t+1} + \gamma r_{t+2} +\gamma^2 r_{t+3} + ...| s_{t'}, a_{t}] $}
\end{equation}
\myequations{Bellman Equation}

\begin{equation} \label{eq:bayestheorem_eq}
    \scalebox{1.2}{%
    $P(M|E) = \frac{P(E|M)P(M)}{P(E)} $}
\end{equation}
\myequations{Bayes' Theorem}
\end{document}

enter image description here

1
  • Thank you! This fixed it!
    – vcooper08
    Jun 16, 2022 at 0:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .