[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colourising tex keywords
From: |
Jean Louis |
Subject: |
Re: Colourising tex keywords |
Date: |
Tue, 11 Jan 2022 21:33:44 +0300 |
User-agent: |
Mutt/2.1.5+104 (cd3a5c8) (2022-01-09) |
* 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/
- Colourising tex keywords, (continued)
- Colourising tex keywords, fatiparty, 2022/01/11
- Re: Colourising tex keywords, Michael Heerdegen, 2022/01/11
- Re: Colourising tex keywords, fatiparty, 2022/01/11
- Re: Colourising tex keywords, Michael Heerdegen, 2022/01/11
- Message not available
- Colourising tex keywords, fatiparty, 2022/01/11
- Re: Colourising tex keywords, Michael Heerdegen, 2022/01/11
- Re: Colourising tex keywords, fatiparty, 2022/01/11
- Message not available
- Colourising tex keywords, fatiparty, 2022/01/11
- Message not available
- Colourising tex keywords, fatiparty, 2022/01/11
- Re: Colourising tex keywords, Michael Heerdegen, 2022/01/11
Re: Colourising tex keywords,
Jean Louis <=