TextMate LaTeX bundle and compiling to PDF via PS

Written . Tagged LaTeX, OS X, TextMate.

I’m very far from a LaTeX expert, but I thought I’d write this up for googleability.

If, when using the “Typeset and View (PDF)” command in the TextMate LaTeX bundle, you get error messages like

./myfile.tex:123: Undefined control sequence. \c@lor@to@ps
./myfile.tex:123: Undefined control sequence.\XC@@usecolor ...expandafter \c@lor@to@ps #1#2\@@

the problem can well be that that you are directly or indirectly (e.g. through Vaucanson-G) using the pstricks package.

As implied by the name, this package needs you to turn the tex into PostScript format before turning it into a PDF (manually by e.g. latex myfile.tex && dvips myfile.dvi -o myfile.ps && ps2pdf myfile.ps). The TextMate command turns the tex into PDF directly using pdflatex.

The command has now been fixed in SVN to take the long way around whenever pstricks is used. However, one important thing to note is that the command only checks in the file being typeset directly. If pstricks is only being used in some third-party package, you must let the command know by e.g. adding a comment

1
%\usepackage{pstricks}

to your file.