I use Emacs in conjunction with AUCTeX to edit manuscripts with lots of built-in math calculations using $ . When autocompleted (for example, using Mq ), Emacs often violates these built-in mathematical environments in positions that impair readability (for example, in indexes, etc.).
Is there any way to tell Emacs to prefer to put the whole environment $…$ in a new line if this prevents a violation? More specifically, if a math violation occurs, the entire environment should be wrapped on a new line that cannot be broken.
Example:
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed $a^2 + b^2 = c^2$ eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
should lead to
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed $a^2 + b^2 = c^2$ eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
Xlea
source share