@@ -86,11 +86,14 @@ function TabularRow(height, colspecs, skips, rows_with_rowspans, row, i, plain,
8686 local clines_code = ' '
8787 local any_skips = false
8888 if not plain and (i > 1 or not no_first_hline ) then
89- for j = 1 ,width do
89+ local j = 1
90+ while j <= width do
9091 if skips [(i - 1 )* width + j ] then
9192 any_skips = true
93+ j = j + skips [(i - 1 )* width + j ]
9294 else
9395 clines_code = clines_code .. string.format (" \\ cline{%d-%d}" , j , j )
96+ j = j + 1
9497 end
9598 end
9699 -- Simplify a whole row of clines as just an hline.
@@ -115,10 +118,7 @@ function TabularRow(height, colspecs, skips, rows_with_rowspans, row, i, plain,
115118 -- Even more complicated: We may need to put a multicolumn here (in the event that there are multiple
116119 -- skipped cells in a row).
117120 local skipstart = j
118- local skipend = j
119- while skips [(i - 1 )* width + skipend + 1 ] do
120- skipend = skipend + 1
121- end
121+ local skipend = j + skips [(i - 1 )* width + j ] - 1
122122 if skipstart == skipend then
123123 table.insert (row_code , ' ' )
124124 else
@@ -177,9 +177,7 @@ function TabularRow(height, colspecs, skips, rows_with_rowspans, row, i, plain,
177177 -- tabularx/multirow/multicolumn want us to NOT provide empty "& &" cells after a multicolumn.
178178 -- Multirow cells DO need empty "& &" cells populated.
179179 for skipi = i + 1 ,i + cell .row_span - 1 do
180- for skipj = j ,j + cell .col_span - 1 do
181- skips [(skipi - 1 )* width + skipj ] = true
182- end
180+ skips [(skipi - 1 )* width + j ] = cell .col_span
183181 end
184182 end
185183
0 commit comments