Discussion:
[AUCTeX] Carets and underscores become red occasionally in math mode .
Kourosh Kalayeh
2018-08-12 19:26:05 UTC
Permalink
Hi all,

I have a minor question regarding the syntax highlighting in math mode
that has been bugging me for a while. I was wondering if anyone can
help me with that. Here it is,
AUCTeX sometimes color the caret (^) and the underscore (_) red in math
mode (which should normally be orange). I could not find the reason of
this behavior. For example look at the attached two screenshots, they
are both from one document, in one of them everything is orange, and in
the other one the caret and underscore signs are red.
I use “align” environment for my equations.

- Normal orange caret and underscore

![](cid:B9D38482-E9B6-428A-A6AC-***@umbc.edu
"normal_caret_and_underscore.png")


- Red caret and underscore

![](cid:5D85C1C0-D501-4F0A-8C29-***@umbc.edu
"red_caret_and_underscore.png")

Thanks,
Kourosh
Arash Esbati
2018-08-13 19:31:03 UTC
Permalink
Post by Kourosh Kalayeh
I have a minor question regarding the syntax highlighting in math mode
that has been bugging me for a while. I was wondering if anyone can
help me with that. Here it is,
AUCTeX sometimes color the caret (^) and the underscore (_) red in
math mode (which should normally be orange). I could not find the
reason of this behavior. For example look at the attached two
screenshots, they are both from one document, in one of them
everything is orange, and in the other one the caret and underscore
signs are red.
I use “align” environment for my equations.
Hi Kourosh,

I can't reproduce what you're describing. This is how your examples
look for me. N.B. I don't use any themes or any customization to AUCTeX
fonts:
Kourosh Kalayeh
2018-08-14 01:53:33 UTC
Permalink
Post by Arash Esbati
Post by Kourosh Kalayeh
I have a minor question regarding the syntax highlighting in math mode
that has been bugging me for a while. I was wondering if anyone can
help me with that. Here it is,
AUCTeX sometimes color the caret (^) and the underscore (_) red in
math mode (which should normally be orange). I could not find the
reason of this behavior. For example look at the attached two
screenshots, they are both from one document, in one of them
everything is orange, and in the other one the caret and underscore
signs are red.
I use “align” environment for my equations.
Hi Kourosh,
I can't reproduce what you're describing. This is how your examples
look for me. N.B. I don't use any themes or any customization to AUCTeX
Maybe you disable any themes (if any) and try it again. For the next
time, please also send some code which can be copy&pasted; it is
tedious
--8<---------------cut here---------------start------------->8---
\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\label{eq:1}
\Phi(\lambda_1, \lambda_2, \lambda_3) = \sum_{n=1}^N
\frac{\mu_n}{\alpha_n} (\lambda_1 ^ {\alpha_n} + \lambda_2 ^
{\alpha_n} + \lambda_3 ^ {\alpha_n} -3),
\end{align}
increment $t$,
\begin{align}
\label{eq:2}
\matr{\ddot{u}} |_{(t)} = \matr{M} ^ {-1 \cdot (\matr{P} - \matr{I})
|_{(t)}}.
\end{align}
\end{document}
--8<---------------cut here---------------end--------------->8---
Best, Arash
Hi Arash,

Thank you for your time writing back to me and sorry about not providing
you with the related codes. I will keep that in mind for future
references.
I disabled my loaded theme but the issue persists. Any other
suggestion?

Thanks,
Kourosh
Arash Esbati
2018-08-14 20:20:25 UTC
Permalink
Post by Kourosh Kalayeh
I disabled my loaded theme but the issue persists. Any other
suggestion?
No, not really. I think it is time to get into debugging. My
suggestion is to update your AUCTeX to latest version from ELPA. Then
do `M-x list-load-path-shadows RET' and check that you don't have
multiple installations. Then start Emacs from a shell with

emacs -q &

and in scratch buffer, insert

(package-initialize)

place the cursor after ) and hit `C-x C-e'. Then load you .tex file and
try it again. Updating your Emacs might also help.

Best, Arash
Kourosh Kalayeh
2018-08-16 13:27:32 UTC
Permalink
Post by Arash Esbati
Post by Kourosh Kalayeh
I disabled my loaded theme but the issue persists. Any other
suggestion?
No, not really. I think it is time to get into debugging. My
suggestion is to update your AUCTeX to latest version from ELPA. Then
do `M-x list-load-path-shadows RET' and check that you don't have
multiple installations. Then start Emacs from a shell with
emacs -q &
and in scratch buffer, insert
(package-initialize)
place the cursor after ) and hit `C-x C-e'. Then load you .tex file and
try it again. Updating your Emacs might also help.
Best, Arash
Thank you Arash for your suggestion. I will try it.

Thanks
Kourosh
Ivan Andrus
2018-08-17 05:19:47 UTC
Permalink
You can see what face it's using with the function below. That might give some clues.

-Ivan

(defun fontification-at-point (p)
(interactive "d")
(sit-for 0)
(message "Text properties: %s\nOverlays: %s"
(text-properties-at p)
(map 'list
(lambda (ov)
(overlay-properties ov))
(overlays-at p))))
Post by Arash Esbati
Post by Kourosh Kalayeh
I disabled my loaded theme but the issue persists. Any other
suggestion?
No, not really. I think it is time to get into debugging. My
suggestion is to update your AUCTeX to latest version from ELPA. Then
do `M-x list-load-path-shadows RET' and check that you don't have
multiple installations. Then start Emacs from a shell with
emacs -q &
and in scratch buffer, insert
(package-initialize)
place the cursor after ) and hit `C-x C-e'. Then load you .tex file and
try it again. Updating your Emacs might also help.
Best, Arash
_______________________________________________
auctex mailing list
https://lists.gnu.org/mailman/listinfo/auctex
Kourosh Kalayeh
2018-08-21 00:35:07 UTC
Permalink
Ivan, thank you for email.
Post by Ivan Andrus
You can see what face it's using with the function below. That might give some clues.
-Ivan
(defun fontification-at-point (p)
(interactive "d")
(sit-for 0)
(message "Text properties: %s\nOverlays: %s"
(text-properties-at p)
(map 'list
(lambda (ov)
(overlay-properties ov))
(overlays-at p))))
I tried the function. Emacs gives me the following error;
Symbol’s function definition is void: map

I am no expert in Emacs, so I have no idea what the error is about.

Thanks
Kourosh
Arash Esbati
2018-08-22 20:13:30 UTC
Permalink
Post by Kourosh Kalayeh
Ivan, thank you for email.
Post by Ivan Andrus
You can see what face it's using with the function below. That might give some clues.
-Ivan
(defun fontification-at-point (p)
(interactive "d")
(sit-for 0)
(message "Text properties: %s\nOverlays: %s"
(text-properties-at p)
(map 'list
(lambda (ov)
(overlay-properties ov))
(overlays-at p))))
I tried the function. Emacs gives me the following error;
Symbol’s function definition is void: map
,----[ C-h f map RET ]
| map is an alias for ‘cl-map’ in ‘cl.el’.
|
| (map TYPE FUNCTION SEQUENCE...)
|
| Map a FUNCTION across one or more SEQUENCEs, returning a sequence.
| TYPE is the sequence type to return.
`----

It should be sufficient to eval (require 'cl), i.e. put this line in
scratch and hit `C-x C-e' after ), before you eval that function.

As an alternative, you can put the cursor at a caret and hit
`C-u C-x =',then look for lines after "There are text properties
here:".

HTH. Best, Arash
Ivan Andrus
2018-08-23 01:04:44 UTC
Permalink
Sorry, that's in the cl-extra package. You can change it to cl-map and it should work (it's autoloaded). Alternately you can run (require 'cl) before running the function. I've had that in my .emacs for so long, that I forgot about it. I should have tested in emacs -q. I apologize.

-Ivan
Post by Kourosh Kalayeh
Ivan, thank you for email.
Post by Ivan Andrus
You can see what face it's using with the function below. That might give some clues.
-Ivan
(defun fontification-at-point (p)
(interactive "d")
(sit-for 0)
(message "Text properties: %s\nOverlays: %s"
(text-properties-at p)
(map 'list
(lambda (ov)
(overlay-properties ov))
(overlays-at p))))
I tried the function. Emacs gives me the following error;
Symbol’s function definition is void: map
I am no expert in Emacs, so I have no idea what the error is about.
Thanks
Kourosh
Kourosh Kalayeh
2018-08-23 19:32:27 UTC
Permalink
Post by Ivan Andrus
Sorry, that's in the cl-extra package. You can change it to cl-map
and it should work (it's autoloaded). Alternately you can run
(require 'cl) before running the function. I've had that in my .emacs
for so long, that I forgot about it. I should have tested in emacs
-q. I apologize.
Ivan and Arash,

Thank you for your emails.

Ivan,
I was able to get information about the font faces using Arash’s tip
(i.e., C-u C-x =).

Using the above, I was able to check font faces of normally and
abnormally behaved carets and underscores;

Normal (regular orange color): font-latex-math-face
Abnormal (red color): font-latex-script-char-face font-latex-math-face

So based on the above, it seems that for some reason AUCTeX uses
font-latex-script-char-face for some of the carets and underscores.

Thanks
Kourosh

Loading...