Re: [EXTERNAL *] Re: Fontification of $ sign

2023-09-16 Thread Jean Eid
Thanks Arash,
Yes I know about that trick but o am wondering whether something else can be 
done.

Thanks

--
[Lazaridis School of Business and 
Economics.]<https://www.wlu.ca/academics/faculties/lazaridis-school-of-business-and-economics/department-of-economics/index.html>
 Jean Eid (he, him, his)

Associate Professor

Office: +1(519)-884-0710x2262

75 University Avenue West Waterloo, Ontario, N2L 3C5

Inspiring Lives   
lazaridisschool.ca<https://www.wlu.ca/academics/faculties/lazaridis-school-of-business-and-economics/index.html?ref=lazaridis-school-of-business-and-economics%2Findex.html>


From: Arash Esbati 
Sent: Saturday, September 16, 2023 7:43:48 AM
To: Jean Eid 
Cc: auctex@gnu.org 
Subject: [EXTERNAL *] Re: Fontification of $ sign

Jean Eid  writes:

> Anyway to turn off the fontification of math within $ signs?

IIRC that one is built in and cannot be turned off (I think this is
also documented somewhere in the manual but I didn't check).  Therefore
you have to go through some more troubles (see Tassilo's message).

> The reason is that I use polymode with auctex and ess and when I have
> an inline R expression with a dollar sign like so :
>
> the average salary is $\bar x=\Rexpr{mean(mydata$salary}}$
>
> the $ fontification bleed out.

The usual trick to fix this is to write something like this:

  the average salary is $\bar x=\Rexpr{mean(mydata$salary}}$% $

You get misformed fontification, but you can limit it until EOL.

Best, Arash


* ⚠ Notice: This email originated from outside of the organization. Do not 
click links or open attachments unless you recognize the sender and know the 
content is safe.


Re: [EXTERNAL *] Re: Fontification of $ sign

2023-09-16 Thread Jean Eid
Hello Tassilo,


Thanks for this but it does not work for me. I also worked on the code 
yesterday (for polymode) so the $ sign inside a R code chunks is not the 
problem. The problem is having the code chunk inside the $ signs.  as this 
image shows. You see that the first \Rexpr is not a problem but the second one 
is. The init.el file is very simple just defining these code chunks and loading 
ess and auctex ( I can send it if need be). I tried it with your code and 
without, I had the same outcome.

[image to show fontificxation where when Rexpr is whithin $ signs it 
bleeds out]

On 9/16/23 06:38, Tassilo Horn wrote:

Jean Eid  writes:

Hi Jean,



Anyway to turn off the fontification of math within $ signs? I know I
can change the color  to white but that is not what I want,  I would
like to  turn it right off.


There is no simple option for it but this seems to work:

--8<---cut here---start->8---
(defun my/font-latex-disable-dollar-math ()
  (cl-flet ((f (lst)
  (seq-filter (lambda (e)
(not (eq (car e) #'font-latex-match-dollar-math)))
  lst)))
(setq font-latex-keywords-1 (funcall #'f font-latex-keywords-1))
(setq font-latex-keywords-2 (funcall #'f font-latex-keywords-2

(advice-add
 #'font-latex-make-user-keywords
 :after
 #'my/font-latex-disable-dollar-math)
--8<---cut here---end--->8---

Note however, that this will also disable $$...$$.  And since
super/subscript fontification is only performed in regions which are
already identified to be math, that's also disabled.

Bye,
Tassilo


* ⚠ Notice: This email originated from outside of the organization. Do not 
click links or open attachments unless you recognize the sender and know the 
content is safe.


--
[Lazaridis School of Business and Economics.] 

Jean Eid (he, him, his)

Associate Professor

Office: +1(548)-889-4620

75 University Avenue West Waterloo, Ontario, N2L 3C5

Inspiring Lives   
lazaridisschool.ca


Re: Fontification of $ sign

2023-09-16 Thread Arash Esbati
Jean Eid  writes:

> Anyway to turn off the fontification of math within $ signs?

IIRC that one is built in and cannot be turned off (I think this is
also documented somewhere in the manual but I didn't check).  Therefore
you have to go through some more troubles (see Tassilo's message).

> The reason is that I use polymode with auctex and ess and when I have
> an inline R expression with a dollar sign like so :
>
> the average salary is $\bar x=\Rexpr{mean(mydata$salary}}$  
>
> the $ fontification bleed out.

The usual trick to fix this is to write something like this:

  the average salary is $\bar x=\Rexpr{mean(mydata$salary}}$% $

You get misformed fontification, but you can limit it until EOL.

Best, Arash



Re: Fontification of $ sign

2023-09-16 Thread Tassilo Horn
Jean Eid  writes:

Hi Jean,

> Anyway to turn off the fontification of math within $ signs? I know I
> can change the color  to white but that is not what I want,  I would
> like to  turn it right off.

There is no simple option for it but this seems to work:

--8<---cut here---start->8---
(defun my/font-latex-disable-dollar-math ()
  (cl-flet ((f (lst)
  (seq-filter (lambda (e)
(not (eq (car e) #'font-latex-match-dollar-math)))
  lst)))
(setq font-latex-keywords-1 (funcall #'f font-latex-keywords-1))
(setq font-latex-keywords-2 (funcall #'f font-latex-keywords-2

(advice-add
 #'font-latex-make-user-keywords
 :after
 #'my/font-latex-disable-dollar-math)
--8<---cut here---end--->8---

Note however, that this will also disable $$...$$.  And since
super/subscript fontification is only performed in regions which are
already identified to be math, that's also disabled.

Bye,
Tassilo