add debugging option

This commit is contained in:
Ulrike Fischer 2025-02-26 17:02:11 +01:00
parent 11ac18a6f5
commit 0b9c886c19

View File

@ -44,7 +44,7 @@ lua.get_functions_table()[funcid] = function()
set_row_attribute('columnalign', token.scan_argument()) set_row_attribute('columnalign', token.scan_argument())
end end
-- This fucntion is used to add a intent :continued-row to -- This function is used to add a intent :continued-row to
-- rows of a split environment. -- rows of a split environment.
-- we assume that the table is a mtable with mrow with mtd. -- we assume that the table is a mtable with mrow with mtd.
-- we check row 2..n. If the first cell has only one element and -- we check row 2..n. If the first cell has only one element and
@ -60,6 +60,17 @@ local function add_intent_continued_row (table)
end end
end end
-- debug function for tables
-- activate with \directlua{debugmtable=2} or \directlua{debugmtable='split'}
local function debug_mtable (mtable,kind)
if debugmtable and (debugmtable==2) or (debugmtable==kind) then
texio.write_nl('==============')
texio.write_nl(kind)
texio.write_nl(table.serialize(mtable))
texio.write_nl('==============')
end
end
do do
local saved local saved
funcid = luatexbase.new_luafunction'__luamml_amsmath_save_inner_table:n' funcid = luatexbase.new_luafunction'__luamml_amsmath_save_inner_table:n'
@ -82,6 +93,7 @@ do
spacing[#spacing+1] = n.width == 0 and '0' or string.format('%.3fpt', n.width/65781.76) spacing[#spacing+1] = n.width == 0 and '0' or string.format('%.3fpt', n.width/65781.76)
end end
mml_table.columnspacing = #spacing > 3 and table.concat(spacing, ' ', 2, #spacing-2) or nil mml_table.columnspacing = #spacing > 3 and table.concat(spacing, ' ', 2, #spacing-2) or nil
debug_mtable(mml_table,kind)
saved = mml_table saved = mml_table
end end
@ -96,6 +108,7 @@ do
mml_table.columnspacing = '0.278em' mml_table.columnspacing = '0.278em'
mml_table.rowspacing = string.format('%.3fpt', tex.lineskip.width/65781.76) mml_table.rowspacing = string.format('%.3fpt', tex.lineskip.width/65781.76)
saved = {[0] = 'mpadded', width = '+0.333em', lspace = '0.167em', mml_table} saved = {[0] = 'mpadded', width = '+0.333em', lspace = '0.167em', mml_table}
debug_mtable(mml_table,kind)
saved = mml_table saved = mml_table
end end
@ -137,6 +150,7 @@ lua.get_functions_table()[funcid] = function()
spacing[#spacing+1] = n.width == 0 and '0' or '.8em' spacing[#spacing+1] = n.width == 0 and '0' or '.8em'
end end
mml_table.columnspacing = #spacing > 3 and table.concat(spacing, ' ', 2, #spacing-2) or nil mml_table.columnspacing = #spacing > 3 and table.concat(spacing, ' ', 2, #spacing-2) or nil
debug_mtable(mml_table,kind)
save_result(mml_table, true) save_result(mml_table, true)
end end