I've suceeded in creating list of listings, but the font of the /lstlistoflistings is too large. I don't have any idea how to decrease it.
1 Answer
For the title a quick workaround is to include a size command in the name of the list:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[float,caption=A listing]
This is a listing
\end{lstlisting}
\def\lstlistlistingname{\small Listings}
\lstlistoflistings
\end{document}
Changing the font size of the list items is more difficult. You can copy the definition of \lstlistoflistings
from the package source and add a size command just before the \tableofcontents
command in that definition. Also include \makeatletter
and \makeatother
around the redefinition because the code contains @
symbols. Here I used \footnotesize
for the list items.
MWE:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[float,caption=A listing]
This is a listing
\end{lstlisting}
\begin{lstlisting}[float,caption=Another listing]
This is a listing
\end{lstlisting}
\def\lstlistlistingname{\small Listings}
\makeatletter
\def\lstlistoflistings{%
\bgroup \let\contentsname\lstlistlistingname%
\let\lst@temp\@starttoc%
\def\@starttoc ##1{\lst@temp {lol}}%
\footnotesize% here the size command is added
\tableofcontents%
\egroup}
\makeatother
\lstlistoflistings
\end{document}
-
But when I want to change the font size of the list below the title ?– KonradCommented Jan 12, 2022 at 21:02
-
\normalsize
so it should not be "too large" and would not normally have its own font settings. can you add a small example to your question that shows the problem?