frame = lines
这段代码根据是否存在来生成列表中不同字体的大小。
\documentclass[a4paper,10pt]{book}
\usepackage{listings}
\makeatletter
\def\@afterheading{\everypar{\fontsize{9.5pt}{12pt}\selectfont}}
\makeatother
\lstset{
frame = lines,% SOMETHING IS GOING ON HERE
basicstyle=\ttfamily\fontsize{20pt}{10pt}\selectfont
}
\begin{document}
\begin{lstlisting}
12312313
\end{lstlisting}
\section{A heading}
\begin{lstlisting}
12312313
\end{lstlisting}
\end{document}
如果我删除frame = lines,
那么