+ // LyX ends headers and footers always with \tabularnewline.
+ // This causes one additional row in the output.
+ // If the last row of a header/footer is empty, we can work
+ // around that by removing it.
+ if (row > 1) {
+ RowInfo test = rowinfo[row-1];
+ test.type = LT_NORMAL;
+ if (lines[row-1].empty() && !test.special()) {
+ switch (rowinfo[row-1].type) {
+ case LT_FIRSTHEAD:
+ if (rowinfo[row].type != LT_FIRSTHEAD &&
+ rowinfo[row-2].type == LT_FIRSTHEAD)
+ deletelastrow = true;
+ break;
+ case LT_HEAD:
+ if (rowinfo[row].type != LT_HEAD &&
+ rowinfo[row-2].type == LT_HEAD)
+ deletelastrow = true;
+ break;
+ case LT_FOOT:
+ if (rowinfo[row].type != LT_FOOT &&
+ rowinfo[row-2].type == LT_FOOT)
+ deletelastrow = true;
+ break;
+ case LT_LASTFOOT:
+ if (rowinfo[row].type != LT_LASTFOOT &&
+ rowinfo[row-2].type == LT_LASTFOOT)
+ deletelastrow = true;
+ break;
+ case LT_NORMAL:
+ break;
+ }
+ }
+ }
+
+ if (deletelastrow) {
+ lines.erase(lines.begin() + (row - 1));
+ rowinfo.erase(rowinfo.begin() + (row - 1));
+ cellinfo.erase(cellinfo.begin() + (row - 1));
+ continue;
+ }
+