GNU bug report logs - #78693
14.0.9; Folding of math macros with a function spec is broken

Previous Next

Package: auctex;

Reported by: Rahguzar <rahguzar <at> mailbox.org>

Date: Wed, 4 Jun 2025 08:49:03 UTC

Severity: normal

Merged with 78696, 78698

Found in version 14.0.9

Done: "Paul D. Nelson" <ultrono <at> gmail.com>

Full log


View this message in rfc822 format

From: "Paul D. Nelson" <ultrono <at> gmail.com>
To: Rahguzar <rahguzar <at> mailbox.org>
Cc: 78693 <at> debbugs.gnu.org
Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken
Date: Sun, 22 Jun 2025 09:39:54 +0200
Hi Raghuzar,

Rahguzar <rahguzar <at> mailbox.org> writes:

>>> One question about it: One problem I have had is that, if I have
>>> something like
>>>
>>> \begin{align}
>>>   [\hat{X},\hat{P}] = i\hbar
>>> \end{align}
>>>
>>> the commutator gets folded as an optional argument to the \begin.
>>> It is possible to not have this effect with new machinery without
>>> specifying \begin as not taking any optional arguments?
>>
>> Could you please share your tex folding config, or better, the part
>> relevant for folding \begin{align}?
>
> It is this:
>
> (setq TeX-fold-macro-spec-list
>       `(("⬖ {1}" ("begin"))
>         ("⬗ {1}" ("end"))))

With the new folding signature support, you can achieve the desired
effect using either

;; At most 1 args.
(setq TeX-fold-macro-spec-list
      `((("⬖ {1}" . 1) ("begin"))
        (("⬗ {1}" . 1) ("end"))))

or

;; At most 0 optional, 1 required args.
(setq TeX-fold-macro-spec-list
      `((("⬖ {1}" . (0 . 1)) ("begin")) 
        (("⬗ {1}" . (0 . 1)) ("end"))))

---

Another approach here would be prettification, assuming you're OK with
specifying each environment.  I use something like:

(with-eval-after-load 'tex-mode
  (mapc
   (lambda (sym) (add-to-list 'tex--prettify-symbols-alist sym))
   '(("\\begin{equation}" . ?↴)
     ("\\end{equation}" . ?↲)
     ("\\begin{align}" . ?⌈)
     ("\\end{align}" . ?⌋)
     ("\\begin{multline}" . ?⎧)
     ("\\end{multline}" . ?⎭))))

Paul




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.