# Listing index uses wrong dashes

When generating an index of all my Listings, the library seems to use the wrong dashes to connect words:

Expected

Unported-2.0-Graphic


Actual

Unported—2.0—Graphic


In the title of the listings, I used the normal dash -, so it has to be somewhere in the library that the double dashes -- are created.

As this is not really a big issue, but totally wrong typography, I'd very much like to change it to the correct way.

MWE

\documentclass[11pt,oneside,a4paper]{scrartcl}
\usepackage{listings}
\lstset{caption=\lstname}
\begin{document}
\lstlistoflistings
\begin{lstlisting}[name=Unported-2.0-Graphic]
\end{lstlisting}
\end{document}

-
Please add a minimal working example (MWE) that illustrates your problem. –  Joseph Wright Sep 6 '11 at 7:57
Done. Sorry for forgetting –  Florian Peschka Sep 6 '11 at 12:59

The listings package defines an internal command for replacements within filenames. One of these replacements replaces - with \textendash. You can redefine this command to make the hyphens actual hyphens:

\documentclass[11pt,oneside,a4paper]{scrartcl}
\usepackage[]{listings}
\makeatletter
\def\lst@filenamerpl{_\textunderscore \$\textdollar}
\makeatother
\lstset{caption=\lstname}
\begin{document}
\lstlistoflistings
\begin{lstlisting}[name=Unported-2.0-Graphic]
\end{lstlisting}
\end{document}


-