1

I am trying to use "Figure" as name of listings in listoflistings with minted and newfloat fix, but it does not work. Latex keeps showing minted environment as Figures instead of Listening:

enter image description here

\documentclass[10pt,a5paper]{abntex2}
\usepackage[brazil]{babel}
\usepackage{listings}
\usepackage{caption}
\usepackage{newfloat}
\usepackage{etoolbox}

% https://tex.stackexchange.com/questions/57353/how-to-get-caption-above-listing-with-minted
\usepackage[newfloat,chapter]{minted}
\captionsetup[listing]{position=top}
\newenvironment{code}{\captionsetup{type=listing}}{}

% https://tex.stackexchange.com/questions/269491/mixing-minted-with-lstlisting
\AtBeginEnvironment{listing}{\setcounter{listing}{\value{lstlisting}}}
\AtEndEnvironment{listing}{\stepcounter{lstlisting}}

% https://tex.stackexchange.com/questions/287947/figure-as-name-of-listings-in-listoflistings-with-minted-and-newfloat/287953#287953
\makeatletter
\let\l@listing\l@figure
\def\newfloat@listoflisting@hook{\let\figurename\listingname}
\makeatother

\begin{document}

\lstlistoflistings

\chapter{Formatador}

\begin{code}
\caption{My Func}
\label{lst:my_func}
\inputminted[fontsize=\small,linenos=true,numberblanklines=true,breaklines=true]{latex}{test1.tex}
\end{code}

\end{document}
0

1 Answer 1

0

I fixed it by replacing \lstlistoflistings with:

{%
\renewcommand{\cftfigurename}{\listingname\space}
\lstlistoflistings
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .