\documentclass{scrartcl}
\usepackage{parskip}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}
\lstinline!ab c de fg hijk lmno pqr st u vwyxz!\\
\lstinline!a bc de f g hi jk lmno pqr st u vwyxz!
\begin{lstlisting}
ab c de fg hijk lmno pqr st u vwyxz
a bc de f g hi jk lmno pqr st u vwyxz
\end{lstlisting}
\begin{verbatim}
ab c de fg hijk lmno pqr st u vwyxz
a bc de f g hi jk lmno pqr st u vwyxz
\end{verbatim}
\end{document}
The spacing with \lstinline matched the spacing with verbatim. but the
lstlisting environment uses larger spaces.
Is there any way to change this behavior?
Thanks for your help.
> The spacing with \lstinline matched the spacing with verbatim. but the
> lstlisting environment uses larger spaces.
>
> Is there any way to change this behavior?
\lstset{basicstyle=\ttfamily,columns=fullflexible}
\begin{lstlisting}[columns=flexible]
--
Ulrike Fischer
While we're on the topic, is there any way to get multiple spaces to
line up correctly with this option? See below, where the ascii
indentation is completely broken:
\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,columns=flexible}
\begin{document}
\lstinline!ab c de fg hijk lmno pqr st u vwyxz!\\
\lstinline!a bc de f g hi jk lmno pqr st u vwyxz!
\begin{lstlisting}
line up to here ->
spaces up to <- here
\end{lstlisting}
\end{document}
Cheers,
Will
>> \begin{lstlisting}[columns=flexible]
>
> While we're on the topic, is there any way to get multiple spaces to
> line up correctly with this option?
You could misuse the showspace option:
\listfiles
\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,columns=flexible,showspaces=true}
\begin{document}
\noindent
\lstinline!ab c de fg hijk lmno pqr st u vwyxz!\\
\lstinline!a bc de f g hi jk lmno pqr st u vwyxz!
\begin{lstlisting}
line up to here ->
spaces up to <- here
\end{lstlisting}
\makeatletter
\def\lst@visiblespace{\phantom{\lst@ttfamily{\char32}\textvisiblespace}}
\makeatother
\begin{lstlisting}
line up to here ->
spaces up to <- here
\end{lstlisting}
\end{document}
--
Ulrike Fischer
> You could misuse the showspace option:
Nice idea, thanks!
This is one of the reasons I've stuck to fancyvrb still (in many cases).
Cheers,
Will