Q: how do I define sentence endings to be LaTeX macro-aware?
I'd like backward-sentence
and forward-sentence
to be smarter about LaTeX macros -- particularly \footnote
-- when working in LaTeX buffers. Consider the following snippet:
Here's some text in a LaTeX buffer.\footnote{And here's a footnote example. It's got a couple of sentences.} I wonder how I can get Emacs to recognize where the sentence endings occur?
If point is anywhere in what we would consider the first sentence (ie, before the footnote
), calling forward-sentence
takes point not to the period immediately before the \footnote
macro, but rather to the period after "example" within the footnote. Likewise, if point is at the beginning of the second sentence in the footnote, backward-sentence
takes point not to the "A" in "And" at the beginning of the first sentence in the footnote, but rather to the "H" in "Here's" in the sentence that precedes the footnote.
How can I fix the definition of a sentence to make Emacs aware of these macro-boundaries? It looks like I would want to write a specific regexp for sentence-end
, but before I start messing around with regexps, I was wondering if someone has already solved this problem.
This S.O. thread asks a related question, but the accepted answer appears to involve writing custom backward-sentence
and forward-sentence
commands rather than redefining sentence boundaries per se.