Discussion:
[AUCTeX] setting same color for math scripts as other math
Tamas Papp
2017-03-15 11:37:38 UTC
Permalink
Hi,

I can't see the DarkRed very well and would like math scripts to have
the same color as other math in AUCTeX (burlywood in dark themes). How
can I achieve this in Emacs Lisp (I could customize, but prefer not to,
so that when I switch color themes it adjusts accordingly).

Is there some Emacs Lisp magic that would copy colors from one face to
another?

Best,

Tamas
Colin Baxter
2017-03-15 11:44:26 UTC
Permalink
Hello Tama,
Post by Tamas Papp
Hi,
I can't see the DarkRed very well and would like math scripts to have
the same color as other math in AUCTeX (burlywood in dark themes). How
can I achieve this in Emacs Lisp (I could customize, but prefer not to,
so that when I switch color themes it adjusts accordingly).
Is there some Emacs Lisp magic that would copy colors from one face to
another?
Best,
Tamas
I quite agree about DarkRed - it's almost invisible. I edited line 1188
of font-latex.el and changed (:foreground "DarkRed")).

Colin.
Mosè Giordano
2017-03-15 11:58:24 UTC
Permalink
Hi Tamas,
Post by Tamas Papp
Hi,
I can't see the DarkRed very well and would like math scripts to have
the same color as other math in AUCTeX (burlywood in dark themes). How
can I achieve this in Emacs Lisp (I could customize, but prefer not to,
so that when I switch color themes it adjusts accordingly).
Is there some Emacs Lisp magic that would copy colors from one face to
another?
To copy a specific attribute (foreground in this case) you can use
something like

--8<---------------cut here---------------start------------->8---
(with-eval-after-load "font-latex"
(set-face-attribute 'font-latex-script-char-face nil
:foreground (face-attribute 'font-latex-math-face
:foreground)))
--8<---------------cut here---------------end--------------->8---

or replace the `(face-attribute ...)' with the color you like.

I don't know if there is something simpler. You can inherit an entire
face with `:inherit` attribute, but that doesn't override other
attributes already set.

Bye,
Mosè
Colin Baxter
2017-03-15 12:15:31 UTC
Permalink
Hi,
Post by Mosè Giordano
Hi Tamas,
Post by Tamas Papp
Hi,
I can't see the DarkRed very well and would like math scripts to have
the same color as other math in AUCTeX (burlywood in dark themes). How
can I achieve this in Emacs Lisp (I could customize, but prefer not to,
so that when I switch color themes it adjusts accordingly).
Is there some Emacs Lisp magic that would copy colors from one face to
another?
To copy a specific attribute (foreground in this case) you can use
something like
(with-eval-after-load "font-latex"
(set-face-attribute 'font-latex-script-char-face nil
:foreground (face-attribute 'font-latex-math-face
:foreground)))
or replace the `(face-attribute ...)' with the color you like.
I don't know if there is something simpler. You can inherit an entire
face with `:inherit` attribute, but that doesn't override other
attributes already set.
Bye,
Mosè
_______________________________________________
auctex mailing list
https://lists.gnu.org/mailman/listinfo/auctex
(face-spec-set 'font-latex-script-char-face '((t (:foreground
"some-color"))) nil) also works for me.
Tamas Papp
2017-03-16 09:22:02 UTC
Permalink
Hi Mosè,
Post by Mosè Giordano
To copy a specific attribute (foreground in this case) you can use
something like
--8<---------------cut here---------------start------------->8---
(with-eval-after-load "font-latex"
(set-face-attribute 'font-latex-script-char-face nil
:foreground (face-attribute 'font-latex-math-face
:foreground)))
--8<---------------cut here---------------end--------------->8---
or replace the `(face-attribute ...)' with the color you like.
I don't know if there is something simpler. You can inherit an entire
face with `:inherit` attribute, but that doesn't override other
attributes already set.
Thanks for the help. It turns out that I was solving a non-problem: I
was using latex-pretty-symbols, which would replace _2 with ₂
(visually), which would then inherit the colors of the _. Belatedly I
realized that font-latex-script-char-face is only supposed to color the
_^ chars, not the actual script. So now it is better out of the box.

Since others also have a problem with DarkRed, perhaps in this line
http://git.savannah.gnu.org/cgit/auctex.git/tree/font-latex.el#n1188
it could be replaced with something more subdued than "burlywood", eg
"peru".

Best,

Tamas

Loading...