【问题标题】:Syntax highlighting Javascript in LyX, insert child -> program listing在 LyX 中突出显示 Javascript 的语法,插入子项 -> 程序列表
【发布时间】:2012-05-02 19:58:03
【问题描述】:

我正在写我的硕士论文,其中包括 alotta javascript。 我将它作为子文件包含在内,作为具有以下选项的程序列表:

breaklines=true
captionpos=b
frame=tb
language=Python

没有 javascript 语言/列表文件,这就是我尝试 python 的原因。也尝试过Java,但都没有多大用处。

有什么方法可以在这里突出显示一些 js 语法吗?代码真的很多,全黑的时候不太好看。

谢谢

【问题讨论】:

    标签: javascript syntax-highlighting lyx


    【解决方案1】:

    实际上并没有 JavaScript/语言文件,但您可以手动自定义。当您在 LyX 编辑器中右键单击代码块时,Parameters->Advanced 选项卡,您可以手动放置列表选项(注意:我的 LyX 是法语,因此点击路径可能会略有不同)。

    关注http://lenaherrmann.net/2010/05/20/javascript-syntax-highlighting-in-the-latex-listings-package 我添加了:

    comment={[l]{//}}
    commentstyle={\color{purple}\ttfamily}
    identifierstyle={\color{black}}
    keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}
    keywordstyle={\color{blue}\bfseries}
    morecomment={[s]{/*}{*/}}
    ndkeywords={class, export, boolean, throw, implements, import, this}
    ndkeywordstyle={\color{darkgray}\bfseries}
    sensitive=false
    stringstyle={\color{red}\ttfamily}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-21
      • 1970-01-01
      • 2014-02-27
      • 1970-01-01
      • 1970-01-01
      • 2022-06-23
      • 2012-06-24
      相关资源
      最近更新 更多