0

I'm using lstlisting to insert a code in my text. Fine. But I'm writing in PT_BR and want to change the word "Listing" to "Listagem" in my list (list caption from english to portuguese) so my code listing will become

Listagem 1. Texto em português

instead

Listing 1. Texto em português

Now using:

\usepackage{sbc-template}  
\usepackage{graphicx,url}
\usepackage[brazil]{babel}   
\usepackage[utf8]{inputenc}   
\usepackage[square,authoryear]{natbib}
\usepackage{blindtext}
\usepackage{enumitem}
\usepackage{listings}
\usepackage{color}

\lstset{
  frame=tb,
  language=Java,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=left,
  numbersep=5pt,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}

and the code in the text:

\begin{lstlisting}[language=bash,caption={Texto em português},label=mylabel]

#some code

\end{lstlisting}

How can I do this?

  • See section 5.7 of the listings documentation: the \lstlistingname macro, in particular. – Mike Renfro Mar 13 '17 at 2:07
  • Nice! Can you turn your comment into an answer so I can accept it? – Magno C Mar 13 '17 at 18:53
  • I can, but the question has been answered several times before (didn't check for duplicates before I commented). Will move to close this question as a result. – Mike Renfro Mar 14 '17 at 3:01
  • Agree. Sorry for this. – Magno C Mar 16 '17 at 0:05

Browse other questions tagged or ask your own question.