0

I use listings that way:

\begin{listing}
    \inputminted{python}{listings/models.py}
    \caption{Models}
    \label{listing:models}
\end{listing}

and I want to change Listing name to another but when I use this command \renewcommand{\lstlistingname}{Another name} it doesn't work. How to change it correctly?

2
  • Welcome to TeX.SX! The chances to get an answer, quick and to the point, considerably increase if you post a complete example, ready to run: A TeX document starting with \documentclass and ending with \end{document}, and a tiny sample Python file. Often, the correct answer depends on the document class and the packages loaded, so the sooner you include the info, the faster people can give advice.
    – gernot
    Jan 7, 2022 at 13:47
  • As you are using the minted package check its manual section 4 (Floating listings). It describes several options depending on the other packages loaded (caption, float, newfloat, …)
    – cgnieder
    Jan 7, 2022 at 14:38

1 Answer 1

1

You need to change the meaning of \listingscaption.

\documentclass{article}
\usepackage{minted}

\renewcommand{\listingscaption}{Whatever}

\begin{document}

\begin{listing}
\inputminted{latex}{\jobname.tex}
\caption{Models}
\label{listing:models}
\end{listing}

\end{document}

I used the same file for the listing, just for the sake of brevity.

enter image description here

You must log in to answer this question.

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