使用 LaTeX 中的列表格式化 Objective C 代码
我想知道如何使用 LaTeX 的 listings
包来格式化 Objective C 代码?我知道该语言支持 C (Objective) ,那么如何在 \lstset
language
选项中设置它?
谢谢
I am wondering how one is supposed to format Objective C code using the listings
package of LaTeX? I know that the language supports C (Objective) , so how do i set this in the \lstset
language
option?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样:
详细介绍:http://mirror.hmc.edu /ctan/macros/latex/contrib/listings/listings.pdf
Like this:
Detailed introduction: http://mirror.hmc.edu/ctan/macros/latex/contrib/listings/listings.pdf
虽然这个答案本身并没有回答OP的问题,但我认为其他寻找 Objective-C
listings
相关信息的人会偶然发现这个问题。下面是 Objective-C 2.0、GNU99 和 ANSI C99 的
列表
\lstdefinelanguage
。虽然listings
包含 C 和 Objective-C 的定义,但这些定义适用于较旧的 C89 标准和 Objective-C 1.0。下面的版本添加了C99,将GNU99添加到C99,然后将Objective-C(2.0)添加到GNU99。如果您对关键字使用的字体样式与“正常”字体样式不同,您可能只会看到差异。
我是下面代码的作者(ANSI C99 定义除外,它源自
listings
ANSI C 并针对 ANSI C99 进行了修改)。您可以以任何您希望的方式使用它,包括将其合并到其他作品中,而无需归属或补偿。我特此将其置于公共领域。 (注:这主要是针对那些为雇主工作的人,他们对这些事情非常挑剔,我真的不在乎。)Although this answer is not answering the OP's question per se, I figure others looking for Objective-C
listings
related information will stumble across this question.Below is a
listings
\lstdefinelanguage
for Objective-C 2.0, GNU99, and ANSI C99. Whilelistings
includes definitions for both C and Objective-C, the definitions are for the older C89 standard and Objective-C 1.0. The version below adds C99, adds GNU99 to C99, and then adds Objective-C (2.0) to GNU99.You're probably only go to see a difference if you use a font style for keywords that's different than the "normal" font style.
I am the author of the code below (except for the ANSI C99 definition, which was derived from the
listings
ANSI C and modified for ANSI C99). You may use it any way you wish, including incorporating it in to other works, without attribution or compensation. I hereby place it in the public domain. (Note: this is mostly for those who work for employers who are really picky about such things, I really don't care.)