]> git.lyx.org Git - features.git/commitdiff
fix a several weeks old "fix" to prevent too many \n in latex output
authorAndré Pönitz <poenitz@gmx.net>
Thu, 24 Oct 2002 10:56:32 +0000 (10:56 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 24 Oct 2002 10:56:32 +0000 (10:56 +0000)
(which are a problem if two of them come in a row...)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5492 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_gridinset.C
src/mathed/math_hullinset.C

index cc0f4264f3c0a43c03a16df864315422a4ce1017..e9d1e5bcfb61f2e77c01166895c489d82350df84 100644 (file)
@@ -532,7 +532,7 @@ string MathGridInset::eolString(row_type row, bool fragile) const
        if (eol.empty() && row + 1 == nrows())
                return string();
 
-       return (fragile ? "\\protect\\\\" : "\\\\") + eol + '\n';
+       return (fragile ? "\\protect\\\\" : "\\\\") + eol;
 }
 
 
@@ -905,16 +905,18 @@ void MathGridInset::write(WriteStream & os) const
                os << verboseHLine(rowinfo_[row].lines_);
                // don't write & and empty cells at end of line
                col_type lastcol = 0;
+               bool emptyline = true;
                for (col_type col = 0; col < ncols(); ++col)
-                       if (!cell(index(row, col)).empty())
+                       if (!cell(index(row, col)).empty()) {
                                lastcol = col + 1;
+                               emptyline = false;
+                       }
                for (col_type col = 0; col < lastcol; ++col)
                        os << cell(index(row, col)) << eocString(col, lastcol);
-               // I _really_ hate LaTeX's syntax quirks. Why is 
-               // \begin{eqnarray}\end{eqnarray} not valid?
-               if (lastcol == 0 && os.latex())
-                       os << "\\ ";
                os << eolString(row, os.fragile());
+               // append newline only if line wasn't completely empty
+               if (!emptyline)
+                       os << "\n";
        }
        string const s = verboseHLine(rowinfo_[nrows()].lines_);
        if (!s.empty() && s != " ") {
index 5c99996614b94bf685bd16441fffc0acce0b487e..304b0ecadeb13d626d000c87a6a0351bfc06d21a 100644 (file)
@@ -394,10 +394,10 @@ void MathHullInset::footer_write(WriteStream & os) const
 
        else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"  
             || type_ == "alignat" || type_ == "xalignat")
-               os << "\n\\end{" << type_ << star(n) << "}\n";
+               os << "\\end{" << type_ << star(n) << "}\n";
 
        else if (type_ == "xxalignat" || type_ == "multline" || type_ == "gather")
-               os << "\n\\end{" << type_ << "}\n";
+               os << "\\end{" << type_ << "}\n";
 
        else
                os << "\\end{unknown" << star(n) << "}";