Emanuel Berg writes: > Sharon Kimble writes: > >> I have a latex command called "\myparencite{foo}" >> which has the same colour as the surrounding text. > > (font-lock-add-keywords 'latex-mode > '(("\\(myparencite\\){\\(.*\\)}" (1 font-lock-constant-face) > (2 font-lock-doc-face) ))) This is working well, except in this situation - --8<---------------cut here---------------start------------->8--- \myparencite{1767}[18] and N-methyl-serotonin \parencite{ }[19]. --8<---------------cut here---------------end--------------->8--- where the green colouration continues after \myparencite into the following text, and even colouring the \parencite which has not yet been worked on. These two lines are from my theme, if its relevant, - --8<---------------cut here---------------start------------->8--- '(font-lock-constant-face ((t (:foreground "#A6E22E")))) '(font-lock-doc-face ((t (:foreground "#EEDC82")))) --8<---------------cut here---------------end--------------->8--- But it is usable so thanks very much. Thanks Sharon. > > Note: If you open a file.tex, you might end up in > TeX-mode or some other mode to do (La)TeX. So, first > see if it works (after evaluation) with > > M-x latex-mode RET > > then, if your mode isn't that, make the substitution > in the code. > >> How can I have a colour of :foreground "green" >> :background "black" for it in my theme please? > > As you see in the code, use the font-lock-* > faces instead. I'm sure one of yours is green, so > use that. > > One way of finding out which one is green is putting > point at a char that has a green face and then invoke > this: > > (defun what-face (pos) > (interactive "d") > (let((face (or (get-char-property pos 'face) > (get-char-property pos 'read-cf-name) ))) > (message " Face: %s" (or face "(no face!)")) )) > > Source: http://user.it.uu.se/~embe8573/conf/emacs-init/faces.el -- A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.50.3