1

I'm trying to make a latex document in spanish, I've successfully imported the babel package for the language, but the \listoflistings command does not get translated to spanish. Also captions for listings are not translated. I've tried to renew these commands: \renewcommand{\lstlistingname}{Listado} \renewcommand{\lstlistlistingname}{Índice de listados}. Note that I'm also using minted.

Here is the code (MWE):

\documentclass[12pt, twoside, openright]{report}

\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{listings}
\usepackage{minted}

\renewcommand{\lstlistingname}{Listado}
\renewcommand{\lstlistlistingname}{Índice de listados}

\begin{document}

\listoftables
\listoflistings

\chapter{Introducción}
\pagenumbering{arabic}
\setcounter{page}{1}
% \subimport*{./}{chapter01.tex}
\begin{listing}[H]
\begin{minted}[linenos,frame=lines, framesep=2mm,numbersep=5pt]{scala}
val immutableInt = 2
immutableInt = 3    // Compile Error
var mutableInt = 4
mutableInt = 2  // OK
\end{minted}
\caption{val versus var}
\label{lst:scala_valvar}
\end{listing}

\end{document}

Any help would be appreciated.

vicaba
  • 265

1 Answers1

7

Referencing the question (I recommend to read the answers posted): How to change the name of document elements like "Figure", "Contents", "Bibliography", "Appendix", etc.? , the answer is that minted uses other macro names that the ones I was using, concretely, an answer (by @hpesoj626) gives this snippet:

\renewcommand\listingscaption{Code-Snippet}
\renewcommand\listoflistingscaption{List of program codes}

If the babel package is being used, wrap these definitions with \addto\captions<language>{...}

Mensch
  • 65,388
vicaba
  • 265