I need to put \listoffigures, \listoftables and \lstlistoflistings on the same page. The first two are ok, but the list of listings ends on a different page. This is what I tried:
\begingroup
\let\clearpage\relax
\listoffigures
\listoftables
\lstlistoflistings
\endgroup
But the output is this:
Also, the list of listings (Elenco dei listati di codice in the image) is on page vii, but with this commands it appears on page v in the table of contents:
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{\listfigurename}
\cleardoublepage
\addcontentsline{toc}{chapter}{\listtablename}
\cleardoublepage
\addcontentsline{toc}{chapter}{\lstlistlistingname}
How do I fix that?
EDIT:
minimum working example, I hope this is how a MWE is meant to be as it is the first time I use Latex. Sorry I had to repeat the same image and table many times, but the problem occur only if list of images and list of tables are more than one page. I also included all the packages I use, in case there are some compatibility issues that I don't know.
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage[left=3cm, right=3cm, bottom=3cm]{geometry}
\usepackage{setspace}
\usepackage{verbatim}
\usepackage{listings}
\usepackage[hang,small,sf,font=scriptsize, labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage[stable]{footmisc}
\usepackage{cite}
\usepackage[english]{varioref}
\usepackage[usenames]{color}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage[hidelinks]{hyperref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{csquotes}
\usepackage{lipsum}
\usepackage{mdframed}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage[toc,page]{appendix}
\begin{document}
\thispagestyle{empty}
\cleardoublepage
\pagenumbering{roman}
\thispagestyle{empty}
\clearpage{\pagestyle{plain}\cleardoublepage}
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{\listfigurename}
\cleardoublepage
\addcontentsline{toc}{chapter}{\listtablename}
\cleardoublepage
\addcontentsline{toc}{chapter}{\lstlistlistingname}
\begingroup
\let\clearpage\relax
\listoffigures
\listoftables
\lstlistoflistings
\endgroup
\clearpage{\pagestyle{plain}\cleardoublepage}
\pagenumbering{arabic}
\clearpage{\pagestyle{plain}\cleardoublepage}
\chapter{Test}
\label{chapter:test}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\begin{table}
\centering
\begin{tabular}{l|r}
Item & Quantity \\\hline
Widgets & 42 \\
Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\lstinputlisting[language=Python, caption=test, label=ls:rectF]{test.py}
\end{document}
As you can see, the list of tables starts immediately after the list of images, but the list of listings starts on new page...I want it to start immediately after the list of tables. In case you need it, I used this class for listings:
Class test():
def __init__(self):
pass
def func(self):
pass