【问题标题】:How to break listing to pages in latex?如何在乳胶中将列表分解为页面?
【发布时间】:2019-03-04 04:32:17
【问题描述】:

我正在尝试将我的列表拆分为多个页面,但很遗憾,它不起作用。

我已阅读如果您设置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,
}

【问题讨论】:

  • 设置好了,但页面没有中断。

标签: latex listings


【解决方案1】:

假设您想指定新页面在列表中的开始位置,您可以使用escapeinside 选项来执行此操作。 breaklines 选项设置为 true 时可确保换行以水平适应页面。

通过指定escapeinside=`` ,您可以转义两个反引号(`)之间的列表上下文。要换行,您可以在反引号之间插入\newpage,如下所示:

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

    `\newpage`

    page 2
\end{lstlisting}

列表应分成两页,page 1 写在一页,page 2 写在下一页。

【讨论】:

    猜你喜欢
    • 2015-01-14
    • 2014-12-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多