all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: fatiparty@tutanota.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Colourising tex keywords
Date: Tue, 11 Jan 2022 21:33:44 +0300	[thread overview]
Message-ID: <Yd3NiM2s+L1bjr1c@protected.localdomain> (raw)
In-Reply-To: <Mt3Q9Zq--3-2@tutanota.com>

* fatiparty--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2022-01-10 17:56]:
> 
> 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 rcd-highlight-list (list)
  "Uses LIST to highlight strings in buffer."
  (hi-lock-mode)
  (let* ((list (delete "" list))
	(highlights hi-lock-face-defaults))
    (while list
      (highlight-regexp (regexp-quote (pop list)) (pop highlights)))))

\alpha
\beta
\chi
\delta

(rcd-highlight-list '("\\alpha" "\\beta" "\\chi" "\\delta"))

hi-lock-face-defaults ⇒ ("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-salmon" "hi-aquamarine" "hi-black-b" "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb")

Instead of variable `hi-lock-face-defaults' you could make your own
color list there.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  parent reply	other threads:[~2022-01-11 18:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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

  git send-email \
    --in-reply-to=Yd3NiM2s+L1bjr1c@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=fatiparty@tutanota.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.