Background
Syntax-highlighted source code image listings are being used as Algorithm floats with the lst:
prefix for captions.
Problem
The following LaTeX code in the preamble renames the caption for the Algorithm float to Listing, as desired:
\usepackage{float}
\floatname{algorithm}{Listing}
However, the cross-reference label using the following command remains "Algorithm" (should be "Listing"):
\ref{lst:Internationalization-Look-up-Method}
Essentially, I am trying to rename Algorithm floats to Listing floats. (The book will have no algorithms.) LyX has Algorithm
, Figure
, and Table
as floats to insert. If there was a way to configure and add Listing
to the same menu (Insert >> Float >> Listing), that would also be a great solution.
Ideas
The following failed:
\usepackage{caption}
\usepackage{listings}
\renewcommand{\lstlistlistingname}{Listings}
\renewcommand{\lstlistingname}{Listing}
The following eliminated the word "Algorithm" for the reference label altogether:
\usepackage{caption}
\usepackage{listings}
\renewcommand\lstlistingname{Listing}
\renewcommand\lstlistlistingname{Listings}
\def\lstlistingautorefname{Listing}
I have not yet looked into the babel
package.
Question
How can you rename "Algorithm" to "Listing" everywhere, including:
- Caption
- Label reference
- In the front matter (i.e., List of Listings rather than List of Algorithms)