]> git.lyx.org Git - features.git/commitdiff
Do not \protect label in subfloat caption (#11950)
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 28 Aug 2020 05:32:29 +0000 (07:32 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 28 Aug 2020 05:32:29 +0000 (07:32 +0200)
src/insets/InsetFloat.cpp
src/insets/InsetLabel.cpp

index b0a48f2b31007d367de11e70714e06252d3380eb..24e06b548c2ead6dc7d1da2f92534b68f06f63fb 100644 (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 << "}";
 
index ec50d4feb601efdf349878f990b4bf6da7084de4..2e80e26a8354e05e62ce6ef4b8462e48d540174c 100644 (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;
        }