我无法为代码环境设置较小的行距。如何强制设置?basicstyle=\linespread{0.8}
没有任何改变。
\documentclass[12pt, a4paper]{report}
\usepackage{listings}
\linespread{1.5}
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{10pt}
\lstset{
basicstyle=\ttm\linespread{0.8},
}
\begin{document}
The line spacing is perfect here.
The line spacing is perfect here too.
\begin{lstlisting}
The code has
too high
line spacing
\end{lstlisting}
The line spacing is perfect here.
The line spacing is perfect here too.
\end{document}