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


Message #17 received at 78006 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: 78006 <at> debbugs.gnu.org
Subject: Re: bug#78006: Improving `TeX-electric-math' behavior
Date: Fri, 02 May 2025 09:14:08 +0200
"Paul D. Nelson" <ultrono <at> gmail.com> writes:

> Right, I guess I was asking if it might make sense to eliminate the
> "last-command" test, so that the command operates in a broader set of
> scenarios.  I don't have strong feelings on this, since I haven't used
> this cycling feature before.

I don't use it either, but I'm reluctant to make this change since it
was there forever.  I think I install the change I proposed and we'll
wait and see what real users say about it.

> Sure.  There's a command for making a displayed equation inline, and
> another command that, among other things, makes a displayed equation
> inline.  I bind these to "C-c i" and "C-c e".

Thanks for sharing.  I think we should move your code to another bug
report and discuss it there.  I will have to take a closer look, but I
have 2 minor comments below:

> The "among other things" should probably be stripped out before
> sending to AUCTeX, but OK, resisting the urge to polish for now:
>
> (defcustom czm-tex-edit-punctuation-string
>   "[\\.|,|;|!|?]"

Isn't "[.,;!?]" enough, presuming you don't want to search for a literal
backslash?

>   "Regexp for matching punctuation characters."
>   :group 'czm-tex-edit
>   :type 'regexp)
>
> ;;;###autoload
> (defun czm-tex-edit-make-equation-inline ()
>   "Convert LaTeX equation environment at point to inlined math.
> Format LaTeX environment at point by surrounding the math
> environment with dollar signs, removing any leading or trailing
> text."

I think this will break if the equation environment has a \label{eq:x}?

> One thought: AUCTeX has "C-u C-c C-e" for switching the type of an
> environment.  Perhaps the same command could be made to work in
> top-level $...$ regions, using something like the above
> "make-equation-numbered" as the implementation.  Conversely, perhaps
> $...$ could be a hard-coded option for environment type after "C-u C-c
> C-e", with something like the above "make-inline" as implementation.
> The point of this suggestion is just to get around the scarcity of
> keybinds and integrate with existing commands.
>
> Any thoughts welcome!

I see your point, but OTOH, do we have to bind every command to a key
binding?  I think for commands not often used people can do 'M-x foo' or
bind the command to a sequence of their choice, as you did.

Best, Arash




This bug report was last modified 19 days ago.

Previous Next


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