Combining Quick Look & texbin

Mac OS X 10.5 has a handy technology called “Quick Look” that allows you to preview documents in a floating window without actually opening them up in a dedicated program. Ideal when you want to briefly check on the contents of something while you’re in the middle of another task.

Modern TeX distributions come with a convenient program texdoc for quickly finding documentation for LaTeX packages and so on. It’s nice to use Quick Look as the viewer for texdoc–found files, as I often open up package documenation just to check the syntax or spelling of some obscure command. Here’s a shell script to do this:

qlmanage -p `texdoc -l $1 | grep -e '.*' -m 1` &> /dev/null &

Save it somewhere in your path in a file called, say, teq and you’ll be able to write teq pdfpages to called up the pdfpages documentation in a floating window. Nice.