GNU bug report logs - #78006
Improving `TeX-electric-math' behavior

Previous Next

Package: auctex;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Wed, 23 Apr 2025 07:27:01 UTC

Severity: normal

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: 78006 <at> debbugs.gnu.org
Subject: bug#78006: Improving `TeX-electric-math' behavior
Date: Fri, 25 Apr 2025 12:37:49 +0200
"Paul D. Nelson" <ultrono <at> gmail.com> writes:

> Looks good to me overall.

Thanks for checking

> One counterintuitive edge case: if I mark x and hit $ repeatedly, then I
> get $x$ -> \[x\] -> x -> etc.  On the other hand, if I mark $x$ and hit
> $, then I get $$x$$ -> $x$ -> etc.

I think this is by design.  In `TeX-insert-dollar-electric-region', we
have this test:

 ((and (eq last-command #'TeX-insert-dollar)
         (re-search-forward ...))
  ...

> I also wonder then whether TeX-insert-dollar (x2) should then similarly
> insert $$|$$ or \[|\] according to mode?

AUCTeX currently enters \[|\] when you hit \[ so I think the above would
be redundant.

> Tangentially, I wonder whether this feature might be more useful if it
> worked not just when operating on a region for the first time, but
> more generally on any math region, as a way to cycle between inline
> and displayed math.  I've had "make-inline" and "make-displayed"
> functions in my config for a long time now that I've tried
> unsuccessfully to think of an elegant way to package and contribute.

Hmm, maybe we can add them to AUCTeX itself.  Do you want to show the
code?

Best, Arash




This bug report was last modified 20 days ago.

Previous Next


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