unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: fatiparty--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Colourising tex keywords
Date: Mon, 10 Jan 2022 15:37:59 +0100 (CET)	[thread overview]
Message-ID: <Mt3Q9Zq--3-2@tutanota.com> (raw)


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))





             reply	other threads:[~2022-01-10 14:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 14:37 fatiparty--- via Users list for the GNU Emacs text editor [this message]
2022-01-11 13:22 ` Colourising tex keywords 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Mt3Q9Zq--3-2@tutanota.com \
    --to=help-gnu-emacs@gnu.org \
    --cc=fatiparty@tutanota.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).