Do not \protect label in subfloat caption (#11950)

This commit is contained in:
Juergen Spitzmueller 2020-08-28 07:32:29 +02:00
parent 3bd358a2f6
commit 3fc095e3bc
2 changed files with 5 additions and 2 deletions

View File

@ -391,11 +391,11 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
OutputParams rp = runparams_in;
rp.moving_arg = true;
rp.inFloat = OutputParams::SUBFLOAT;
os << getCaption(rp);
os << '{';
// The main argument is the contents of the float. This is not a moving argument.
rp.moving_arg = false;
rp.inFloat = OutputParams::SUBFLOAT;
InsetText::latex(os, rp);
os << "}";

View File

@ -334,7 +334,10 @@ void InsetLabel::latex(otexstream & os, OutputParams const & runparams_in) const
if (runparams_in.postpone_fragile_stuff)
runparams_in.post_macro += command;
else {
if (runparams.moving_arg)
// protect label in moving argument (#9404),
// but not in subfloat caption (#11950)
if (runparams.moving_arg
&& runparams.inFloat != OutputParams::SUBFLOAT)
os << "\\protect";
os << command;
}