February 25, 2009

Getting LaTeX empheq to play along with Emacs' RefTeX and Preview modes

empheq is a LaTeX meta-environment for emphasizing equation-like environments with boxes and stuff. All funky -- but by now, I am so spoiled by my Emacs/AUCTeX/Preview/RefTeX setup that I can't work without it. Turns out the hacking is quick and not bloody at all:

Getting empheq to work with PreviewLaTeX

Just put this in you document preamble (thanks to David Kamstrup)
\usepackage[displaymath,floats,graphics,textmath]{preview}
\PreviewEnvironment[{[]{}}]{empheq}

Getting empheq to work with RefTeX

You basically need to put a term in reftex-label-alist. It is perhaps explained in the RefTeX manual, but I found this XEmacs page a few hundred times more readable. The upshot is to put this line in your .emacs:
(setq reftex-label-alist (quote (("empheq" ?e "eq:" nil nil nil))))
or put something to similar effect in the customization group.

February 18, 2009

It's in the skipping, stupid!

If somebody had asked me this morning to "pick a set of integers so that the difference between any two members is not 0 or 2", I would probably would have come up with the right answer. Unfortunately, my stupid boss (me) didn't phrase the question so simply, so I had to spend the whole day finding the answer the stupid way... Blue dots are the picks, red dots are pair differences.