Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 976
janou195 Avatar asked Oct 28 '15 14:10

janou195


1 Answers

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.

like image 82
whame Avatar answered Oct 31 '22 01:10

whame