From 53ed6d3d46d1c477719e3898d7a39c9418f7d284 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 23 Dec 2014 11:58:04 +0100 Subject: [PATCH] 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 --- lib/layouts/aguplus.inc | 1 + lib/layouts/apa.layout | 1 + lib/layouts/apa6.layout | 1 + lib/layouts/bicaption.module | 1 + lib/layouts/scrclass.inc | 2 ++ lib/layouts/stdinsets.inc | 1 + src/insets/InsetCaption.cpp | 3 --- src/insets/InsetText.cpp | 2 ++ status.21x | 3 ++- 9 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/layouts/aguplus.inc b/lib/layouts/aguplus.inc index 508c0234bc..fd8624d94a 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 578918c07a..e4a4799ebc 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 f8c22f96c8..b0f20af2b2 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 41379fc32c..f0e0c3cb08 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 fc52fddb1e..95aa4f0183 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 383da773cc..635dfdbe1f 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 f6b24672e4..a6b8dfadfd 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -265,9 +265,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 346e007979..f0b2be77a9 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -437,6 +437,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()); diff --git a/status.21x b/status.21x index 863ce4778c..e708d76e17 100644 --- a/status.21x +++ b/status.21x @@ -53,6 +53,7 @@ What's new * DOCUMENT INPUT/OUTPUT +- Do not output \protect unnecessarily before \caption (bug 9177). * LYX2LYX @@ -61,7 +62,7 @@ What's new * USER INTERFACE -- Fix name and hint of figure captions in documents using the class aastex. +- Fix name and hint of figure captions in documents using the class aastex. -- 2.39.5