http://bugzilla.lyx.org/show_bug.cgi?id=675
As discussed in the bug, this "fixes" the bug by making graphics in caption generate proper latex (with \protect). It is then up to the user to realize that the graphics is in the wrong place (note that there may be proper reason for inserting a graphics in a caption). I tested it and it works. I will apply tomorrow if nobody complains. JMarc
Index: insetgraphics.C =================================================================== --- insetgraphics.C (revision 13276) +++ insetgraphics.C (working copy) @@ -748,9 +748,15 @@ string after; // Do we want subcaptions? if (params().subcaption) { + if (runparams.moving_arg) + before += "\\protect"; before += "\\subfigure[" + params().subcaptionText + "]{"; after = '}'; } + + if (runparams.moving_arg) + before += "\\protect"; + // We never use the starred form, we use the "clip" option instead. before += "\\includegraphics";