2

LaTeX 有一个 expl3 库,其功能如下:

\fp_new:N
\fp_set:Nn

我正在使用 LaTeX 模式,它们显示如下:

在此处输入图像描述

如何让它以关键字颜色显示整个函数并忽略其中的下划线符号?

我试过这个:

(font-lock-add-keywords 'LaTeX-mode
  '(("\fp_new:N" . font-lock-keyword-face)))

但这没有帮助。

4

1 回答 1

2

我已经安装了 AUCTeX。这里有一些例子——第二组引号是空的,而不是波浪形或方括号。我个人更喜欢定义自己的字体和关键字,这是一种不同的格式。

;; \EFFECT{[font-lock-function-name-face]}
(setq font-latex-match-function-keywords
    '(
        ("newcommandx" "*|{\\[[{")
    )
 )


;; \EFFECT{[font-lock-constant-face]}
(setq font-latex-match-reference-keywords
    '(
        ("fancypagestyle" "[{")
        ("fancyfoot" "[{")
    )
 )


;; \EFFECT{[font-lock-type-face]}
(setq font-latex-match-textual-keywords
    '(
        ("parentext" "{")
        ("hybridblockquote" "[{")
        ("parskip" "")
    )
)


;; \EFFECT{[font-lock-variable-name-face]}
(setq font-latex-match-variable-keywords
    '(
        ("newgeometry" "[{")
        ("quotingsetup" "[{")
    )
)


;; \font-latex-warning-face
(setq font-latex-match-warning-keywords
    '(
        ("fixme" "{") 
    )
)


;; only affects inside wavy brackets
(setq font-latex-user-keyword-classes
          '(("my-warning-commands"
                (("fixme" "{"))
                (:foreground "purple" :background "yellow")
                command)))

这是另一个使用我自己的字体的示例:

(defvar lawlist-regular (make-face 'lawlist-regular))
(set-face-attribute 'lawlist-regular nil :background "white" :foreground "black" :font "Courier" :height 180)


(font-lock-add-keywords 'latex-mode '(

("INCLUDE\\|REVISED" 0 lawlist-red t)

("\\(foo\\)-\\(bar\\)" (1 lawlist-super-orange t) (2 lawlist-super-cyan t))

("\\(hello\\) \\(World\\)" (1 lawlist-super-orange t) (2 lawlist-super-blue t))

) 'prepend)
于 2013-06-14T05:07:31.087 回答