3.5 Prettifying
Emacs 25 is able to prettify symbols in programming language buffers, see (emacs)Misc for Programs section ‘Misc for Programs’ in GNU Emacs Manual. The canonical example is to display (lambda () ...)
as (λ () ...)
in Lisp buffers.
AUCTeX can use this feature in order to display certain math macros and greek letters using their Unicode representation, too. For example, the TeX code \alpha \times \beta
will be displayed as α × β
. When point is on one of the characters, it’ll be unprettified automatically, meaning you see the verbatim text again. For this behaviour however you need to set prettify-symbols-unprettify-at-point
to t or right-edge
which will unprettify the symbol when point moves into or near it.
To enable prettification in AUCTeX, simply add prettify-symbols-mode
to TeX-mode-hook
. If you enabled prettification globally with global-prettify-symbols-mode
, then it’s automatically enabled in AUCTeX, too.
You can also add custom symbol unicode-character pairs for prettification by adding to tex--prettify-symbols-alist
. Note that this variable is part of Emacs’ stock tex-mode.el
and used by that and AUCTeX.