What I did was to place a figure float within a figure float to create
subfloats. Even with no text in the caption or graphics inserted, I get
errors that look like this:
You can't use '\spacefactor' in vertical mode.
.......
Try adding \makeatletter at the end of your preamble. I think Lyx adds:
\...@ifundefined{showcaptionsetup}{}{%
\PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother
at the end of your preamble to fix some subfig things (although I don't
know what).
I had exactly the same issue, as i was ending my preamble in \makeatother
mode, which is needed for the @ symbol in this chunk of code. Lyx should
probably add \makeatletter to the front of the code chunk it adds to make
this bombproof.
Anyways, that worked for me after much stress!
--
Iain Waugh