I'm trying to make a List of Listings that appears in the Table of Contents like List of Figures. I'm using a class that was provided for me, and I tried editing it but it isn't working.
This is what the List of Figures looks like:
But this is what the attempted List of Listings looks like:
For some reason, it's being treated as if it is a Table of Contents.
Here is the code in the .cls
file:
%
% List of figures
%
\def\textofLoF#1{\gdef\@textofLoF{#1}} \textofLoF{List of Figures}
\def\listoffigures{\chapter*{\@textofLoF\@mkboth{}{}}
\thispagestyle{plain}
\addcontentsline{toc}{chapter}{\protect\@textofLoF}
\hbox to\textwidth{Figure Number \hfill Page}
{\let\footnotemark\relax % in case one is in the title
\uwsinglespace
\@starttoc{lof}
}
}
%
% List of listings
%
\def\textofLoL#1{\gdef\@textofLoL{#1}} \textofLoL{List of Listings}
\def\lstlistoflistings{\chapter*{\@textofLoL\@mkboth{}{}}
\thispagestyle{plain}
\addcontentsline{toc}{chapter}{\protect\@textofLoL}
\hbox to\textwidth{Listing Number \hfill Page}
{\let\footnotemark\relax % in case one is in the title
\uwsinglespace
\@starttoc{lol}
}
}
%
I just copied the block for the List of Figures and tried changing it appropriately, but it doesn't work. I assume this is because \lstlistoflistings
is in the listings
package, so it's different, but I'm not sure in what way.
EDIT: here is a minimal .tex
file that reproduces the problem:
\documentclass [11pt, proquest] {uwthesis}[2020/02/24]
\setcounter{tocdepth}{1} % Print the chapter and sections to the toc
% for code listings
\usepackage{listings}
\begin{document}
% ----- contents & etc.
%
\tableofcontents
\listoffigures
\lstlistoflistings
\textpages
\begin{figure}
\centering
test
\caption{Pipeline Diagram}
\label{fig:pipeline}
\end{figure}
\begin{lstlisting}[caption=Example file snippet]
hello world
\end{lstlisting}
\end{document}
\documentclass
and end with\end{document}
. Can you do that?.cls
file I was given to account for a List of Listings, as opposed to doing it in the preamble.