Saturday, March 21, 2009

rspublic.cls fixed to get rid of nasty Incomplete \if errors

Depending on how updated your LaTeX distribution is, if you try to use the Royal Society's rspublic.cls to build your compuscript, you may get nasty incomprehensible errors like:
! Incomplete \if; all text was ignored after line 7.

\fi
I didn't get these errors on my home system (which has TeX Live 2007 installed), but I got them on Manuscript Central for Proc. R. Soc. B, and that's a major problem.

After two days of binary searching through possible sources of the problem, I found it. Jonathan Wainwright (the author of the document class) used a \phantom in both the \@oddhead and \@evenhead without preceding it by a \protect. The \phantom macro is fragile, which means that it can cause major problems when put in contexts that move around (like headers). So it needs to be protected.

I added \protect in front of each of the two \phantom calls, and all was well in the world.

I've posted a fixed version of the document class at:Give it a shot. That version also allows for 11pt and 12pt fonts, and it defines \@ptsize, which setspace needs to exist in order to work (i.e., for double spacing).

No comments: