summaryrefslogtreecommitdiff
path: root/macros/luatex/generic
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic')
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.lua36
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.pdfbin83452 -> 82578 bytes
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.sty8
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.tex15
-rw-r--r--macros/luatex/generic/penlight/penlight.pdfbin38589 -> 38483 bytes
-rw-r--r--macros/luatex/generic/penlight/penlight.sty6
-rw-r--r--macros/luatex/generic/penlight/penlight.tex2
-rw-r--r--macros/luatex/generic/penlight/penlightextras.lua3
8 files changed, 54 insertions, 16 deletions
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.lua b/macros/luatex/generic/lutabulartools/lutabulartools.lua
index 30165f89a9..fd783332a9 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-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/macros/luatex/generic/lutabulartools/lutabulartools.pdf b/macros/luatex/generic/lutabulartools/lutabulartools.pdf
index 770fb8045b..bf53cad818 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.pdf
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.pdf
Binary files differ
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.sty b/macros/luatex/generic/lutabulartools/lutabulartools.sty
index bb72b660a8..abeb1afdef 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.sty
+++ b/macros/luatex/generic/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}{@{}}
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.tex b/macros/luatex/generic/lutabulartools/lutabulartools.tex
index 54af32f78d..8a2b5f8569 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.tex
+++ b/macros/luatex/generic/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/macros/luatex/generic/penlight/penlight.pdf b/macros/luatex/generic/penlight/penlight.pdf
index 3fcd22c54e..55eda4b6fe 100644
--- a/macros/luatex/generic/penlight/penlight.pdf
+++ b/macros/luatex/generic/penlight/penlight.pdf
Binary files differ
diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty
index a73948af29..04cb66a482 100644
--- a/macros/luatex/generic/penlight/penlight.sty
+++ b/macros/luatex/generic/penlight/penlight.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-03-15
+% 2022-04-16
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,7 +22,7 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{penlight}[2022-03-15]
+\ProvidesPackage{penlight}[2022-04-16]
\RequirePackage{luacode}
@@ -65,7 +65,7 @@ end
}}{
\luadirect{
__PDFmetadata__ = __PDFmetadata__ or {}
- table.update(__PDFmetadata__, luakeys.parse(\luastring{#2})
+ table.update(__PDFmetadata__, luakeys.parse(\luastring{#2}))
writePDFmetadata()
}}
}
diff --git a/macros/luatex/generic/penlight/penlight.tex b/macros/luatex/generic/penlight/penlight.tex
index d70fc258f3..f1c07a00cb 100644
--- a/macros/luatex/generic/penlight/penlight.tex
+++ b/macros/luatex/generic/penlight/penlight.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-03-15
+% 2022-04-16
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/macros/luatex/generic/penlight/penlightextras.lua b/macros/luatex/generic/penlight/penlightextras.lua
index e021567c13..253527cc52 100644
--- a/macros/luatex/generic/penlight/penlightextras.lua
+++ b/macros/luatex/generic/penlight/penlightextras.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-03-15
+--% 2022-04-16
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,6 +30,7 @@ __PL_EXTRAS__ = 1
-- requires penlight
local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl
+luakeys = require'luakeys'
-- some bonus string operations, % text operator, and functional programming
pl.stringx.import()