TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some listings that contain pseudo-code of algorithms. And I use this: \lstset{caption={Descriptive Caption Text},label=DescriptiveLabel} to add captions to them.

My problem is that the caption at the created file shows Listing 1: Descriptive Caption Text. I would like it to write something like Algorithm 1: Descriptive Caption Text.

How can this be done?

share|improve this question
Related: Rename “Algorithm” to “Listing” – Werner Jul 26 '12 at 23:15
up vote 17 down vote accepted

The following modifications are what you're after:

\renewcommand{\lstlistingname}{Algorithm}% Listing -> Algorithm
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}% List of Listings -> List of Algorithms

enter image description here

\usepackage{listings}% http://ctan.org/pkg/listings
\renewcommand{\lstlistingname}{Algorithm}% Listing -> Algorithm
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}% List of Listings -> List of Algorithms

\begin{lstlisting}[caption={Descriptive Caption Text},label=DescriptiveLabel]
for i:=maxint to 0 do
{ do nothing }
Write('Case insensitive ');
WritE('Pascal keywords.');


The example was taken directly from the listings documentation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.