2

I'm using the package listings for the code snippets in my document. But I want them to be named "Code" rather than "listings". I already got that in my document, but when I create a \lstlistoflistings, it still is titled with "Listings".

How can I change the topic to "Code fragments"? (or anything else?)

\documentclass{article}

\usepackage{listings}

\begin{document}

\lstlistoflistings
\renewcommand{\lstlistingname}{Code}

\section{foo}

\begin{lstlisting}[caption={A listing}]
    Some source code
\end{lstlisting}

\end{document}
1

While \lstlistingname gives the name of a single listing, the name for the list of listings is given by \lstlistlistingname. So just do:

\renewcommand{\lstlistlistingname}{Code fragments}

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.