如何使用 LaTeX 以 Pragmatic Programmer 书籍系列的风格格式化源代码列表?
当我阅读实用书架书籍时,它具有以下格式:
http://img210.imageshack.us/img210/2965/screenshot20100717at121.png- How can I do that with LaTeX?左侧的行号、着色的源代码和灰色的源名称。
- 使用 LaTeX 列出源代码的工具是什么?
When I read Pragmatic Bookshelf books, it has the following format:
http://img210.imageshack.us/img210/2965/screenshot20100717at121.png
- How can I do that with LaTeX? Line numbers at the left side, coloring source code, and grayed source name.
- What's the tools for source code listing with LaTeX?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用于在 LaTeX 中格式化源代码的包是 listings。请在此处查看其手册。
这就是我设法达到的接近程度:
标题中的文件名也是
下载
链接的目标。抱歉缺少圆角。这些或许可以通过 TikZ 来完成。这是序言:
然后,在正文中排版一个列表:
我喜欢 LaTeX。
The package for formatting source code in LaTeX is listings. Check out what it can do in its manual here.
This is how close I managed to get:
The filename from the caption is also the target of the
Download
link. Sorry about the lack of round corners. Those can probably be done with TikZ.Here's the preamble:
Then, typeset a listing in the body with:
I love LaTeX.