diff options
-rw-r--r-- | Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf | bin | 83452 -> 82578 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex | 15 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua | 36 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty | 8 |
4 files changed, 48 insertions, 11 deletions
diff --git a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf Binary files differindex 770fb8045b1..bf53cad818f 100644 --- a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf +++ b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf diff --git a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex index 54af32f78d7..8a2b5f85691 100644 --- a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex +++ b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-02-27 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -57,6 +57,9 @@ \newcommand{\tMC}{\cmd{\\MC}} +\usepackage[pl,extrasnoglobals]{penlight} + + \RequirePackage{lutabulartools} \title{lutabulartools} \subtitle{some useful tabular tools (LuaLaTeX-based)} @@ -64,6 +67,8 @@ \usepackage{tabularx} \usepackage{siunitx} +\lttdebugON + \begin{document} % todo: can improve naming... set col spec to a table instead of a string @@ -99,6 +104,14 @@ you can manually fix it in a \cmd{tabular} with \cmd{!{}} like so: Xyz\\\bottomrule \end{tabular} \end{LTXexample} +\subsection{Debugging} +You can toggle log output debugging with \cmd{\lttdebugON} and \cmd{\lttdebugOFF}. +The messages will be printed in a format like so: +\begin{verbatim} +vvvvv msg1 (lutabulartools) +msg2 +^^^^^ +\end{verbatim} \section{\texttt{\textbackslash MC} -- Magic Cell} \texttt{\textbackslash MC} (magic cell) combines the facilities of diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua index 30165f89a97..fd783332a91 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-02-27 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,8 +22,23 @@ --% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE --% OR OTHER DEALINGS IN THE SOFTWARE. + +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}{}') +end + local ltt = {} + +ltt.debug = false +function ltt.debugtalk(s, ss) + ss = ss or '' + if ltt.debug then + pl.tex.help_wrt(s, ss..' (lutabulartools)') + end +end + ltt.col_spec1 = {} -- column spec if one column wide (since makcell nests a tabular, preserve col_spec below) ltt.col_spec = {} -- tab column spec if above 1 ltt.col = '' -- current column spec, single char, only applies to tabular with more than 1 column @@ -55,6 +70,7 @@ function ltt.set_col_num() ltt.col_num = 1 end ltt.col = ltt.col_spec[ltt.col_num] + ltt.debugtalk('col_num='..ltt.col_num..'; col_spec='..ltt.col,'set_col_num') end @@ -74,6 +90,7 @@ function ltt.set_col_spec(zz) else ltt.col_spec1 = _col_spec end + ltt.debugtalk(ltt.col_spec,'set_col_spec') end @@ -88,7 +105,7 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) ltt.set_col_num() -- register current column number and column spec local STR = '' - reset_bkt_cnt() + pl.tex.reset_bkt_cnt() local v, h, r, c, mrowsym, skipmakecell = ltt.parse_MagicCell_spec(spec) -- get v/h align, number rows/columns @@ -96,21 +113,23 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) h, mcspec, c = ltt.get_HColSpec(h, mcspec, c) -- infer horizontal alignment, num columns + 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 and c == '') then -- multicolumn cannot have {} around it STR = STR .. '{' -- multirow and makcell must have {} around it S column is used - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if c ~= '' then STR = STR .. "\\multicolumn{"..c.."}{"..mcspec.."}{" - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if r ~= '' then STR = STR .."\\multirow["..v.."]{"..r.."}{"..mrowsym.."}{" -- optional arg here - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if not skipmakecell then @@ -119,14 +138,15 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) end STR = STR.."\\makecell[{"..v.."}{"..h.."}]{" - add_bkt_cnt() + pl.tex.add_bkt_cnt() else content = content:gsub('\\\\', '\\newline') end - STR = STR..content..close_bkt_cnt() + STR = STR..content..pl.tex.close_bkt_cnt() --Troubleshooting --help_wrt(STR..' <<< magic cell string') + ltt.debugtalk(STR,'MagicCell') tex.sprint(STR)--tex print the STR end @@ -252,6 +272,8 @@ function ltt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly 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 diff --git a/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty b/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty index bb72b660a8b..abeb1afdefb 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-02-27 +% 2022-04-16 % 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-02-27] +\ProvidesPackage{lutabulartools}[2022-04-16] \RequirePackage{booktabs} \RequirePackage{multirow} @@ -33,10 +33,12 @@ \RequirePackage{xcolor} \RequirePackage{colortbl} \RequirePackage{luacode} -\RequirePackage[pl,extras]{penlight} % NEEDED +\RequirePackage{penlight} % NEEDED, extras option must be used so penlight should be loaded before this... \luadirect{lutabt = require('lutabulartools')} +\newcommand{\lttdebugON}{\luadirect{lutabt.debug = true}} +\newcommand{\lttdebugOFF}{\luadirect{lutabt.debug = true}} \newcolumntype{\ltt@ltrim}{@{}} \newcolumntype{\ltt@rtrim}{@{}} |