Emacs auctex inserts line breaks after inline math in an ugly way
Asked Answered
T

1

11

I got problems with emacs/auctex fill paragraph which insert linebreaks after each $blabla$ block, resulting in a poorly readable code. For exemple, hitting M-q on the following long line:

a $1$ b $2$ c $3$ d $4$ e $5$ f $6$ g $7$ h $8$ i $9$ j $10$ k $11$ l $12$ m $13$ n $14$ o $15$

Gives:

a $1$
b $2$
c $3$
d $4$
e $5$
f $6$ g $7$ h $8$ i $9$ j $10$ k $11$ l $12$ m $13$ n $14$ o $15$

I would like to have something like:

a $1$ b $2$ c $3$ d $4$ e $5$ f $6$ g $7$ h $8$ i $9$ j $10$ k
 $11$ l $12$ m $13$ n $14$ o $15

Note: I have the impression that fill-paragraph didn't have this ugly behavior when I didn't use auctex but the built-in latex mode...

Any ideas?

Many thanks!

Turbosupercharger answered 28/10, 2015 at 14:52 Comment(0)
F
6

This can be fixed by changing the AUCTeX user option LaTeX-fill-break-at-separators (see AUCTeX Manual [Filling]).

Hit M-x and type customize-group in the minibuffer, then type LaTeX.

Now you should be able to see the option LaTeX Fill Break At Separators in the newly created buffer. Click on it (expanding it) and uncheck the box next to Closing Inline Math Switches. Don't forget to save.

Freak answered 3/11, 2015 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.