}
-string MathGridInset::eocString(col_type col) const
+string MathGridInset::eocString(col_type col, col_type lastcol) const
{
- if (col + 1 == ncols())
+ if (col + 1 == lastcol)
return string();
return " & ";
}
for (row_type row = 0; row < nrows(); ++row) {
os << verboseHLine(rowinfo_[row].lines_);
// don't write & and empty cells at end of line
+ col_type lastcol = 0;
for (col_type col = 0; col < ncols(); ++col)
- os << cell(index(row, col)) << eocString(col);
+ if (!cell(index(row, col)).empty())
+ lastcol = col + 1;
+ for (col_type col = 0; col < lastcol; ++col)
+ os << cell(index(row, col)) << eocString(col, lastcol);
os << eolString(row, os.fragile());
}
string const s = verboseHLine(rowinfo_[nrows()].lines_);
/// returns proper 'end of line' code for LaTeX
virtual string eolString(row_type row, bool fragile = false) const;
/// returns proper 'end of column' code for LaTeX
- virtual string eocString(col_type col) const;
+ virtual string eocString(col_type col, col_type lastcol) const;
/// extract number of columns from alignment string
col_type guessColumns(string const & halign) const;
/// splits cells and shifts right part to the next cell
cell = &grid.cell(grid.index(cellrow, cellcol));
}
-#if 1
+#if 0
else if (t.cs() == "multicolumn") {
// extract column count and insert dummy cells
MathArray count;