I know I can add keywords to font-lock-mode
using font-lock-add-keywords
.
However, I would like to change the font color of the parameter to a latex function.
In Latex mode, if I write:
\cite{Somebody1999}
then Somebody1999
will be highlighted in font-lock-constant-face
.
However, if I write:
\citeasnoun{Somebody1999}
Then citeasnoun
is correctly colored as font-lock-keyword-face
, but Somebody1999
is colored as "default". Presumably the mode recognizes that a backslash makes this a function, but it does not recognize citeasnoun
as a keyword.
I've tried adding citeasnoun
to the list of font-lock-keyword-face
, but this did not have an effect.
Currently, the default highlighting used latex-mode does not let you customize the list of "cite-like" commands. But you can try something like
(add-hook 'latex-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\\\citeasnoun{\\([^}\n]+\\)" (1 'font-lock-constant-face))))))
If you use AUCTeX, then you'll probably have to change the above code to use LaTeX-mode-hook
instead.