Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change title in listings?

Tags:

latex

listings

I have a question about the listings package. Do you know how to change it to get a title like this "Algorithm ## Title" rather than the casual "Listing ## Title" in the title line?

like image 425
Michal Avatar asked May 11 '10 21:05

Michal


1 Answers

Put these lines to preamble (the preamble is everything from the start of the LaTeX source file until the \begin{document} command):

\renewcommand\lstlistingname{Algorithm}
\renewcommand\lstlistlistingname{Algorithms}

The first changes the caption name for listings. The second — the header name for the list of listings which is printed by the \lstlistoflistings command. You would also probably want to modify the text in autorefs:

\def\lstlistingautorefname{Alg.}

Then when you're referring to a particular listing, e. g. For details see \autoref{sec2:bubblesort}. it is written as "For details see Alg. 2.1."

like image 185
YasirA Avatar answered Oct 18 '22 17:10

YasirA