I want to include a short code snippet using the listings
package. I have already chosen the parameters for \lstset
and my C++ code looks nice with these setttings.
For an inline code snippet I try to use the \lstinline
command. But when trying something like this:
\lstinline$#define EXAMPLE$
the output is like this:
#
define
EXAMPLE
instead of this:
#define EXAMPLE
I made a minimal version and could see that it is because of \singlespacing
in my \lstset
settings. How can I fix this without losing the \singlespacing
command?
minimal version:
\documentclass[a4paper,oneside,12pt,2.1headlines]{scrreprt}
\usepackage{setspace}
\usepackage{listings}
\lstset{
basicstyle=\singlespacing
}
\begin{document}
\lstinline$#define EXAMPLE$
\end{document}