Estou tentando colocar um hífen após as entradas da "Lista de Listagens" da seguinte forma:
Lista de Códigos
Código 1--Primeiro Código ................................ 7
Código 2--Segundo Código ................................ 8
Com o seguinte código ...
\documentclass[12pt,openright,oneside,dvipsnames,a4paper,%
chapter=TITLE,section=TITLE,english]{abntex2}
\usepackage{textcomp}
\usepackage{caption}
\usepackage{listings}
\renewcommand{\lstlistingname}{Code} % Listings
\renewcommand{\lstlistlistingname}{List of Codes}%
\lstset{
language = [LaTeX]{TeX}
}
\AtBeginDocument{ %
\counterwithout{lstlisting}{chapter}
}
\begin{document}
\lstinputlisting[caption={First Code}]{code1.tex}
\lstinputlisting[caption={Second Code}]{code2.tex}
\end{document}
Eu tenho:
Lista de Códigos
Código 1 Primeiro Código ................................ 7
Código 2 Segundo Código .............................. 8
Agradecemos antecipadamente por qualquer ajuda.
Responder1
Aqui está uma possibilidade usando otocloft
pacote e parte deresposta da egrégiaparaPersonalizando a lista de listagens geradas por \lstlistoflistings?:
\documentclass[12pt,openright,oneside,dvipsnames,a4paper,%
chapter=TITLE,section=TITLE,english]{abntex2}
\usepackage{textcomp}
\usepackage{caption}
\usepackage{listings}
\usepackage{tocloft}
\renewcommand\lstlistingname{Code} % Listings
\renewcommand\lstlistlistingname{List of Codes}%
\lstset{
language = [LaTeX]{TeX}
}
\AtBeginDocument{ %
\counterwithout{lstlisting}{chapter}
}
\newlength\mylen
\begingroup
\makeatletter
\let\newcounter\@gobble\let\setcounter\@gobbletwo
\globaldefs\@ne \let\c@loldepth\@ne
\newlistof{listings}{lol}{\lstlistlistingname}
\newlistentry{lstlisting}{lol}{0}
\makeatother
\endgroup
\renewcommand\cftlstlistingpresnum{\lstlistingname~}
\settowidth\mylen{\cftlstlistingpresnum\cftlstlistingaftersnum}
\addtolength\cftlstlistingnumwidth{\mylen} %
\renewcommand\cftlstlistingaftersnum{\hfill\textendash\hfill}
\begin{document}
\lstlistoflistings
\begin{lstlisting}[caption={First Code}]
code1
\end{lstlisting}
\begin{lstlisting}[caption={Second Code}]
code2
\end{lstlisting}
\end{document}