summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua29
-rw-r--r--Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty23
2 files changed, 35 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua
index 361530bc978..24c8d5598e5 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-10-15
+--% 2022-10-22
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,7 +25,8 @@
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 extrasnoglobals) option must be loaded before this package}{}')
+ tex.sprint('\\PackageError{yamlvars}{penlight package with extras (or extrasglobals) option must be loaded before this package}{}')
+ tex.print('\\stop')
end
local ltt = {}
@@ -111,7 +112,7 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content)
ltt.debugtalk(pl.List{v, h, r, c, mcspec}:join'; ','v, h, r, c, mcspec')
--help_wrt(_CurTabColAbv,'current column')
- if s0 == _xTrue or (pl.List(ltt.SI_cols):contains(ltt.col) -- special columns for SI
+ if s0 == pl.tex._xTrue or (pl.List(ltt.SI_cols):contains(ltt.col) -- special columns for SI
and c == '') then -- multicolumn cannot have {} around it
STR = STR .. '{' -- multirow and makcell must have {} around it S column is used
pl.tex.add_bkt_cnt()
@@ -266,8 +267,6 @@ function ltt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly
end
c = ltt.get_midrule_col(t[1])..'-'..ltt.get_midrule_col(t[2])
cmd = cmd..'{'..c..'}'
- --help_wrt(cmd)
-
ltt.debugtalk(cmd,'make1cmidrule')
tex.print(cmd)
end
@@ -303,28 +302,34 @@ function ltt.mrX.set_midruleX(new_sett, def)
end
new_sett = luakeys.parse(new_sett)
ltt.mrX.settings = T.union(curr_sett, new_sett)
- ltt.debugtalk{ltt.mrX.settings, 'new settings'}
+ ltt.debugtalk(ltt.mrX.settings, 'new midruleX settings')
ltt.mrX.cntr = curr_sett.cntr
end
function ltt.mrX.midruleX(n)
n = n or '' -- todo placeholder for noalign ?
local s = ltt.mrX.settings
+ local rule = s.rule
if pl.hasval(s.reset) and ltt.mrX.add_label_and_check_page_change() then ltt.mrX.cntr = s.resetnum end
ltt.mrX.cntr = ltt.mrX.cntr + 1
if ltt.mrX.cntr == s.step then
- ltt.debugtalk{s.rule, 'apply midruleX'}
- tex.sprint('\\'..s.rule)
+ if not rule:startswith('\\') then rule = '\\'..rule end -- todo consider allowing \gmidrule syntax, possible issue with expansion
+ ltt.debugtalk(rule, 'apply midruleX')
+ tex.sprint(rule)
ltt.mrX.cntr = 0
end
end
function ltt.mrX.add_label_and_check_page_change()
- ltt.mrX.pgcntr = ltt.mrX.pgcntr + 1
+ ltt.mrX.pgcntr = ltt.mrX.pgcntr + 1
tex.print('\\noalign{\\label{ltt@tabular@row@'..ltt.mrX.pgcntr..'}}')
- local _, pgcurr = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr)
- local _, pgprev = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr-1)
- if pgcurr ~= pgprev then
+ local rcurr = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr)
+ local rprev = pl.tex.get_ref_info('ltt@tabular@row@'..ltt.mrX.pgcntr-1)
+ --local rcurrc, _, _ = pl.tex.get_ref_info_all_cref('ltt@tabular@row@'..ltt.mrX.pgcntr)
+ ltt.debugtalk('curr: '..rcurr[2]..' prev: '..rprev[2]..' row: '..ltt.mrX.pgcntr, 'check midruleX page change')
+ ltt.debugtalk(rcurr, 'miduleX current reference info for row: '..ltt.mrX.pgcntr)
+ --ltt.debugtalk(rcurrc, 'miduleX current cleveref cref info')
+ if rcurr[2] ~= rprev[2] then -- pg no is second element
return true
end
return false
diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty
index 5a501a8346c..f1dea60c5a7 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-10-15
+% 2022-10-22
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,7 +23,7 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lutabulartools}[2022-10-15]
+\ProvidesPackage{lutabulartools}[2022-10-22]
\RequirePackage{booktabs}
\RequirePackage{multirow}
@@ -53,7 +53,10 @@
\def\midruleX{\aftergroup\aftergroup\aftergroup\midruleX@aux}
\def\midruleX@aux{\luadirect{lutabt.mrX.midruleX('')}} % todo argument for vadjust or noalign??
-\NewDocumentCommand{\setmidruleX}{s m}{\luadirect{lutabt.mrX.set_midruleX(\luastring{#2}, \luastring{#1})}}
+\NewDocumentCommand{\setmidruleX}{s O{N} m}{%
+ \MakeluastringCommands[N]{#2}%
+ \luadirect{lutabt.mrX.set_midruleX(\plluastringA{#3}, \luastring{#1})}%
+}
\NewDocumentCommand{\midruleXreset}{O{0}}{\luadirect{lutabt.mrX.cntr = tonumber(\luastring{#1})}}
\NewCommandCopy\resetmidruleX\midruleXreset
@@ -141,14 +144,14 @@
\let\oldtabular\tabular
-\RenewExpandableDocumentCommand{\tabular}{ O{c} m }{%
+\RenewExpandableDocumentCommand{\tabular}{ O{l} m }{%
\luadirect{lutabt.set_col_spec(\luastringN{#2})}%
\oldtabular[#1]{\ltt@ltrim#2\ltt@rtrim}%
}
\expandafter\let\expandafter\oldtabulars\csname tabular*\endcsname
\expandafter\let\expandafter\endoldtabulars\csname endtabular*\endcsname
-\RenewDocumentEnvironment{tabular*}{ m O{c} m }{%
+\RenewDocumentEnvironment{tabular*}{ m O{l} m }{%
\luadirect{lutabt.set_col_spec(\luastringN{#3})}%
\begin{oldtabulars}{#1}[#2]{\ltt@ltrim#3\ltt@rtrim}%
}{%
@@ -156,6 +159,12 @@
}
%%% NOTE tabularx uses tabular*, NO NEED TO CHANGE TABULARX!
+\let\oldlongtable\longtable
+\RenewExpandableDocumentCommand{\longtable}{ O{l} m }{%
+ \luadirect{lutabt.set_col_spec(\luastringN{#2})}%
+ \oldlongtable[#1]{\ltt@ltrim#2\ltt@rtrim}%
+}
+
%s0,spec,mcspec,pre,content
% Magic Cell
@@ -184,6 +193,10 @@
lutabt.SI_cols[\string##lutabt.SI_cols+1] = '#1'
}}
+\NewDocumentCommand{\forcecolspec}{ m }{\luadirect{
+ lutabt.col_spec = (\luastring{#1}):totable()
+}}
+
\ProcessOptions