> User Option: TeX-electric-math > > In addition, when the variable is non-nil and there is an active > region outside math mode, typing $ will put around the active region > symbols for opening and closing inline equation and keep the region > active, leaving point after the closing symbol. By pressing > repeatedly $ while the region is active you can toggle between an > inline equation, a display equation, and no equation. To be precise, > ‘$...$’ is replaced by ‘$$...$$’, whereas ‘\(...\)’ is replaced by > ‘\[...\]’. > > Using $$...$$ in LaTeX is discouraged, so I think AUCTeX shouldn't > promote this as well, so I suggest this change to > `TeX-insert-dollar-electric-region':
Looks good to me overall. 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 also wonder then whether TeX-insert-dollar (x2) should then similarly insert $$|$$ or \[|\] according to mode? 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. _______________________________________________ bug-auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-auctex
