if (eol.empty() && row + 1 == nrows())
return string();
- return (fragile ? "\\protect\\\\" : "\\\\") + eol + '\n';
+ return (fragile ? "\\protect\\\\" : "\\\\") + eol;
}
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 != " ") {
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) << "}";