![listings 包引入了不必要的换行符](https://linux22.com/image/362431/listings%20%E5%8C%85%E5%BC%95%E5%85%A5%E4%BA%86%E4%B8%8D%E5%BF%85%E8%A6%81%E7%9A%84%E6%8D%A2%E8%A1%8C%E7%AC%A6.png)
我正在使用 listings 包来包含源代码。这种方法效果很好,但是,有时行会断开,但输入不会在下一行继续,只会显示断开后的箭头。
似乎 listings 包计算换行符不正确,或者将 postbreak 指定的任何内容考虑在内。我已经检查过了清单手册但还没有找到解决这个问题的方法。
最小工作示例是:
\documentclass[12pt, a4paper]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{newcent}
\usepackage{color} % requirement
\usepackage{listings} % reference source code
% a version without custom colors taken from classicthesis
\lstset{language=Haskell,%[LaTeX]Tex,%C++,
morekeywords={PassOptionsToPackage,selectlanguage},
keywordstyle=\color{blue},%\bfseries,
basicstyle=\small\ttfamily,
%identifierstyle=\color{NavyBlue},
commentstyle=\color{green}\ttfamily,
stringstyle=\ttfamily,
numbers=left,%none
numberstyle=\scriptsize,%\tiny
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
breakatwhitespace=false,
%frameround=ftff,
frame=tb,
belowcaptionskip=.75\baselineskip,
captionpos=b,
literate={\>}{}{0\discretionary{>}{}{>}},
%frame=L
}
\begin{document}
\chapter{Hello World}
\section{Minimal Working Example}
aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \lstinline{all} do not use lambda functions.
\end{document}
输出为: