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
This commit is contained in:
André Pönitz 2002-10-24 10:56:32 +00:00
parent 96e8676748
commit 74b3a1ce59
2 changed files with 10 additions and 8 deletions

View 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 != " ") {

View 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) << "}";