emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prettify-symbols-mode to handle "\alpha-\beta" ...


From: tomas
Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" ...
Date: Thu, 4 Feb 2021 09:44:26 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 04, 2021 at 02:24:42AM +0100, pietru@caramail.com wrote:
> 
> I am using prettify-symbols-mode for displaying greek command using
> the corresponding greek glyph when using mathematical expressions
> in texinfo.
> 
> Here is an example
> 
>   (push '("\\alpha" . ?α) prettify-symbols-alist)
>   (push '("\\beta" . ?β) prettify-symbols-alist)
> 
> This works well when using "\alpha\beta", "\alpha - \beta" 
> But the expression fails when using "\alpha-\beta" or
> "\alpha_i", "\alpha_{ij}", "\beta^i", "\beta+\alpha".
> The expressions are all valid mathematical expressions
> when using tex.  
> 
> Would you be so kind to update "prettify-symbols-mode"
> so the substitutions can become possible to handle.
> 
> Does this require that SYMBOL in (SYMBOL . CHARACTER) be
> a regexp?

Quoth the doc, "26.11 Other Features Useful for Editing Programs":

   "Prettify Symbols mode is a buffer-local minor mode that
   replaces certain strings with more attractive versions for
   display purposes.  For example, in Emacs Lisp mode, it replaces
   the string ‘lambda’ with the Greek lambda character
   ‘λ’.  In a TeX buffer, it will replace ‘\alpha’
   ... ‘\omega’ and other math macros with their Unicode
   characters.  You may wish to use this in non-programming modes
   as well.  You can customize the mode by adding more entries to
   ‘prettify-symbols-alist’.  More elaborate customization is
   available via customizing ‘prettify-symbols-compose-predicate’
   if its default value ‘prettify-symbols-default-compose-p’
   is not appropriate.  There is also a global version,
   ‘global-prettify-symbols-mode’, which enables the mode in
   all buffers that support it.

   The symbol at point can be shown in its original form.  This is
   controlled by the variable ‘prettify-symbols-unprettify-at-point’:
   if non-‘nil’, the original form of symbol at point will be restored
   for as long as point is at it."

So I'd look around the  variable's docstrings (C-h v) of

  - prettify-symbols-alist (this you already know)
  - prettify-symbols-compose-predicate

This might answer (at least part of) your questions.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]