
我無法獲得程式碼環境的小行間距。怎麼強制呢?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}