When I compile the .tex file below into .pdf using rubber -d mwe.tex and try to copy & paste the contents of the listing, I get spaces around . characters that were not present in the original listing. How do I force listings to preserve spacing (i.e. not add any) and always show exactly what I've typed?
\documentclass{article}
\usepackage{listings}
\lstset{language=sh}
\begin{document}
\title{Lol}
\maketitle
\section{Introduction}
Where does spaces around dot comes from:
\begin{lstlisting}
lxc.id_map = g 0 100000 65536
\end{lstlisting}
\end{document}
listingsis rubbish, but at least it forces you to read the docs to change the formatting to something more sane. – Thruston Jun 22 '15 at 14:24\lstset{language=sh, basicstyle=\ttfamily}to get it to use type writer font for everything, which makes the spacing look better, but @Jubobs comments about cutting and pasting still apply - it's notoriously unreliable to c&p spaces from PDF. – Thruston Jun 22 '15 at 14:30\lstset{language=sh, columns=fullflexible}, but again you still might get oddities if you cut and paste from PDF. – Thruston Jun 22 '15 at 14:32