texlive[63043] Master/texmf-dist: lutabulartools (16apr22)

commits+karl at tug.org commits+karl at tug.org
Sat Apr 16 22:24:15 CEST 2022


Revision: 63043
          http://tug.org/svn/texlive?view=revision&revision=63043
Author:   karl
Date:     2022-04-16 22:24:15 +0200 (Sat, 16 Apr 2022)
Log Message:
-----------
lutabulartools (16apr22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf
    trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex
    trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua
    trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty

Modified: trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex	2022-04-16 20:24:03 UTC (rev 63042)
+++ trunk/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex	2022-04-16 20:24:15 UTC (rev 63043)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at 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 @@
 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

Modified: trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua	2022-04-16 20:24:03 UTC (rev 63042)
+++ trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.lua	2022-04-16 20:24:15 UTC (rev 63043)
@@ -1,5 +1,5 @@
 --% Kale Ewasiuk (kalekje at 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 @@
       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 @@
     else
         ltt.col_spec1 = _col_spec
     end
+    ltt.debugtalk(ltt.col_spec,'set_col_spec')
 end
 
 
@@ -88,7 +105,7 @@
     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 @@
 
     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 @@
         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 @@
     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
 

Modified: trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty	2022-04-16 20:24:03 UTC (rev 63042)
+++ trunk/Master/texmf-dist/tex/luatex/lutabulartools/lutabulartools.sty	2022-04-16 20:24:15 UTC (rev 63043)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at 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 at ltrim}{@{}}
 \newcolumntype{\ltt at rtrim}{@{}}



More information about the tex-live-commits mailing list.