]> git.lyx.org Git - features.git/commitdiff
Fix bug #7019 (Math labels should not be escaped on saving)
authorEnrico Forestieri <forenr@lyx.org>
Sat, 6 Nov 2010 02:53:29 +0000 (02:53 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 6 Nov 2010 02:53:29 +0000 (02:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36156 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathGrid.cpp
src/mathed/InsetMathGrid.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 2c950e54539279d8ffe2f26168f23a51500d2b15..ada03bb8e528734a24b36318167f57b5d72f993a 100644 (file)
@@ -644,7 +644,8 @@ void InsetMathGrid::updateBuffer(ParIterator const & it, UpdateType utype)
 }
 
 
-docstring InsetMathGrid::eolString(row_type row, bool fragile, bool last_eoln) const
+docstring InsetMathGrid::eolString(row_type row, bool fragile, bool latex,
+               bool last_eoln) const
 {
        docstring eol;
 
@@ -1061,7 +1062,7 @@ void InsetMathGrid::write(WriteStream & os,
                                ModeSpecifier specifier(os, TEXT_MODE);
                        os << eocString(col, lastcol);
                }
-               eol = eolString(row, os.fragile(), last_eoln);
+               eol = eolString(row, os.fragile(), os.latex(), last_eoln);
                os << eol;
                // append newline only if line wasn't completely empty
                // and the formula is not written on a single line
index 0dff138b3722101bdd43fce2e43aac4869486493..3b1b5a1c25109b1c6e072013d8f8457ac8b5a50b 100644 (file)
@@ -240,7 +240,8 @@ protected:
        /// returns y offset of cell compared to inset
        int cellYOffset(idx_type idx) const;
        /// returns proper 'end of line' code for LaTeX
-       virtual docstring eolString(row_type row, bool fragile, bool last_eoln) const;
+       virtual docstring eolString(row_type row, bool fragile, bool latex,
+                       bool last_eoln) const;
        /// returns proper 'end of column' code for LaTeX
        virtual docstring eocString(col_type col, col_type lastcol) const;
        /// splits cells and shifts right part to the next cell
index bd0b9c5f36294008eb3d8e4bd0e306da795460c0..0ada0bc9f58e19b0de0ded5916212a3cf04e27bc 100644 (file)
@@ -1120,19 +1120,23 @@ void InsetMathHull::mutate(HullType newtype)
 }
 
 
-docstring InsetMathHull::eolString(row_type row, bool fragile, bool last_eoln) const
+docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex,
+               bool last_eoln) const
 {
        docstring res;
        if (numberedType()) {
-               if (label_[row] && numbered_[row])
-                       res += "\\label{" +
-                           escape(label_[row]->getParam("name")) + '}';
+               if (label_[row] && numbered_[row]) {
+                       docstring const name =
+                               latex ? escape(label_[row]->getParam("name"))
+                                     : label_[row]->getParam("name");
+                       res += "\\label{" + name + '}';
+               }
                if (!numbered_[row] && (type_ != hullMultline))
                        res += "\\nonumber ";
        }
        // Never add \\ on the last empty line of eqnarray and friends
        last_eoln = false;
-       return res + InsetMathGrid::eolString(row, fragile, last_eoln);
+       return res + InsetMathGrid::eolString(row, fragile, latex, last_eoln);
 }
 
 
index 6e2a1cd97408620910cb6583721d72e6d73a5481..7f161f22357ca1365efbab44d09ac2fc5495ad7b 100644 (file)
@@ -167,7 +167,8 @@ protected:
        bool getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & status) const;
        ///
-       docstring eolString(row_type row, bool fragile, bool last_eoln) const;
+       docstring eolString(row_type row, bool fragile, bool latex,
+                       bool last_eoln) const;
 
 private:
        virtual Inset * clone() const;