From: André Pönitz Date: Thu, 24 Oct 2002 10:56:32 +0000 (+0000) Subject: fix a several weeks old "fix" to prevent too many \n in latex output X-Git-Tag: 1.6.10~18105 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=74b3a1ce5940d9b9c5bfbdbbf64d2f3cc9084687;p=features.git fix a several weeks old "fix" to prevent too many \n in latex output (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 --- diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index cc0f4264f3..e9d1e5bcfb 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -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 != " ") { diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 5c99996614..304b0ecade 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -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) << "}";