commit 1e18ab586e0cd4abd171b63c55e6b91c0f0d424a
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Tue Dec 23 11:58:04 2014 +0100

    Fixes to InsetCaption \protect-ion
    
    * \caption does not need to be protected in general
    * the contents of \caption arguments need to be protected, though.
    
    All styles related to caoption inset have been audited and updated.
    
    The special casing of captions in longtables has been removed, since there 
is no special case.
    
    Fixes bug: #9177

diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 35deaa8..9a93bd1 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -529,6 +529,7 @@ InsetLayout Caption:FigCaption
        LabelString          fig.
        LaTeXType            command
        LatexName            figcaption
+       # FIXME: it seems that the optional argument is actually a file name
        Argument 1
            LabelString   "Short Title|S"
            Tooltip       "The caption as it appears in the list of figures"
diff --git a/lib/layouts/aguplus.inc b/lib/layouts/aguplus.inc
index 93bfc6e..4e10de0 100644
--- a/lib/layouts/aguplus.inc
+++ b/lib/layouts/aguplus.inc
@@ -207,6 +207,7 @@ InsetLayout Caption:Table
        LabelString          table
        LaTeXType            command
        LatexName            tablecaption
+       NeedProtect          1
        HTMLStyle
                div.float-caption {
                        text-align: center;
diff --git a/lib/layouts/apa.layout b/lib/layouts/apa.layout
index fec180e..7a3d40d 100644
--- a/lib/layouts/apa.layout
+++ b/lib/layouts/apa.layout
@@ -251,6 +251,7 @@ InsetLayout Caption:Centered
        LabelString          standard
        LaTeXType            command
        LatexName            centeredcaption
+       NeedProtect          1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The caption as it appears in the list of 
figures/tables"
diff --git a/lib/layouts/apa6.layout b/lib/layouts/apa6.layout
index 348a655..25b0082 100644
--- a/lib/layouts/apa6.layout
+++ b/lib/layouts/apa6.layout
@@ -351,6 +351,7 @@ InsetLayout Caption:Centered
        LabelString          standard
        LaTeXType            command
        LatexName            centeredcaption
+       NeedProtect          1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The caption as it appears in the list of 
figures/tables"
diff --git a/lib/layouts/bicaption.module b/lib/layouts/bicaption.module
index 87b67d2..ccfc68a 100644
--- a/lib/layouts/bicaption.module
+++ b/lib/layouts/bicaption.module
@@ -40,6 +40,7 @@ InsetLayout Caption:Bicaption
        LabelString     bilingual
        LaTeXType       command
        LatexName       bicaption
+       NeedProtect     1
        Argument 1
          LabelString   "Main Language Short Title"
          Tooltip       "Short title for the main(document) language"
diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc
index 9023402..4dd61d9 100644
--- a/lib/layouts/scrclass.inc
+++ b/lib/layouts/scrclass.inc
@@ -269,6 +269,7 @@ InsetLayout Caption:Above
        LabelString          above
        LaTeXType            command
        LatexName            captionabove
+       NeedProtect          1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The caption as it appears in the list of 
figures/tables"
@@ -289,6 +290,7 @@ InsetLayout Caption:Below
        LabelString          below
        LaTeXType            command
        LatexName            captionbelow
+       NeedProtect          1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The caption as it appears in the list of 
figures/tables"
diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index d2e3232..bd6114d 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -554,6 +554,7 @@ InsetLayout Caption:Standard
        LabelString          standard
        LaTeXType            command
        LatexName            caption
+       NeedProtect          1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The caption as it appears in the list of 
figures/tables"
diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp
index 65cddc2..8af9827 100644
--- a/src/insets/InsetCaption.cpp
+++ b/src/insets/InsetCaption.cpp
@@ -264,9 +264,6 @@ void InsetCaption::latex(otexstream & os,
        // \caption{...}, later we will make it take advantage
        // of the one of the caption packages. (Lgb)
        OutputParams runparams = runparams_in;
-       // FIXME: actually, it is moving only when there is no
-       // optional argument.
-       runparams.moving_arg = !runparams.inTableCell;
        InsetText::latex(os, runparams);
        // Backwards compatibility: We always had a linebreak after
        // the caption (see #8514)
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index e0cd894..5f1eeb1 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -438,6 +438,8 @@ void InsetText::latex(otexstream & os, OutputParams const & 
runparams) const
        if (!il.latexname().empty()) {
                if (il.latextype() == InsetLayout::COMMAND) {
                        // FIXME UNICODE
+                       // FIXME \protect should only be used for fragile
+                       //    commands, but we do not provide this information 
yet.
                        if (runparams.moving_arg)
                                os << "\\protect";
                        os << '\\' << from_utf8(il.latexname());

Reply via email to