Wednesday, January 23, 2008

My PhD Thesis: in color and grayscale

Wednesday is my regular day off from my metabolomics work, and today I am finalizing the layout of my thesis, which I'll defend on April 2. The print version will feature grayscale images with some of them in color too. However, the PDF version that will end up in our university repository should have color prints. So, while halfway creating suitable grayscale versions of the image, I realized I was not doing it properly. I was replacing the images; so, I lost the color version. Not good.

But wait, LaTeX can do more; why not have a color and a grayscale option? Here comes optional.sty. By adding \usepackage{optional} I can add to the source (from book.tex):
\caption{a) 2D diagrams of the two possible resonance structures of a compound
with a phenyl ring. Both diagrams refer to the same compounds, but the depicted
graph representations are not identical. b) 2D diagram of ferrocene, which,
like all organometallic compounds,
is difficult to represent with classical chemoinformatics approaches.}
Ferrocene was already black-and-white, so no worry about that. And, it is just the red colored hydroxyl group. But it serves the point :)

Which then allows me to run pdflatex to create a color version and a grayscale version:
pdflatex "\def\UseOption{color}\input{book}"
pdflatex "\def\UseOption{grayscale}\input{book}"

/me is happy