I have limited horizontal space to list some code:
\documentclass[]{article}
\usepackage{xcolor}
\usepackage{listings}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
language=bash,
basicstyle=\footnotesize\ttfamily,
keepspaces=true,
}
\lstset{style=mystyle}
\begin{document}
\begin{lstlisting}
C_10 := elementwise.range_check(C_4,S_5,S_6)
\end{lstlisting}
\end{document}
and I want to squeeze it horizontally a bit. (Yes, I know in this example it extends to the end of the line; but maybe I have it in a minipage or in a multi-column document etc.)
Now, I don't want to go \tiny, just a bit of horizontal squeeze. If I weren't in an lstlistings environment, I might use something like a scalebox, or perhaps textls, but I don't really have that flexibility (I think) within an lstlistings environment. I'm assuming there must be something I need to put into the basicstyle package parameter in \lstset; but - what?


\ttfamily) code? – einpoklum Jul 07 '17 at 11:15\small? or choose a different, less wide, monospace font. Squashing it horizontally only sounds like vandalism:-) – David Carlisle Jul 07 '17 at 11:18\ttdefaultinside\lstlistingsto a narrower font.URW Letter Gothicseems to be a narrower monospaced font (to be used with thescaledoption). – Bernard Jul 07 '17 at 11:44