列表标题前的分页符

列表标题前的分页符

我对列表列表有以下设置:

    \lstset{
  language=XML,
  numbers=left,        
  numberstyle=\tiny\color{gray},
  stepnumber=1,                   
  numbersep=5pt,                  % how far the line-numbers are from the code
  backgroundcolor=\color{white},      % choose the background color. You must
  showspaces=false,               % show spaces adding
  showstringspaces=false,         % underline spaces
  showtabs=false,                 % show tabs within strings
  frame=single,                   % adds a frame
  rulecolor=\color{black},        % if not set, the frame-color
  tabsize=2,                      % sets default tabsize to 2 spaces
  captionpos=b,                   % sets the caption-position to bottom
  breaklines=true,                % sets automatic line breaking
  breakatwhitespace=false,        % sets if automatic breaks should only happen
  title=\lstname,                   % show the filename of files
                                  % also try caption instead of title
  keywordstyle=\color{blue},          % keyword style
  commentstyle=\color{dkgreen},       % comment style stringstyle=\color{mauve},
  breakautoindent=true,
  framextopmargin=6pt,
  framexbottommargin=6pt,
  belowcaptionskip=10pt,
  abovecaptionskip=1.2em,
  aboveskip=15pt,
}

当我在页面末尾添加列表时,就会出现问题。有时,列表的标题会显示在下一页上 - 无需任何代码:

新页面没有代码但有标题

我确实希望在我的列表中有分页符,但我不希望在标题前有分页符。

相关内容