mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Fix toprule with booktabs/longtable and captions
This commit is contained in:
parent
91383e1fec
commit
fe589d5622
@ -2419,14 +2419,18 @@ void Tabular::TeXTopHLine(otexstream & os, row_type row, string const & lang,
|
|||||||
if ((row == 0 && nset == 0) || (row > 0 && nset != ncols()))
|
if ((row == 0 && nset == 0) || (row > 0 && nset != ncols()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Is this the actual first row (excluding longtable caption row)?
|
||||||
|
bool const realfirstrow = (row == 0
|
||||||
|
|| (is_long_tabular && row == 1 && ltCaption(0)));
|
||||||
|
|
||||||
// only output complete row lines and the 1st row's clines
|
// only output complete row lines and the 1st row's clines
|
||||||
if (nset == ncols() && !have_trims) {
|
if (nset == ncols() && !have_trims) {
|
||||||
if (use_booktabs) {
|
if (use_booktabs) {
|
||||||
os << (row == 0 ? "\\toprule " : "\\midrule ");
|
os << (realfirstrow ? "\\toprule " : "\\midrule ");
|
||||||
} else {
|
} else {
|
||||||
os << "\\hline ";
|
os << "\\hline ";
|
||||||
}
|
}
|
||||||
} else if (row == 0 || have_trims) {
|
} else if (realfirstrow || have_trims) {
|
||||||
string const cline = use_booktabs ? "\\cmidrule" : "\\cline";
|
string const cline = use_booktabs ? "\\cmidrule" : "\\cline";
|
||||||
for (auto & c : columns) {
|
for (auto & c : columns) {
|
||||||
if (topline.find(c)->second) {
|
if (topline.find(c)->second) {
|
||||||
@ -4431,7 +4435,9 @@ void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
|
|||||||
// Top
|
// Top
|
||||||
bool drawline = tabular.topLine(cell)
|
bool drawline = tabular.topLine(cell)
|
||||||
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
|
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
|
||||||
bool heavy = tabular.use_booktabs && row == 0 && tabular.rowTopLine(row);
|
bool heavy = tabular.use_booktabs
|
||||||
|
&& (row == 0 || (tabular.is_long_tabular && row == 1 && tabular.ltCaption(0)))
|
||||||
|
&& tabular.rowTopLine(row);
|
||||||
if (tabular.topLineTrim(cell).first
|
if (tabular.topLineTrim(cell).first
|
||||||
|| (row > 0 && tabular.bottomLineTrim(tabular.cellIndex(row - 1, col)).first))
|
|| (row > 0 && tabular.bottomLineTrim(tabular.cellIndex(row - 1, col)).first))
|
||||||
lt = 10;
|
lt = 10;
|
||||||
|
Loading…
Reference in New Issue
Block a user