summaryrefslogtreecommitdiff
path: root/macros/luatex/generic
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic')
-rw-r--r--macros/luatex/generic/lutabulartools/README.md2
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.lua6
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.pdfbin112269 -> 112446 bytes
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.sty15
-rw-r--r--macros/luatex/generic/lutabulartools/lutabulartools.tex9
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.lua25
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.pdfbin79208 -> 78659 bytes
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.sty4
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.tex40
9 files changed, 68 insertions, 33 deletions
diff --git a/macros/luatex/generic/lutabulartools/README.md b/macros/luatex/generic/lutabulartools/README.md
index ee3381533b..6e9960c096 100644
--- a/macros/luatex/generic/lutabulartools/README.md
+++ b/macros/luatex/generic/lutabulartools/README.md
@@ -7,7 +7,7 @@ macro-enabled spreadsheet named "LaTeX-Tabular-Generator.xlsm" to help make tabl
# License (MIT)
-Copyright (C) 2021-2023 Kale Ewasiuk
+Copyright (C) 2021-2025 Kale Ewasiuk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.lua b/macros/luatex/generic/lutabulartools/lutabulartools.lua
index 92ce236715..7b1a832bc4 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.lua
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.lua
@@ -1,6 +1,6 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2023-07-22
---% Copyright (C) 2021-2023 Kale Ewasiuk
+--% 2025-01-06
+--% Copyright (C) 2021-2025 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
--% of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +30,7 @@ local lutabt = {}
local pl = penlight
local T = pl.tablex
-lutabt.luakeys = require'luakeys'() -- note: YAMLvars.sty will have checked existence of this already
+lutabt.luakeys = require'luakeys'()
lutabt.tablelevel = 0
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.pdf b/macros/luatex/generic/lutabulartools/lutabulartools.pdf
index eab8203760..290498ae70 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 ee36589cd5..0b1041fbfd 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.sty
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.sty
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-07-22
-% Copyright (C) 2021-2023 Kale Ewasiuk
+% 2025-01-06
+% Copyright (C) 2021-2025 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lutabulartools}[2023-07-22]
+\ProvidesPackage{lutabulartools}[2025-01-06]
\RequirePackage{booktabs}
\RequirePackage{multirow}
@@ -59,8 +59,15 @@
}
\NewDocumentCommand{\resetmidruleX}{O{0}}{\luadirect{lutabt.mrX.reset_midruleX(\luastring{#1})}}
+\NewCommandCopy{\ltt@RealPackageWarning}{\PackageWarning}
+\newcommand*{\ltt@DeactivatePackageWarning}{\renewcommand*{\PackageWarning}[2]{}}
+\newcommand*{\ltt@ActivatePackageWarning}{\RenewCommandCopy{\PackageWarning}{\ltt@RealPackageWarning}}
-\NewDocumentCommand{\settabular}{s m}{\luadirect{lutabt.set_tabular(\luastring{#2})}} %
+
+\NewDocumentCommand{\settabular}{s m}{\ltt@DeactivatePackageWarning%
+ \luadirect{lutabt.set_tabular(\luastring{#2})}%
+ \ltt@ActivatePackageWarning%
+}%
\def\ltt@resetrownum{\luadirect{lutabt.reset_rows()}}
\def\ltt@resetrownumhard{\luadirect{lutabt.row_num = 0}}
diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.tex b/macros/luatex/generic/lutabulartools/lutabulartools.tex
index b9a4c96254..1676bd2b09 100644
--- a/macros/luatex/generic/lutabulartools/lutabulartools.tex
+++ b/macros/luatex/generic/lutabulartools/lutabulartools.tex
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-07-22
-% Copyright (C) 2021-2023 Kale Ewasiuk
+% 2025-01-06
+% Copyright (C) 2021-2025 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
@@ -53,7 +53,7 @@
\addtokomafont{date}{\raggedright}
\author{Kale Ewasiuk (\url{kalekje@gmail.com})}
\usepackage[yyyymmdd]{datetime}\renewcommand{\dateseparator}{--}
-\date{\today}
+\date{\,\,\today}
@@ -115,6 +115,9 @@ or adjusts the \cmd{tabcolsep} length (an integer must be used, the result is mu
\settabular{nopad=false,tbrule=false} % to set the switches to off
\end{verbatim}
+\settabular{nopad}
+\settabular{!nopad}
+
\section{Debugging}
You can toggle log output debugging with \cmd{\lttdebugON} and \cmd{\lttdebugOFF}.
diff --git a/macros/luatex/generic/penlightplus/penlightplus.lua b/macros/luatex/generic/penlightplus/penlightplus.lua
index 7eb80ab039..4d2f607ed7 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.lua
+++ b/macros/luatex/generic/penlightplus/penlightplus.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2025-01-05
+--% 2025-01-06
--% Copyright (C) 2021-2025 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -431,7 +431,6 @@ function str_mt.__index.gnum(s)
end
function str_mt.__index.gextract(s, pat) --extract a pattern from string, returns both
- -- todo a variant where you can specify the number would be helpful
local s_extr = ''
local s_rem = s
for e in s:gmatch(pat) do
@@ -441,6 +440,25 @@ function str_mt.__index.gextract(s, pat) --extract a pattern from string, return
return s_extr, s_rem
end
+function str_mt.__index.gxtrct(s, pat, num, join) --extract a pattern from string, returns both
+ -- todo a variant where you can specify the number of extractions, and either list of concatenate them would be helpful
+ local l_extr = penlight.List{}
+ local s_rem = s
+ local n = 1
+ num = num or 99999
+ for e in s:gmatch(pat) do
+ l_extr = l_extr:append(e)
+ s_rem = s_rem:gsub(e,'',1)
+ if n == num then break end
+ n = n +1
+ end
+ if join then
+ l_extr = l_extr:join(join)
+ end
+ return l_extr, s_rem
+end
+
+
function str_mt.__index.gfirst(s, t) -- get the first pattern found from a table of pattern
for _, pat in pairs(t) do
if string.find(s, pat) then
@@ -844,6 +862,7 @@ function penlight.tablex.train(t,seq,reind)
end
+
--todo add doc
function penlight.utils.filterfiles(...)
-- f1 is a series of filtering patterns, or condition
@@ -981,7 +1000,7 @@ end
if penlight.debug_available then
- penlight.COMP = require'penlight.comprehension'.new() -- for comprehensions
+ penlight.COMP = penlight.comprehension.new() -- for comprehensions
local _parse_range = penlight.clone_function(penlight.array2d.parse_range)
function penlight.array2d.parse_range(s) -- edit parse range to do numpy string if no letter passed
diff --git a/macros/luatex/generic/penlightplus/penlightplus.pdf b/macros/luatex/generic/penlightplus/penlightplus.pdf
index 545b9f5ec7..4b7dfa5b50 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.pdf
+++ b/macros/luatex/generic/penlightplus/penlightplus.pdf
Binary files differ
diff --git a/macros/luatex/generic/penlightplus/penlightplus.sty b/macros/luatex/generic/penlightplus/penlightplus.sty
index ea4f01f4cf..94b2307dc0 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.sty
+++ b/macros/luatex/generic/penlightplus/penlightplus.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2025-01-05
+% 2025-01-06
% Copyright (C) 2021-2025 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{penlightplus}[2025-01-05]
+\ProvidesPackage{penlightplus}[2025-01-06]
\RequirePackage{luacode}
\RequirePackage{luakeys}
diff --git a/macros/luatex/generic/penlightplus/penlightplus.tex b/macros/luatex/generic/penlightplus/penlightplus.tex
index 7e8abe4027..c7f5c31129 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.tex
+++ b/macros/luatex/generic/penlightplus/penlightplus.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2025-01-05
+% 2025-01-06
% Copyright (C) 2021-2025 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -50,7 +50,7 @@
\addtokomafont{date}{\raggedright}
\author{Kale Ewasiuk (\url{kalekje@gmail.com})}
\usepackage[yyyymmdd]{datetime}\renewcommand{\dateseparator}{--}
-\date{\today}
+\date{\ \today}
\RequirePackage[pl,globals]{penlightplus}
@@ -66,10 +66,14 @@
\section*{Package Options and Set-Up}
-This package first loads the LaTeX \cmd{penlight[import]} package
-(\url{https://ctan.org/pkg/penlight?lang=en}).
-Documentation for the Lua package can be found here: \url{https://lunarmodules.github.io/Penlight/index.html}.\\
+This package first loads the LaTeX \cmd{penlight[import]} package:\\
+\url{https://ctan.org/pkg/penlight?lang=en}.\\
+Documentation for the Lua penlight package can be found here:\\ \url{https://lunarmodules.github.io/Penlight/index.html}.\\
The \texttt{pl} option may be passed to this package to create an alias for \cmd{penlight}.\\
+A portion of this package to facilitate the creation, modification, and usage of the Lua table data structure
+through a LaTeX interface has been moved to a separate package called \cmd{luatbls}:\\
+\url{https://ctan.org/pkg/luatbls}.
+
The following global Lua variables are defined:
@@ -84,8 +88,8 @@ Since this package uses the penlight \cmd{import} option,
all \cmd{stringx} functions are injected into the \cmd{string} meta-table and you can use them like so: \cmd{'first name':upfirst()}.
But if the package option \cmd{globals} is used, many additional globals are set for easier scripting.
\cmd{pl.hasval}, \cmd{pl.COMP}, \cmd{pl.utils.kpairs}, \cmd{pl.utils.npairs} become globals.
-\cmd{pl.tablex} is aliased as \cmd{pl.tbx and tbx} (which also includes all native Lua table functions), and
-\cmd{pl.array2d} is aliased as \cmd{pl.a2d and a2d}.
+\cmd{pl.tablex} is aliased as \cmd{tbx} (which also includes all native Lua table functions), and
+\cmd{pl.array2d} is aliased as \cmd{a2d}.
%If you want global \cmd{pl.tex} functions and variables, call \cmd{pl.make_tex_global()}.\\
@@ -118,13 +122,14 @@ Some functionality is added to penlight and Lua.
\llcmd{pl.hasval(x)} Python-like boolean testing\\
\llcmd{COMP'xyz'()} Python-like comprehensions:\\\url{https://lunarmodules.github.io/Penlight/libraries/pl.comprehension.html}\\
-\llcmd{_Gdot(s)} Return a global (may contain dots) from string
+\llcmd{_Gdot(s)} return a global (may contain dots) from string
\cmd{clone_function(f)} returns a cloned function\\
\cmd{operator.strgt(a,b)} compares strings a greater than b (useful for sorting)\\
\cmd{operator.strlt(a,b)} compares strings a less than b (useful for sorting)\\
-\llcmd{math.mod(n,d)}, \cmd{math.mod2(n)} math modulous\\
+\llcmd{math.mod(n,d)} math modulus\\
+\cmd{math.mod2(n)} mod with base 2\\
\llcmd{pl.utils.}\cmd{filterfiles}\cmd{(dir,filt,rec)} Get files from dir and apply glob-like filters. Set rec to \cmd{true} to include sub directories\\
@@ -148,7 +153,9 @@ Some functionality is added to penlight and Lua.
\llcmd{string.}\cmd{appif(s, append, bool, alternate)}\\
\llcmd{string.}\cmd{gfirst(s, t)}return first matched patter from an array of patterns t\\
%\llcmd{string.}\cmd{gnum(s)} extract a number from a string\\
-\llcmd{string.}\cmd{gextract(s)} extract a pattern from a string (returns capture and new string with capture removed)\\
+\llcmd{string.}\cmd{gextract(s,pat)} extract a pattern from a string (returns capture and new string with capture removed)\\
+\llcmd{string.}\cmd{gextrct(s,pat,num,join)} extract a pattern from a string (returns capture and new string with capture removed),
+can specify a number of extractions. if join is specified, captures will be joined, otherwise a list is returned\\
\llcmd{string.}\cmd{totable(s)} string a table of characters\\
\llcmd{string.}\cmd{tolist(s)} string a table of characters\\
\llcmd{string.}\cmd{containsany(s,t)} checks if any of the array of strings \cmd{t} are in \cmd{s} using \cmd{string.find}\\
@@ -165,10 +172,12 @@ is processed by luakeys.\\
\llcmd{string.}\cmd{hasnonum(s)} string has no numbers\\
\llcmd{string.}\cmd{isvarlike(s)} string is 'variable-like', starts with a letter or underscore and then is alphanumeric or has underscores after \\
%\begin{luacode*}
-% pl.wrth(('_'):isvarlike(), 'llll')
-% pl.wrth(('1_1k'):isvarlike(), ',,')
-% pl.wrth(('kale_1'):isvarlike(), '')
-% pl.wrth(('kale_1'):isvarlike(), '')
+% local s1, s2 = ('12,13'):gxtrct('%d',nil)
+% pl.wrth({s1,s2}, 'err rat')
+%--% pl.wrth(('_'):isvarlike(), 'llll')
+%--% pl.wrth(('1_1k'):isvarlike(), ',,')
+%--% pl.wrth(('kale_1'):isvarlike(), '')
+%--% pl.wrth(('kale_1'):isvarlike(), '')
%\end{luacode*}
\subsection*{tablex additions}
@@ -342,9 +351,6 @@ Use \_\_ as a placeholder for a case that isn't matched. The case is fully expan
%\caseswitch*{\mycase}{dog=DOG, cat=CAT, __=INVALID}
-\subsection*{Create, modify, and use Lua tables from within LaTeX}
-This portion of the package has been moved to a another package called
-\cmd{luatbls} \\(\url{https://ctan.org/pkg/luatbls})