我目前遇到一个问题,即listings包无法将源文件跨多个页面展开。文档中写道,应使用“framed”包进行各种格式设置。不幸的是,我没有找到任何关于“framed”包的文档。我的当前C#源代码格式如下:
源码格式 http://www.free.image.hosting.net/uploads/88987a1ef4.png
不幸的是,图片服务已不存在,而且帖子发布时间超过5年,因此我找不到那张图片。我记得格式化的源代码部分应该显示在下一页,但只是被截断了,根本没有显示出来。
我使用“listings”包的格式如下:
\newcommand{\sourceFormatterCSharp}
{
\lstset
{ language=[Sharp]C
, captionpos=b
%, frame=lines
, morekeywords={var, get, set}
, basicstyle=\footnotesize\ttfamily
, keywordstyle=\color{blue}
, commentstyle=\color{darkgreen}
, stringstyle=\color{darkred}
, backgroundcolor=\color{lightgrey}
, numbers=left
, numberstyle=\scriptsize
, stepnumber=2
, numbersep=5pt
, breaklines=true
, tabsize=2
, showstringspaces=false
, emph={double, bool, int, unsigned, char, true, false, void, get, set}
, emphstyle=\color{blue}
, emph={Assert, Test}
, emphstyle=\color{red}
, emph={[2]\#using, \#define, \#ifdef, \#endif}
, emphstyle={[2]\color{blue}}
, frame=shadowbox
, rulesepcolor=\color{grey}
, lineskip={-1.5pt} % single line spacing
}
}
% first optional param is placement
% param1 file name without extension
% param2 chapter number, e.g. 1 or 2 ...
% param3 caption to use
\newcommand{\embedCSharp}[4][htbp]
{
\sourceFormatterCSharp
\includeListing{#1}{#4}{#3:#2}{#3/#2.cs}
}
有没有人能帮助我使用“framed”包或其他包,使我的源代码看起来类似于这样,但可以跨页面分发?不要给出解释,保留HTML标记。举例说明如何在框架中嵌入列表不会满足我的需求,因为我已经尝试过了。