Consider this small example:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{listings} %for listings of the source code
\begin{document}
\lstset{language=sh}
\begin{lstlisting}
-- <-- Works!
a--b <-- Does not work!
-{}- <-- Won't help!
\end{lstlisting}
\end{document}
How to force lstlisting
to typeset --
instead of a long dash always? Also, how to increase distance between two consecutive dashes?
Best Answer
You can use the option
literate
to modify the output:Furthermore you shouldn't use the option
utf8x
. An explanation can be found in the question utf8x vs. utf8 (inputenc)