Jürgen Spitzmüller wrote:
The attached patch seems the most easiest way to implement this.
Comments?

Jürgen


------------------------------------------------------------------------

Index: src/text.C
===================================================================
--- src/text.C  (Revision 17417)
+++ src/text.C  (Arbeitskopie)
@@ -1744,8 +1744,18 @@
docstring name = from_ascii(layout->latexname()); + // are we in a caption inset?

The caption inset derives from a LyXText, why do we need to search for it? Won't this test be enough:

if (this->lyxCode() == InsetBase::CAPTION_CODE)
 ...

+       bool incaption = false;
+       for (int i = cur.depth(); --i >= 0; ) {
+               InsetBase * const in = &cur[i].inset();
+               if (in->lyxCode() == InsetBase::CAPTION_CODE) {
+                       incaption = true;
+                       break;
+               }
+       }
+
        // for captions, we want the abbreviation of the float type
-       if (layout->labeltype == LABEL_SENSITIVE) {
+       if (incaption || layout->labeltype == LABEL_SENSITIVE) {
                // Search for the first float or wrap inset in the iterator
                for (int i = cur.depth(); --i >= 0; ) {
                        InsetBase * const in = &cur[i].inset();
@@ -1758,11 +1768,13 @@
        }
docstring text = name.substr(0, 3);
+
        if (name == "theorem")
                text = from_ascii("thm"); // Create a correct prefix for 
prettyref
text += ':';
-       if (layout->latextype == LATEX_PARAGRAPH || lyxrc.label_init_length < 0)
+       if ((!incaption && layout->latextype == LATEX_PARAGRAPH)
+           || lyxrc.label_init_length < 0)
                text.erase();
docstring par_text = pars_[pit].asString(cur.buffer(), false);

Reply via email to