Odd LaTeX error in Phys. Rev. A submission
So I'm in the process of getting an article published in PRA. I first submitted it in mid-June, and got the referee's response the day before I left for a two-week holiday! I thought my mad scramble to address the comments and resubmit before leaving for the airport was successful, but while waiting in the boarding area I received an email entitled "URGENT <reference id>" from the editors. Apparently they were unable to compile my document from its LaTeX source code, and needed me to debug the problem and re-submit. Unfortunately, it compiled without any errors on my system. It did generate some warnings on their system when I uploaded it, but no actual errors. I figured this might make it tricky to debug. If you've seen TeX output you can imagine just how long the list of errors I had to deal with was, but the first relevant section turned out to be:
! Use of \caption@@settype doesn't match its definition.
\new@ifnextchar ...served@d = #1\def \reserved@a {
#2}\def \reserved@b {#3}\f...
For reasons I still don't understand, the problem was in using the \subref command within the \caption command of a figure. In each case, the caption was that of the figure containing the subfigure being referenced; I don't know if this caused the problem, or if it still wouldn't have worked referencing the subfigures from another figure's caption.
Whatever inner workings of TeX resulted in this combination's causing a problem, the solution was straightforward. Thanks to a post on miscellaneous.debris, I found that simply adding \protect before each \subref made the problem go away.