0

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.

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>{...}

  • Why should I wrap them if using babel? It works for me without doing it. And could you please provide an example for ngerman? – problemofficer Oct 20 '17 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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