diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-19 20:48:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-19 20:48:30 +0000 |
commit | a35702bb9de1169a9f02b42e6c98d60cb9955ee8 (patch) | |
tree | 4caf9f84545558ed93249d59fd7ff695cc091d69 /Master/texmf-dist/tex/luatex | |
parent | 46e92b206bf620ead310761364e60f304c5dc4c6 (diff) |
lutabulartools (19jul23)
git-svn-id: svn://tug.org/texlive/trunk@67671 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua | 53 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty | 71 |
2 files changed, 8 insertions, 116 deletions
diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua index 719f89873e0..3ea21518342 100644 --- a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua +++ b/Master/texmf-dist/tex/luatex/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 diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty index 4ca37525780..c1e74802c02 100644 --- a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty +++ b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty @@ -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 @@ -23,10 +23,11 @@ % OR OTHER DEALINGS IN THE SOFTWARE. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lutabulartools}[2022-11-29] +\ProvidesPackage{lutabulartools}[2023-07-18] \RequirePackage{booktabs} \RequirePackage{multirow} +\RequirePackage{longtable} \RequirePackage{makecell} \RequirePackage{xparse} \RequirePackage{array} @@ -235,69 +236,3 @@ \ProcessOptions - - - - - -%%% OLD STUFF, -%% before I had a fall-back for counting columns (just calculate current column on last column once) -%% and kept track of row numbers. I felt that this wasn't needed, so I've removed. -%\newcommand{\TabColNum}{\luadirect{tex.print(lutabt.get_TabColNum())}} % prints the current column number of tabular -%\newcommand{\NumTabCols}{\luadirect{tex.print(lutabt.NumTabCols)}} % prints the total num columns of tabular -%\newcounter{RowNumCnt} -%\setcounter{RowNumCnt}{1} -% \setcounter{RowNumCnt}{1}% -% \luadirect{lutabt.NumTabColsMX = 0}% fall back if calc doesnt work for some reason -% \setcounter{RowNumCnt}{1}% -% \luadirect{lutabt.NumTabColsMX = 0}% fall back if calc doesnt work for some reason -%\DeclareOption{notrimx}{ -% \global\newcolumntype{\lttltrim}{!{\stepcounter{RowNumCnt}}} -%% \global\newcolumntype{\lttrtrim}{!{\luadirect{lutabt.get_TabColNum()}}} -%} -%\DeclareOption{trimx}{ -% \newcolumntype{\lttltrim}{@{\stepcounter{RowNumCnt}}} -%% \newcolumntype{\lttrtrim}{@{\luadirect{lutabt.get_TabColNum()}}} -%} - - -%% adapted from -% https://tex.stackexchange.com/questions/182953/add-midrule-every-5-lines-automatically -%% https://tex.stackexchange.com/questions/145084/what-is-the-function-of-noalign -% -%\def\midruleXstep{5} -%\def\midruleXrule{\gmidrule} -% -%\newcounter{midruleX} -%\newcommand*{\midruleXa}{% -% \aftergroup\aftergroup\aftergroup\midruleXaux -%} -% -%\newif\ifmidruleX -% -%\newcommand*{\midruleXaux}{% -% \noalign{% -% \stepcounter{midruleX}% -% \ifnum\value{midruleX}=\midruleXstep % -% \global\midruleXtrue -% \resetmidruleX% -% \else -% \global\midruleXfalse -% \fi -% } -% \ifmidruleX\midruleXrule\fi -%} - -%\newcommand*{\resetmidruleX}{\setcounter{midruleX}{0}} % -%\resetmidruleX - -%\NewDocumentCommand{\resetmidruleXonNP}{O{0}}{\luadirect{lutabt.reset_midruleX_on_newpage(\luastring{#1})}} - -% -%\NewDocumentCommand{\IfmidruleX}{m m}{% if a midruleX was placed, do #1, if not, do #2 -% \ifnum\the\value{midruleX}=0 -% #1 -% \else -% #2 -% \fi% -%}
\ No newline at end of file |