unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Colourising tex keywords
@ 2022-01-10 14:37 fatiparty--- via Users list for the GNU Emacs text editor
  2022-01-11 13:22 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-01-11 18:33 ` Jean Louis
  0 siblings, 2 replies; 18+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-10 14:37 UTC (permalink / raw)
  To: Help Gnu Emacs


Have constructed a set of tex symbols stored in (defvar texcom-colour

I want to highlight tex commands such as \alpha using colour (using texcom-colour
for instance).  Although the beginning \ should not be highlighted.  But I am failing 
miserably to implement this.

(defface texcom-colour
  '( (default :inherit bold)
     ( ((class color) (background light)) :foreground "#00FF00" )
     ( ((class color) (background dark))  :foreground "#00FF00" )
     (t :inherit font-lock-builtin-face) )
  "User defined colour typeface for tex command keywords.")

(defface texcom-typeface
  '((t :inherit font-lock-keyword-face))
   "Colour typeface for tex command keywords.")

(defconst texcom-cluster
  `(  (,(rx "\\" word-start (group (or "alpha" "beta" "chi" "delta"))  word-end)
     (1 'texcom-typeface))  ))

(defun texcom-typeface-enable ()
  "Sets the highlight colour for tex commands."
  (font-lock-add-keywords nil texcom-cluster t)
  (font-lock-flush))

(defun texcom-typeface-disable ()
  "Clears the highlight colour for tex commands."
  (font-lock-remove-keywords nil texcom-cluster)
  (font-lock-flush))





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-01-12 23:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-10 14:37 Colourising tex keywords fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 13:22 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-11 16:40   ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 16:41   ` Michael Heerdegen
2022-01-11 17:09     ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 17:48       ` Michael Heerdegen
2022-01-11 18:21         ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 20:09           ` Michael Heerdegen
2022-01-11 21:30             ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 22:47               ` Michael Heerdegen
     [not found]               ` <87ilup3n5w.fsf@web.de-MtAJwby----2>
2022-01-11 23:15                 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-12  0:12                   ` Michael Heerdegen
2022-01-12  0:19                     ` fatiparty--- via Users list for the GNU Emacs text editor
     [not found]                     ` <MtAdxOt--3-2@tutanota.com-MtAeBSi----2>
2022-01-12  1:12                       ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-11 23:27                 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-12  0:13                   ` Michael Heerdegen
2022-01-11 18:33 ` Jean Louis
2022-01-12 23:30   ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).