Stumbled upon the following problem.
Whenever fill-paragraph
finds a LaTeX citation such as \citep[][p. 10]{darwin1859}
(which appears as (Darwin, 1859, p. 10)
), the paragraph gets broken like this:
Text text text text \citep[][p.
10]{darwin1859} text text text.
How can I keep the citation intact, including the whitespace in [p. 10]
?
Now for what I've found so far.
There's a fill-nobreak-predicate
hook that may contain functions that check whether fill-paragraph
should skip certain regexps from being split (if I'm not mistaken).
I tried with this code but failed:
(defun my-nobreak-p ()
(looking-at-p "\\\\citep.*\\}"))
(add-hook 'fill-nobreak-predicate #'my-nobreak-p)