Thursday, February 18, 2010

Emacs word search

One nice feature of Emacs for editing TeX documents is called word-search.  When you're looking at your typeset document and want to go to a particular place, you can simply do a search for the text around the location.  Unfortunately, you don't know where the line breaks are in the file, and thus this simple strategy will fail.  If you use word-search-forward (or C-s RET C-w WORDS) Emacs will build a regular expression that ignores both space and punctuation and go to the correct spot.  

For example, if the pdf file says

The quick brown fox, jumped over the lazy dog.

but the text file has

The quick brown
fox,
jumped
over the lazy dog.

and you word-search for

"brown fox jumped"

it will jump to the right spot.

1 comment:

  1. aha. I always wondered if there was a way to do that.

    ReplyDelete