如何在 Latex 中打破列表到页面?

N33*_*33D 5 latex listings

我试图将我的列表分成几页,但不幸的是,它不起作用。

我读过如果你设置它应该自动工作breaklines=true。我不能。是否有另一种选择而不创建多个列表?

    \lstset{numbers=left,
    columns=fullflexible,
    stepnumber=1,
    basicstyle=\footnotesize\ttfamily,
    numberstyle=\color{lineNumberColor}\tiny,
    inputencoding=utf8,
    showtabs=false,
    extendedchars=true,
    showstringspaces=false,
    showspaces=false,
    tabsize=4,
    postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{pred}\hookrightarrow\space}},
    commentstyle=\slshape\color{commentColor},
    keywordstyle=\color{keywordColor}\bfseries,
    stringstyle=\color{stringColor}\ttfamily,
    breaklines=true,
    breakatwhitespace=true,
}
Run Code Online (Sandbox Code Playgroud)

例子

upe*_*upe 5

假设您要指定列表中新页面的开始位置,您可以使用该escapeinside选项来实现。该breaklines选项确保在设置为 true 时换行以水平适合页面。

通过指定escapeinside=`` ,您可以转义两个反引号 ( `)之间的列表上下文。要中断一行,您可以\newpage像这样在反引号之间插入:

\begin{lstlisting}[escapeinside=``]
    page 1

    `\newpage`

    page 2
\end{lstlisting}
Run Code Online (Sandbox Code Playgroud)

清单应该分成两页,page 1写在一页上,page 2写在下一页。