如何为 LaTeX 列表创建黑底白字样式
我一直在看 Philip Bunge 关于如何创建“Tango”风格的帖子使用 LaTeX 列表,并尝试对其进行调整以使默认文本样式变为白色,背景变为黑色(这是针对幻灯片,而不是文章!)。这是我添加的内容:
\definecolor{Black}{gray}{0.0}
\definecolor{White}{gray}{0.9}
...
\lstset{
basicstyle=\color{White},
backgroundcolor=\color{Black},
...
}
这假设 basicstyle
设置所有文本的默认样式。列表文档是这样说的:
在每个列表的开头选择 basicstyle。您可以使用 \footnotesize, \small、\itshape、\ttfamily 或类似的东西。的最后一个标记不得读取任何后续字符。
其输出仍然将“默认”文本显示为黑色。可以设置more样式指令来覆盖给定编程语言中的大多数标记,但即使这样做,也会丢失一些标记(例如括号和其他标点符号)。我做错了什么?
I've been looking at Philip Bunge's post on how to create a "Tango" style with LaTeX listings, and trying to adapt this to make the default text style white and the background black (this is for slides, not an article!). This is what I added:
\definecolor{Black}{gray}{0.0}
\definecolor{White}{gray}{0.9}
...
\lstset{
basicstyle=\color{White},
backgroundcolor=\color{Black},
...
}
This assumes that basicstyle
sets the default style of all text. The listings documentation says this:
basicstyle is selected at the beginning of each listing. You could use \footnotesize,
\small, \itshape, \ttfamily, or something like that. The last token of must not read any following characters.
The output of this still shows "default" text as black. It is possible to set more style directives that cover most tokens in a given programming language, but even doing this some tokens (such as brackets and other punctuation) will be missed. What did I do wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下代码对我有用,但我将
.dvi
文件转换为.pdf
以使文本显示为白色,所以它可能是您的查看器?我正在使用xdvi
和xpdf
。我希望这有帮助!
The following code worked for me, but I converted the
.dvi
file to a.pdf
in order to have the text appear as white, so it might have been your viewer? I'm usingxdvi
andxpdf
.I hope that helps!