summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lutabulartools/lutabulartools.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lutabulartools/lutabulartools.lua')
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.lua53
1 files changed, 5 insertions, 48 deletions
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.lua b/macros/luatex/generic/lutabulartools/lutabulartools.lua
index 719f89873e..3ea2151834 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.lua
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-11-29
+--% 2023-07-18
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,7 +25,7 @@
local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl
if (__PL_EXTRAS__ == nil) or (__PENLIGHT__ == nil) then
- tex.sprint('\\PackageError{yamlvars}{penlight package with extras (or extrasglobals) option must be loaded before this package}{}')
+ tex.sprint('\\PackageError{lutabulartools}{penlight package with extras (or extrasglobals) option must be loaded before this package}{}')
tex.print('\\stop')
end
local T = pl.tablex
@@ -93,7 +93,6 @@ function lutabt.debugtalk(s, ss)
end
function __lutabt__debugprtall()
- --pl.help_wrt(pl.tablex.filter({ lutabt }, function(v) return type(v) ~= 'function' end), '(lutabulartools state)')
pl.help_wrt(lutabt, '(lutabulartools state)')
end
@@ -420,10 +419,10 @@ end
-----
lutabt.mrX = {}
-lutabt.mrX.resets = {long=false, longhead=0, cntr=0, head=nil, longx=false, on=true} -- settings that reset when \setmidruleX used
+lutabt.mrX.resets = {long=false, cntr=0, head=nil, longx=false, on=true} -- settings that reset when \setmidruleX used
lutabt.mrX.resets['head*'] = nil
lutabt.mrX.settings = T.update(T.copy(lutabt.mrX.resets), {pgcntr=0, step=5, rule='midrule'}) -- current settings, not overwritten with each call
-
+lutabt.mrX.settings.on = false
function lutabt.mrX.reset_midruleX(n)
lutabt.mrX.settings.cntr = tonumber(n)
@@ -459,7 +458,7 @@ function lutabt.mrX.midruleX(n)
lutabt.debugtalk(lutabt.mrX.settings, 'midruleX here')
local s = lutabt.mrX.settings
local rule = s.rule
- if pl.hasval(s.long) and lutabt.mrX.add_label_and_check_page_change() then lutabt.mrX.settings.cntr = -1*s.longhead end -- reset to number on page change
+ if pl.hasval(s.long) and lutabt.mrX.add_label_and_check_page_change() then lutabt.mrX.settings.cntr = 0 end -- reset to number on page change -- longhead not used anymore
lutabt.mrX.settings.cntr = lutabt.mrX.settings.cntr + 1
if lutabt.mrX.settings.cntr == s.step then
if not rule:startswith('\\') then rule = '\\'..rule end -- todo consider allowing \gmidrule syntax, possible issue with expansion
@@ -498,45 +497,3 @@ return lutabt -- lutabulartools
-
---
---lutabt.tabular_row_pages_cntr = 0
---function lutabt.reset_midruleX_on_newpage(n)
--- local n = n or 0
--- lutabt.tabular_row_pages_cntr = lutabt.tabular_row_pages_cntr + 1
--- tex.print('\\noalign{\\label{tabular@row@'..lutabt.tabular_row_pages_cntr..'}}')
--- if lutabt.get_ref_page('tabular@row@'..lutabt.tabular_row_pages_cntr) -
--- lutabt.get_ref_page('tabular@row@'..(lutabt.tabular_row_pages_cntr-1)) == 1 then
--- tex.print('\\setcounter{midruleX}{'..n..'}')
--- end
---end
-
-
---help_wrt('TEST COL ')
---for _, s in ipairs{ 'll', '*{6}{s}', 'l*{6}{l}', 'lll', 'll[]', 'll[]*{6}{l}', '*{6}{l}', 'y*{6}{sq}x', } do
--- lutabt. set_col_spec(s)
--- help_wrt(lutabt.col_spec,s)
---end
-
-
--- todo move mrX mechanim to avoid @{}
---function lutabt.mrX.set_midruleX(new_sett, def)
--- def = def or ''
--- local curr_sett = {}
--- if def == pl.tex._xTrue then -- default flag, if true, reset all non-used keys to default
--- curr_sett = lutabt.mrX.defaults
--- else
--- curr_sett = lutabt.mrX.settings
--- end
--- new_sett = luakeys.parse(new_sett)
--- lutabt.mrX.settings = T.union(curr_sett, new_sett)
---
--- lutabt.debugtalk(lutabt.mrX.settings, 'new midruleX settings')
--- lutabt.mrX.settings.cntr = tonumber(curr_sett.cntr) -- todo this needs to be a settings var
--- if new_sett.cntr ~= nil then -- todo fix the counter
--- lutabt.mrX.settings.cntr = tonumber(new_sett.cntr)
--- end
--- if new_sett.head ~= nil then -- todo fix the counter
--- lutabt.mrX.settings.cntr = -1*tonumber(new_sett.head)
--- end
---end