I'm using AUCTeX to edit LaTeX files. The behavior of the fill command M-q (also C-c C-q C-p, LaTeX-fill-paragraph
) is very erratic. For example, if I have the following text:
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
filling it yields:
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
which is clearly not ideal. However, I have auto-fill-mode enabled, and if I take the text from the beginning and manually add a space at the end of the line, the auto-fill does this:
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
test $1 + 1 = 2$
which is infinitely better. Is there a way I can configure the fill-command to work correctly? I'm using Emacs 24.5.1 on Windows and AUCTeX 11.88.9.