1

I am using the listing (NOT listings) package and have been trying to use

\renewcommand{\listlistingname}{Índice de código}
\renewcommand{\listingname}{Código}

in order to change the "List of listings" and "Listing" text which appear in the document, since I'm writing in Spanish.

However only \listlistingname seems to work, \listingname makes no change.

Following Vivi's suggestions I have even edited the listing.sty under \tex\latex\ltxmisc, but still the same problem. Editing \listlistingname works, editing \listingname does not. It seems like it was picking the "Listing" text from some other file.

I really don't know what I'm doing wrong, any suggestions?

EDIT: Not even copying the listing.sty into the directory where I have the tex files works, so I guess it has to be picking up the text from some other file, but which one? Here's a list of packages I'm including in my project, just in case:

\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage{listing}
\usepackage{graphicx}
\usepackage{makeidx}
\usepackage{color}
\usepackage{url}
\usepackage{float}
\usepackage{hyperref}
\usepackage{minted}
\usepackage[toc]{glossaries}

Thank you!

  • What version of listing.sty does the log file record? You should have "Package 'listing', V1.2, <1999/05/25>". – Charles Stewart Jun 25 '10 at 11:56
  • I do have that version. Now I got rid of the error as I wasn't explicitly including the package, thought it wasn't neccesary. However, only \listlistingname is working, \listingname keeps displaying "Listing" instead of "Código". Thank you. – carlos.perezb Jun 25 '10 at 16:08
  • I would try changing the file listing.sty directly. When you open that file you will see \newcommand{\listingname}{Listing} and \newcommand{\listlistingname}{List of Listings}. Change to what you want there and see if it solves your problem. Boa sorte :) – Vivi Jun 26 '10 at 14:06
  • Also, check this question: http://stackoverflow.com/questions/2709898/latex-change-list-of-listings-text . It might help you. In other words, have you included both the listing and listings package? – Vivi Jun 26 '10 at 14:09
  • Hi Vivi, thank you for the reply. I already found that question when looking for an answer but no, I am only using the listing package :) Also edited the listing.sty file but the result is the same. Editing \listlistingname works, editing \listingname does not. Weird isn't it? – carlos.perezb Jun 26 '10 at 16:27
  • mmmm... yeah, those weird behaviours happen sometimes. I have a weird behaviour question myself http://stackoverflow.com/questions/3100807/how-to-scroll-down-on-pages-in-doc-view-mode-in-emacs, but they don't seem to get solved easily... I might try and do what you are trying to do to see if I get the same behaviour, and I will let you know what happens if I do try :) – Vivi Jun 27 '10 at 01:26
  • I tried using this package, but I don't even know what it is for, and the documentation is just so poor like I have never seen... And though I sort of agree with the quote at the end of the manual for the package, my God, that was nearly no documentation! – Vivi Jun 27 '10 at 08:24
  • No worries, I'll try to figure something out :) Thank you! – carlos.perezb Jun 27 '10 at 16:53
  • Well, I hope that either that or someone figures it out for you. Sorry I couldn't help... – Vivi Jun 28 '10 at 11:07

1 Answers1

0

This should work:

\addto\captionsspanish{%
  \renewcommand{\lstlistingname}%
{Código}%
 }

I used the TeX FAQ item Changing the words babel uses to find the explanation and this TeX.SE answer for the correct command.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
ezequielb
  • 463
  • 3
  • 7