summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-08-29 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2023-08-29 03:00:56 +0000
commit64e26532c685fd24d6983508c6239e3c268b810b (patch)
treea947b8d31ea56b72c4c21ac202aead0d4544412d /macros
parent7ea6dacf544f9f0ec4f9566681de2434ca5e0e38 (diff)
CTAN sync 202308290300
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/lwarp/README.txt2
-rw-r--r--macros/latex/contrib/lwarp/lwarp.dtx304
-rw-r--r--macros/latex/contrib/lwarp/lwarp.pdfbin3399651 -> 3405893 bytes
-rwxr-xr-xmacros/latex/contrib/lwarp/lwarpmk.lua4
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.lua57
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.pdfbin55459 -> 62224 bytes
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.sty117
-rw-r--r--macros/luatex/generic/penlightplus/penlightplus.tex91
8 files changed, 398 insertions, 177 deletions
diff --git a/macros/latex/contrib/lwarp/README.txt b/macros/latex/contrib/lwarp/README.txt
index 92fff483cc..3918deb3e5 100644
--- a/macros/latex/contrib/lwarp/README.txt
+++ b/macros/latex/contrib/lwarp/README.txt
@@ -1,5 +1,5 @@
-LaTeX lwarp package v0.911 README.txt
+LaTeX lwarp package v0.912 README.txt
Files included are:
diff --git a/macros/latex/contrib/lwarp/lwarp.dtx b/macros/latex/contrib/lwarp/lwarp.dtx
index 4865f5567e..d7f79fc3cf 100644
--- a/macros/latex/contrib/lwarp/lwarp.dtx
+++ b/macros/latex/contrib/lwarp/lwarp.dtx
@@ -16,7 +16,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{lwarp}
-%<package> [2023/02/28 v0.911 Allows LaTeX to directly produce HTML5 output.]
+%<package> [2023/08/28 v0.912 Allows LaTeX to directly produce HTML5 output.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -3423,6 +3423,7 @@ This boolean may be tested by the user for later use.
% \changes{v0.909}{2022/11/22}{\ 2022/11/22}
% \changes{v0.910}{2023/01/03}{\ 2023/01/03}
% \changes{v0.911}{2023/02/28}{\ 2023/02/28}
+% \changes{v0.912}{2023/08/28}{\ 2023/08/28}
@@ -3656,6 +3657,13 @@ This boolean may be tested by the user for later use.
% see the end of the Change History on page \pageref{sec:changesend}.
%
% \begin{description}
+% \item[v0.912:] Updated for new \LaTeX\ label system.
+% \begin{itemize}
+% \item Fixed for updated kernel label system, name and back references.
+% \item Updated \pkg{memoir}, \pkg{tcolorbox}.
+% \item \pkg{nameref}: Now allowed to load before \pkg{lwarp}, such as by \pkg{memoir}.
+% \end{itemize}
+% \needspace{2\baselineskip}
% \item[v0.911:] Updated \pkg{mismath}, \pkg{tcolorbox}.
% \needspace{2\baselineskip}
% \item[v0.910:] Updated \pkg{fvextra}, \pkg{minted}.
@@ -13906,7 +13914,6 @@ This boolean may be tested by the user for later use.
\LWR@loadafter{musicography}
\LWR@loadafter{mwe}
\LWR@loadafter{nameauth}
-\LWR@loadafter{nameref}
\LWR@loadafter{natbib}
\LWR@notmemoirloadafter{nccfancyhdr}
\LWR@loadafter{nccfoots}
@@ -14569,6 +14576,18 @@ This boolean may be tested by the user for later use.
% \end{macro}
%
%
+% \begin{macro}{\LWR@edeffirstoffive} \marg{first} \marg{second} \marg{third} \marg{fourth} \marg{fifth}
+% \cs{edef}s to the first of five arguments.
+% Used for back referencing.
+% \changes{v0.912}{2023/08/24}{Added.}
+% \begin{macrocode}
+\long\def\LWR@edeffirstoffive#1#2#3#4#5{%
+ \edef\@tempa{#1}%
+}%
+% \end{macrocode}
+% \end{macro}
+
+
% \subsection{Inside boxes}
%
% Greater than zero if currently inside a \TeX\ box,
@@ -21118,10 +21137,10 @@ MathJax = {
\begin{filecontents*}[overwrite]{lwarpmk.lua}
#!/usr/bin/env texlua
--- Copyright 2016-2022 Brian Dunn
+-- Copyright 2016-2023 Brian Dunn
-printversion = "v0.911"
+printversion = "v0.912"
requiredconfversion = "2" -- also at *lwarpmk.conf
function printhelp ()
@@ -23687,9 +23706,10 @@ end -- not --version
%
% \changes{v0.34}{2017/08/02}{Moved optional argument in front of mandatory.}
% \changes{v0.896}{2021/03/05}{Added \ARIA\ role.}
+% \changes{v0.912}{2023/08/27}{Fixed with tracing on.}
% \begin{macrocode}
\NewDocumentCommand{\LWR@htmlspanclass}{o D(){} m +m}{%
- \LWR@traceinfo{LWR@htmlspanclass |#1|#2|#3|}%
+ \LWR@traceinfo{LWR@htmlspanclass #3}%
\LWR@ensuredoingapar%
\ifblank{#2}%
{\LWR@subhtmlelementclass{span}[#1]{#3}}%
@@ -23697,8 +23717,8 @@ end -- not --version
\begin{LWR@nestspan}%
#4%
\LWR@htmltagc{/span}%
- \LWR@traceinfo{LWR@htmlspanclass done}%
\end{LWR@nestspan}%
+ \LWR@traceinfo{LWR@htmlspanclass done}%
}
% \end{macrocode}
% \end{macro}
@@ -23805,10 +23825,11 @@ end -- not --version
% \changes{v0.66}{2019/02/02}{Improved \HTML\ formatting.}
% \changes{v0.892}{2020/10/03}{Ignore empty class.}
% \changes{v0.896}{2021/03/05}{Added \ARIA\ role.}
+% \changes{v0.912}{2023/08/27}{Fixed with tracing on.}
%
% \begin{macrocode}
\NewDocumentCommand{\LWR@subhtmlelementclass}{m O{} D(){} m}{%
- \LWR@traceinfo{LWR@subhtmlelementclass !#1!#2!#3!#4!}%
+ \LWR@traceinfo{LWR@subhtmlelementclass !#1!#4!}%
\ifblank{#2}%
{% empty style
\LWR@htmltag{%
@@ -24314,7 +24335,8 @@ end -- not --version
% \end{macrocode}
%
% The opening paragraph tag.
-% Do not create tag if doing \pkg{algorithm2e} handling instead:
+% Do not create tag if doing \pkg{algorithm2e} handling
+% or inside a \cs{multirow}.
% \changes{v0.66}{2019/02/02}{Improved \HTML\ formatting.}
% \changes{v0.903}{2021/12/17}{Par handling.}
% \begin{macrocode}
@@ -27831,19 +27853,7 @@ end -- not --version
}\LWR@orignewline
% \end{macrocode}
%
-% IE patch:
-% \changes{v0.63}{2018/11/30}{Fix: Break ligature for \pkg{luatexko}.}
-% \begin{macrocode}
-\LWR@htmltag{!-\/-[if lt IE 9]}\LWR@orignewline
-\LWR@htmltag{%
- script % space
- src=\LWR@orig@textquotedbl{}%
- http://html5shiv.googlecode.com/svn/trunk/html5.js%
- \LWR@orig@textquotedbl%
-}%
-\LWR@htmltag{/script}\LWR@orignewline
-\LWR@htmltag{![endif]-\/-}\LWR@orignewline
-% \end{macrocode}
+% \changes{v0.912}{2023/08/28}{Removed IE 9 shim patch.}
%
% The page's title, if there is one.
% A section name is also added if given.
@@ -30099,6 +30109,7 @@ end -- not --version
% \section{Tabular}
+% ^^A *tabular
%
% This is arguably the most complicated part of the entire package.
% Numerous tricks are employed to handle the syntax of the \LaTeX\ core
@@ -32085,16 +32096,17 @@ end -- not --version
\LWR@maybenewtablerow%
% \end{macrocode}
%
-% Don't start a new paragraph tag if have already started one:
+% Don't start a new paragraph tag if have already started one,
+% or have found the end of the tabular,
+% or if are inside a \cs{multirow}:
+% \changes{v0.912}{2023/08/28}{Fixed \cs{multirow} par handling.}
% \begin{macrocode}
- \ifbool{LWR@intabularmetadata}%
- {%
-% \end{macrocode}
-%
-% If have found the end of tabular command, do not create the next data cell:
-% \begin{macrocode}
- \ifbool{LWR@exitingtabular}{}%
- {% not exiting tabular
+ \ifboolexpr{
+ bool{LWR@intabularmetadata}
+ and not bool{LWR@exitingtabular}
+ and not bool {LWR@in@multirow@par}
+ }%
+ {% making a tabular data cell
% \end{macrocode}
%
% Print the |@| and |!| contents before first column:
@@ -32197,8 +32209,8 @@ end -- not --version
\LWR@getexparray{LWR@colbeforespec}{\arabic{LWR@tableLaTeXcolindex}}%
}%
\boolfalse{LWR@intabularmetadata}%
- }% not exiting tabular
- }{}% in tabular metadata
+ }% making a tabular data cell
+ {}% not making a tabular data cell
\LWR@traceinfo{LWR@tabledatasinglecolumntag: done}%
}%
% \end{macrocode}
@@ -34525,19 +34537,19 @@ end -- not --version
% \item [\cs{refstepcounter}:] Steps the couunter and sets \cs{@currentlabel}.
% \item [\cs{@currentlabel}:] \cs{p@<ctr>}\cs{the<ctr>} Updated by \cs{refstepcounter}.
% \item [\cs{label}:] Writes to the |.aux| file:
-% \qquad |\newlabel{<label>}{{\@currentlabel}{\thepage}}|
+% \qquad |\newlabel{<label>}{{\@currentlabel}{\thepage}{name}{Href}{()}}|
% \item [\cs{newlabel}:] When the |.aux| file is read, sets \cs{r@<label>}.
-% \item [\cs{r@<label>}:] Set to: |{{\@currentlabel}{\thepage}}|
+% \item [\cs{r@<label>}:] Set to: |{\@currentlabel}{\thepage}{name}{Href}{}|
% \item [\cs{ref}:] Returns the first part of \cs{r@<label>}.
% \item [\cs{pageref}:] Returns the second part of \cs{r@<label>}.
% \end{description}
% \item [Added by \pkg{lwarp}:] \hfill (\HTML\ only)
% \begin{description}
% \item [\cs{label}:] Adds \HTML\ tags (\cref{sec:labels}),
-% and another \filenm{.aux} entry (\cref{sec:lwarplabelsetup}).
-% If \pkg{memoir} is used, its \cs{@mem@old@label} points to \pkg{lwarp}'s version,
-% and \pkg{cleveref} patches.
-% \item [\cs{newlabel}:] Unchanged. When the |.aux| file is read, sets \cs{r@<label>@lwarp}.
+% and another \filenm{.aux} entry (\cref{sec:lwarplabelsetup}) for \cs{r@<label>@lwarp}.
+% (\pkg{nameref} changes to \cs{ref}, etc. are undone \cs{AtBeginDocument}.)
+% \item [\cs{newlabel}:] Unchanged. When the |.aux| file is read,
+% used to set \cs{r@<label>}, and then \cs{r@<label>@lwarp}.
% \item [\cs{r@<label>@lwarp}:] Set to |{{section_name}{file_name}{depth}{number}}|:
% \begin{description}
% \item [\cs{LWR@nameref}:] The section or object name for this label.
@@ -34561,9 +34573,9 @@ end -- not --version
% \begin{description}
% \item [\cs{refstepcounter:}] Added: sets \cs{cref@currentlabel}.
% \item [\cs{cref@currentlabel}:] (|<type>|=|<ctr>| unless an alias is used):
-% \qquad |[<type>][\arabic{<ctr>}][<parent ctrs>]{\p@<ctr>\the<ctr>}|
+% \qquad |[<type>][\arabic{<ctr>}][<parent ctrs>]{\p@<ctr>\the<ctr>}| \\
% Also see \cref{sec:footnotesregular} for use with footnotes.
-% \item [\cs{label}:] Writes to the |.aux| file:
+% \item [\cs{label}:] Also writes to the |.aux| file:
% \qquad |\newlabel{<label>@cref}{{\cref@currentlabel}{\thepage}}|
% \item [\cs{newlabel}:] Unchanged. When the |.aux| file is read, sets \cs{r@<label>@cref}.
% \item [\cs{r@<label>@cref}:] Set to: |{{\cref@currentlabel}{\thepage}}|
@@ -34879,10 +34891,9 @@ end -- not --version
% the special label handling is required, but \cs{LWR@label@createtag} does not
% generate \HTML\ tags inside a \env{lateximage}.
%
-% If \pkg{memoir} is used, it's \cs{@mem@old@label} is pointed here.
+% \pkg{clevereref} later encases this to add its own cross-referencing.
%
-% \pkg{clevereref} later encases this to add its own cross-referencing,
-% and also patches \pkg{memoir}.
+% \pkg{nameref} patches are undone \cs{AtBeginDocument}.
%
% \changes{v0.84}{2020/04/05}{Removed optional args.}
% \changes{v0.896}{2021/04/08}{Revert to a simple \cs{newcommand*}.}
@@ -35056,8 +35067,9 @@ end -- not --version
{\LWR@subnewref{#2}{#2}}%
}
+\AtBeginDocument{% **8*
\LWR@formatted{ref}
-
+}
\NewDocumentCommand{\LWR@HTML@Ref}{s m}{%
\LWR@traceinfo{LWR@HTML@Ref !#2!}%
@@ -35066,17 +35078,20 @@ end -- not --version
{\LWR@subnewref{#2}{#2}}%
}
+\AtBeginDocument{% **8*
\LWR@formatted{Ref}
+}
% \end{macrocode}
%
%
% \begin{macro}{\LWR@refwithsection} * \marg{label}
%
-% Creates a reference, using the section number as the text.
+% Creates a reference, printing the section number as the text.
% Used for back references.
%
% \changes{v0.896}{2021/04/21}{Added.}
% \changes{v0.903}{2021/12/13}{Fixed: Ref undefined or w/o label.}
+% \changes{v0.912}{2023/08/26}{Fixed back references.}
% \begin{macrocode}
\NewDocumentCommand{\LWR@refwithsection}{s m}{%
\LWR@traceinfo{LWR@refwithsection !#2!}%
@@ -35086,62 +35101,71 @@ end -- not --version
% \begin{macrocode}
\IfBooleanTF{#1}%
{\LWR@print@ref{\BaseJobname-autopage-\LWR@currentautosecpageref{#2}}}%
- {%
+% \end{macrocode}
+%
+% If not starred:
+% Check for a reference to the start of the document.
+% (Generated by \pkg{backref}.
+%
+% \begin{macrocode}
+ {% not starred
+ \ifstrequal{#2}{Doc-Start}%
+ {%
+ \LWR@startref{\BaseJobname-autopage-1}%
+ *%
+ \LWR@htmltag{/a}%
+ }%
+ {% not Doc-Start
% \end{macrocode}
%
% Open the reference:
% \begin{macrocode}
- \LWR@startref{#2}%
+ \LWR@startref{#2}%
% \end{macrocode}
%
% Add the text of the link.
%
% Check for and handle an undefined reference:
% \begin{macrocode}
- \edef\@tempa{\LWR@currentautosecpageref{#2}}%
- \ifdefstring{\@tempa}{??}%
- {??}%
+ \edef\@tempa{\LWR@currentautosecpageref{#2}}%
+ \ifdefstring{\@tempa}{??}%
+ {??}%
% \end{macrocode}
%
% For a defined reference:
% \begin{macrocode}
- {%
+ {% not ??
% \end{macrocode}
%
-% Set \cs{@tempa} to \cs{r@<label>}, which is |{section number}{page number}|.
+% Set \cs{@tempa} to \cs{r@<label>}, which is |{section number}{page number}{name}{Href}{}|.
% \begin{macrocode}
- \edef\@tempa{%
- \csname
- r@\BaseJobname-autopage-\LWR@currentautosecpageref{#2}%
- \endcsname%
- }%
+ \edef\@tempa{\csexpandonce{r@\BaseJobname-autopage-\@tempa}}%
+ \expandafter\LWR@edeffirstoffive\@tempa%
% \end{macrocode}
%
% Check the section number alone:
-% \begin{macrocode}
- \edef\@tempa{\expandafter\@firstoftwo\@tempa}%
-% \end{macrocode}
%
% If the reference has no section number print an asterisk:
% \begin{macrocode}
- \expandafter\ifblank\expandafter{\@tempa}%
- {*}
+ \expandafter\ifblank\expandafter{\@tempa}%
+ {*}
% \end{macrocode}
%
% If there is a section number, print it:
% \begin{macrocode}
- {%
- \LWR@print@ref{%
- \BaseJobname-autopage-\LWR@currentautosecpageref{#2}%
- }%
- }%
- }%
+ {%
+ \LWR@print@ref{%
+ \BaseJobname-autopage-\LWR@currentautosecpageref{#2}%
+ }%
+ }%
+ }% not ??
% \end{macrocode}
%
% Close the reference:
% \begin{macrocode}
- \LWR@htmltag{/a}%
- }%
+ \LWR@htmltag{/a}%
+ }% not Doc-Start
+ }% not starred
}
% \end{macrocode}
% \end{macro}
@@ -35186,8 +35210,14 @@ end -- not --version
% \begin{macro}{\nameref} \marg{label}
%
% \changes{v0.43}{2017/10/31}{Made robust.}
+% \changes{v0.912}{2023/08/24}{\pkg{nameref}: Allow load before \pkg{lwarp}.}
+%
+% \pkg{nameref} may have already defined \cs{nameref}.
+% Redefine it here.
% \begin{macrocode}
-\newrobustcmd*{\nameref}[1]{%
+\providecommand{\nameref}[1]{}%
+
+\renewrobustcmd*{\nameref}[1]{%
\LWR@traceinfo{nameref}%
\LWR@startref{#1}%
\LWR@traceinfo{nameref B}%
@@ -35203,6 +35233,8 @@ end -- not --version
% \begin{macro}{\Nameref} \marg{label}
% In print, adds the page number. In \HTML, does not.
+%
+% Overwrites \pkg{nameref} definition if already defined.
% \begin{macrocode}
\LetLtxMacro\Nameref\nameref
% \end{macrocode}
@@ -36942,7 +36974,7 @@ end -- not --version
\newcommand*{\LWR@indexnameref@ref}[1]{%
\edef\LWR@thisref{\csuse{r@LWRindex-#1}}%
\ifdefvoid{\LWR@thisref}{}{%
- \edef\LWR@thisref{\expandafter\@firstoftwo\LWR@thisref}%
+ \edef\LWR@thisref{\expandafter\@firstoffive\LWR@thisref}%
\ifdefvoid{\LWR@thisref}%
{\LWR@indexnameref@anonref{#1}}%
{\ref{LWRindex-#1}}%
@@ -36958,11 +36990,12 @@ end -- not --version
% To avoid an unwanted space if there is nothing to reference,
% the reference is checked first.
% For links to starred or |??| objects, only the name is used.
+% \changes{v0.912}{2023/08/27}{Fixed for new LaTeX labels.}
% \begin{macrocode}
\newcommand*{\LWR@indexnameref@refnameref}[1]{%
\edef\LWR@thisref{\csuse{r@LWRindex-#1}}%
\ifdefvoid{\LWR@thisref}{}{%
- \edef\LWR@thisref{\expandafter\@firstoftwo\LWR@thisref}%
+ \edef\LWR@thisref{\expandafter\@firstoffive\LWR@thisref}%
\ifdefvoid{\LWR@thisref}{}{%
\ifdefstring{\LWR@thisref}{(*)}%
{}%
@@ -36981,13 +37014,14 @@ end -- not --version
% If no numbered reference is available, a \cs{nameref} is used instead.
% If the reference is |??|, which will be changed by \cs{LWR@indexnameref}
% to become |(*)|, then the link is changed to show |(*)|.
+% \changes{v0.912}{2023/08/27}{Fixed for new LaTeX labels.}
% \begin{macrocode}
\newcommand*{\LWR@indexnameref@cref}[1]{%
\edef\LWR@thisref{\csuse{r@LWRindex-#1}}%
\ifdefvoid{\LWR@thisref}{%
\nameref{LWRindex-#1}%
}{%
- \edef\LWR@thisref{\expandafter\@firstoftwo\LWR@thisref}%
+ \edef\LWR@thisref{\expandafter\@firstoffive\LWR@thisref}%
\ifdefvoid{\LWR@thisref}{%
\nameref{LWRindex-#1}%
}{%
@@ -37009,13 +37043,14 @@ end -- not --version
% If no numbered reference is available, a \cs{nameref} is used instead.
% If the reference is |??|, which will be changed by \cs{LWR@indexnameref}
% to become |(*)|, then the link is changed to show only the name.
+% \changes{v0.912}{2023/08/27}{Fixed for new LaTeX labels.}
% \begin{macrocode}
\newcommand*{\LWR@indexnameref@crefnameref}[1]{%
\edef\LWR@thisref{\csuse{r@LWRindex-#1}}%
\ifdefvoid{\LWR@thisref}%
{}%
{%
- \edef\LWR@thisref{\expandafter\@firstoftwo\LWR@thisref}%
+ \edef\LWR@thisref{\expandafter\@firstoffive\LWR@thisref}%
\ifdefvoid{\LWR@thisref}%
{}%
{%
@@ -37336,7 +37371,7 @@ end -- not --version
% which meant the \HTML\ version could not resolve until the print version was
% also present. This also confused \pkg{multibib}.
% It has been reverted to the original to use \cs{jobname}\filenm{.bbl}.
-% \changes{v0.87}{2020/05/17}{Reverted to original.}
+% \changes{v0.87}{2020/05/17}{Reverted \cs{bibliography} to original.}
% \end{macro}
%
%
@@ -40130,9 +40165,10 @@ end -- not --version
\LetLtxMacro\@footnotetext\LWR@footnotetext%
}%
% \end{macrocode}
-% Create the |LWRlateximage<number>| label:
+% Create the |LWRlateximage-jobname-<number>| label:
% \begin{macrocode}
- \LWR@traceinfo{lateximage: about to create label}%
+ \LWR@traceinfo{lateximage: about to create label
+ LWRlateximage-\BaseJobname-\arabic{LWR@lateximagenumber}}%
\LWR@orig@label{LWRlateximage-\BaseJobname-\arabic{LWR@lateximagenumber}}%
\LWR@traceinfo{lateximage: finished creating the label}%
% \end{macrocode}
@@ -40460,6 +40496,15 @@ end -- not --version
% \end{macrocode}
% \end{macro}
+
+% Undo \pkg{nameref} if already loaded, such as by \pkg{memoir}:
+% \changes{v0.912}{2023/08/24}{\pkg{nameref}: Allow load before \pkg{lwarp}.}
+% \begin{macrocode}
+\LWR@PreloadedPackage{nameref}
+% \end{macrocode}
+
+
+
% If \pkg{inputtrc} was loaded before \pkg{lwarp},
% as is usually done,
% explicitly load the lwarp patches now:
@@ -40965,17 +41010,43 @@ end -- not --version
% print or \HTML\ output, and thus do not use the \cs{LWR@formatted} system.
%
% \codehtml
+%
+% \changes{v0.912}{2023/08/24}{\pkg{nameref}: Allow load before \pkg{lwarp}.}
% \begin{macrocode}
\begin{warpHTML}
-\LetLtxMacro\LWR@orig@label\label% includes memoir, before cleveref
+\LetLtxMacro\LWR@orig@label\label
\LetLtxMacro\label\LWR@new@label
-\LetLtxMacro\LWR@orig@pageref\pageref
-\LetLtxMacro\pageref\LWR@new@pageref
+\AtBeginDocument{%
+\LetLtxMacro\LWR@orig@pageref\pageref%
+\LetLtxMacro\pageref\LWR@new@pageref%
+}
+% \end{macrocode}
+
+% \begin{macro}{\label}
+% Detokenize \cs{@currentnamelabel} to avoid bug if math is in the name.
+% \changes{v0.912}{2023/08/24}{Detokenize \cs{@currentnamelabel} while writing.}
+% \begin{macrocode}
+\xpatchcmd{\LWR@orig@label}
+ {{\@currentlabelname}}
+ {{\detokenize\expandafter{\@currentlabelname}}}
+ {}
+ {
+ \typeout{***}
+ \typeout{***}
+ \typeout{*** Package lwarp warning:}
+ \typeout{*** Could not patch \string\label.}
+ \typeout{*** This may cause an error with section names or float captions}
+ \typeout{*** containing math, for example.}
+ \typeout{*** (Recent updates in the LaTeX kernel may make things work again.)}
+ \typeout{***}
+ \typeout{***}
+ }
\end{warpHTML}
% \end{macrocode}
+% \end{macro}
@@ -41576,11 +41647,11 @@ end -- not --version
% \cs{LWR@forceminwidth} must be used first in order to set the border width.
%
% \changes{v0.66}{2019/02/04}{Use current text color.}
+% \changes{v0.912}{2023/08/27}{Fixed with tracing on.}
%
% \begin{macrocode}
\newcommand*{\LWR@fboxstyle}{%
\LWR@findcurrenttextcolor%
-\LWR@traceinfo{LWR@fboxstyle B}%
border:\LWR@printlength{\LWR@atleastonept} solid \LWR@origpound\LWR@tempcolor ; %
padding:\LWR@printlength{\fboxsep} ; %
color:\LWR@origpound\LWR@tempcolor%
@@ -41610,6 +41681,7 @@ color:\LWR@origpound\LWR@tempcolor%
\LWR@traceinfo{HTML fbox: done}%
}
% \end{macrocode}
+%
% \pkg{xcolor} \cs{let}s things to \cs{fbox} when it is loaded,
% and this must remain even for \HTML\ output while in a \env{lateximage},
% so \cs{fbox} is not modified until \cs{AtBeginDocument}:
@@ -71902,22 +71974,16 @@ background:
% \section{nameref}
%
% \DescribePackage{nameref}
-% \pkg{nameref} is emulated by \pkg{lwarp}.
+% \pkg{nameref} is nullified here, then emulated by \pkg{lwarp}.
%
% \changes{v0.22}{2017/03/01}{\pkg{nameref}: Added.}
+% \changes{v0.912}{2023/08/24}{\pkg{nameref}: Allow load before \pkg{lwarp}.}
%
% \codehtml
%
% Discard all options for \pkg{lwarp-nameref}:
% \begin{macrocode}
-\PackageInfo{lwarp}{%
-Using the lwarp HTML version of package `nameref',\MessageBreak
-and discarding options.\MessageBreak
-(Not using \protect\ProvidesPackage, so that other packages\MessageBreak
-do not attempt to patch lwarp's version of `nameref'.)\MessageBreak
-}
-\DeclareOption*{}
-\ProcessOptions\relax
+\LWR@ProvidesPackageDrop{nameref}[2023-08-07]
% \end{macrocode}
% \iffalse
@@ -85626,11 +85692,13 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf',
% \end{macrocode}
%
% For the lower part, the upper part is finished then the lower is started.
-% \cs{tcblower} is only temporarily defined where appropriate, so the \HTML\ version is
-% defined globally via \cs{newcommand} instead of \cs{renewcommand}.
+%
+% \cs{tcblower} is \cs{let} to \cs{tcb@error@nolower} globally,
+% which gives an error in print mode, but is redefined here for \HTML.
+% \changes{v0.912}{2023/08/27}{\pkg{tcolorbox}: Updated to v6.0.4}
% \begin{macrocode}
-\newcommand{\tcblower}{
- \tcb@insert@after@upper%
+\newcommand{\LWR@HTML@tcb@error@nolower}{%
+ \tcb@insert@after@upper%
\end{BlockClass}
\begin{BlockClass}[%
border-top: 1px dashed \LWR@origpound\LWR@tcbcolframe ;
@@ -85638,6 +85706,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf',
]{tcolorboxlower}
\tcb@insert@before@lower%
}
+\LWR@formatted{tcb@error@nolower}
% \end{macrocode}
%
% Starred and unstarred \cs{tcbline} are simple \cs{hrule}s.
@@ -93594,40 +93663,35 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf',
% Insert the \pkg{lwarp} label mechanism into the \pkg{memoir} package mechanism:
%
% \begin{itemize}
-% \item \cs{@mem@old@label} is the \LaTeX\ definition of \cs{label}.
-% \item \cs{LWR@orig@label} becomes the \pkg{memoir} definition.
+% \item \cs{LWR@orig@label} is the kernel version,
+% or \pkg{nameref} version if loaded before \pkg{lwarp}.
% \item \pkg{lwarp}'s \cs{LWR@new@label} uses \cs{LWR@orig@label}.
-% \item Want \pkg{memoir}'s \cs{label} to use \pkg{lwarp}'s \cs{label},
-% which then would use \LaTeX's \cs{label}.
-% \item So:
-% \begin{itemize}
-% \item \cs{@mem@old@label} is set to \cs{LWR@new@label}.
-% \item \cs{LWR@orig@label} is set to \cs{@mem@old@label}.
-% \end{itemize}
% \item \pkg{cleveref} then encapsulates all the above with \cs{cref@old@label}.
% \item For a subcaption, \pkg{cleveref} modifies \pkg{memoir}'s \cs{sf@memsub@label},
% but that change is undone by \pkg{lwarp}.
+% \item \pkg{memoir} uses the final \cs{label} for subcaptions.
% \end{itemize}
-% \changes{v0.84}{2020/04/05}{\pkg{lwarp-patch-memoir}: Fix: \cs{label}.}
-% \begin{macrocode}
-\LetLtxMacro\LWR@orig@label\@mem@old@label
-\LetLtxMacro\@mem@old@label\LWR@new@label
-% \end{macrocode}
%
% Patches for subfloats to support additional \pkg{lwarp} labels.
% This is the non-\pkg{hyperref} version from \pkg{memoir}.
+% \changes{v0.912}{2023/08/27}{\pkg{memoir}: Fixed for new \LaTeX\ labels.}
% \begin{macrocode}
\AtBeginDocument{
\renewcommand*{\sf@@memsub@label}[1]{%
\@bsphack
- \sf@@memsub@label@hook{#1}%
-% \@memoldlabel{#1}%
- \cref@label{#1}% lwarp
+% \@mem@kernel@label{#1}%
+ \cref@label{#1}% lwarp
\LWR@label@createtag{sub@#1}% lwarp
\protected@write\@auxout{}{%
\string\newlabel{sub@#1}%
- {{\@nameuse{@@thesub\@captype}}%
- {\thepage}}}%
+ {%
+ {\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\detokenize\expandafter{\@currentlabelname}}% name
+ {#1}% Href
+ {}% reserved
+ }%
+ }%
\LWR@write@lwarplabel{sub@#1}% lwarp
\@esphack
}
@@ -94884,15 +94948,11 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf',
\LetLtxMacro\titleref\nameref
\renewcommand*{\headnameref}{}
\renewcommand*{\tocnameref}{}
+% \end{macrocode}
-\providecounter{LWR@currenttitle}
-
-\renewcommand*{\currenttitle}{%
- \addtocounter{LWR@currenttitle}{1}%
- \label{currenttitle\arabic{LWR@currenttitle}}%
- \nameref{currenttitle\arabic{LWR@currenttitle}}%
-}
-
+% \changes{v0.912}{2023/08/24}{\pkg{memoir}: Updated to v3.8.1}
+% \cs{currenttitle} has been removed from \pkg{memoir}.
+% \begin{macrocode}
\renewcommand*{\theTitleReference}[2]{}
\renewcommand*{\namerefon}{}
\renewcommand*{\namerefoff}{}
diff --git a/macros/latex/contrib/lwarp/lwarp.pdf b/macros/latex/contrib/lwarp/lwarp.pdf
index be875b28e7..550c9096d7 100644
--- a/macros/latex/contrib/lwarp/lwarp.pdf
+++ b/macros/latex/contrib/lwarp/lwarp.pdf
Binary files differ
diff --git a/macros/latex/contrib/lwarp/lwarpmk.lua b/macros/latex/contrib/lwarp/lwarpmk.lua
index 7275b345e7..1d47893217 100755
--- a/macros/latex/contrib/lwarp/lwarpmk.lua
+++ b/macros/latex/contrib/lwarp/lwarpmk.lua
@@ -1,8 +1,8 @@
#!/usr/bin/env texlua
--- Copyright 2016-2022 Brian Dunn
+-- Copyright 2016-2023 Brian Dunn
-printversion = "v0.911"
+printversion = "v0.912"
requiredconfversion = "2" -- also at *lwarpmk.conf
function printhelp ()
diff --git a/macros/luatex/generic/penlightplus/penlightplus.lua b/macros/luatex/generic/penlightplus/penlightplus.lua
index ffdbe89bc5..96eb565fb6 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.lua
+++ b/macros/luatex/generic/penlightplus/penlightplus.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2023-07-22
+--% 2023-08-27
--% Copyright (C) 2021-2023 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -67,6 +67,10 @@ penlight.tex._xTrue = '\\BooleanTrue '
penlight.tex._xFalse = '\\BooleanFalse '
penlight.tex._xNoValue = '-NoValue-'
+penlight.tex.xTrue = '\\BooleanTrue '
+penlight.tex.xFalse = '\\BooleanFalse '
+penlight.tex.xNoValue = '-NoValue-'
+
--Generic LuaLaTeX utilities for print commands or environments
if not __PL_SKIP_TEX__ then
@@ -138,6 +142,8 @@ function penlight.tex.help_wrt(s1, s2) -- helpful printing, makes it easy to deb
wrt2('\n^^^^^\n')
end
penlight.help_wrt = penlight.tex.help_wrt
+penlight.wrth = penlight.help_wrt
+penlight.tex.wrth = penlight.help_wrt
function penlight.tex.prt_array2d(t)
for _, r in ipairs(t) do
@@ -171,9 +177,10 @@ end
--definition helpers -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-function penlight.tex.defmacro(cs, val) -- , will not work if val contains undefined tokens (so pre-define them if using..)
+function penlight.tex.defmacro(cs, val, g) -- , will not work if val contains undefined tokens (so pre-define them if using..)
val = val or '' -- however this works for arbitrary command names (\@hello-123 etc allowed)
- token.set_macro(cs, val, 'global')
+ g = g or 'global'
+ token.set_macro(cs, val, g)
end
@@ -767,6 +774,47 @@ function penlight.tex.split2items(s, d)
end
+penlight.tbls = {}
+
+function penlight.get_tbl_item(s, p) -- get item with string, p means print value
+ p = p or false
+ local itm = 'tbl: INVALID INDEX WITH: "'..s..'"'
+ if s:find('%.') then
+ local tt = s:split('.')
+ itm = penlight.tbls[tt[1]][tt[2]]
+ elseif s:find('/') then
+ local tt = s:split('/')
+ itm = penlight.tbls[tt[1]][tonumber(tonumber(tt[2]))]
+ else
+ if s:isdigit() then
+ itm = penlight.tbls._recent[tonumber(s)]
+ else
+ itm = penlight.tbls._recent[s]
+ end
+ end
+ if p then
+ tex.sprint(tostring(itm))
+ end
+ return itm
+end
+
+
+function penlight.set_tbl_item(s, v)
+ if s:find('%.') then
+ local tt = s:split('.')
+ penlight.tbls[tt[1]][tt[2]] = v
+ elseif s:find('/') then
+ local tt = s:split('/')
+ penlight.tbls[tt[1]][tonumber(tonumber(tt[2]))] = v
+ else
+ if s:isdigit() then
+ penlight.tbls._recent[tonumber(s)] = v
+ else
+ penlight.tbls._recent[s] = v
+ end
+ end
+ end
+
if penlight.hasval(__PL_GLOBALS__) then
-- iterators
@@ -803,8 +851,9 @@ if penlight.hasval(__PL_GLOBALS__) then
penlight.filterfiles = penlight.utils.filterfiles
penlight.a2 = penlight.array2d
+ A2d = penlight.array2d
penlight.tbl = penlight.tablex
-
+ TX = penlight.tablex
for k,v in pairs(penlight.tex) do -- make tex functions global
_G[k] = v
diff --git a/macros/luatex/generic/penlightplus/penlightplus.pdf b/macros/luatex/generic/penlightplus/penlightplus.pdf
index 89b8236d66..32135ebb6e 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 0d49ff90d0..3f95ae4d9e 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.sty
+++ b/macros/luatex/generic/penlightplus/penlightplus.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-07-22
+% 2023-08-27
% Copyright (C) 2021-2023 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,11 +22,12 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{penlightplus}[2023-07-22]
+\ProvidesPackage{penlightplus}[2023-08-27]
\RequirePackage{luacode}
\RequirePackage{luakeys}
\RequirePackage[import]{penlight}
+\RequirePackage{etoolbox}
\DeclareOption{globals}{\luadirect{__PL_GLOBALS__ = true}}
\DeclareOption{pl}{\directlua{pl = penlight}}
@@ -72,43 +73,92 @@
}
-%
-%
-%\NewDocumentCommand{\tblnew}{m}{\luadirect{
-% _G[\luastring{#1}] = {}
-%}}
-%
-%\NewDocumentCommand{\tblfrkv}{m m O{} }{\luadirect{
-% _G[\luastring{#1}] = penlight.luakeys.parse(\luastring{#2}, penlight.luakeys.parse(\luastring{#3}))
-%}}
-%
-%\NewDocumentCommand{\tblset}{m m m}{\luadirect{
-% _G[\luastring{#1}][\luastring{#2}] = \luastring{#3}
-%}}
-%
-%\NewDocumentCommand{\tblget}{m m}{\luadirect{
-% tex.sprint(tostring(_G[\luastring{#1}][\luastring{#2}]))
-%}}
-%
-%\NewDocumentCommand{\tblidx}{m m}{\luadirect{
-% tex.sprint(tostring(_G[\luastring{#1}][#2]))
-%}}
-%
-%
+
+
+
+
+
+
+%%%%
+
+\newtoggle{luaexpr}\togglefalse{luaexpr}
+
+\begin{luacode*}
+ function toggle_luaexpr(expr)
+ if expr then
+ tex.sprint('\\toggletrue{luaexpr}')
+ else
+ tex.sprint('\\togglefalse{luaexpr}')
+ end
+ end
+\end{luacode*}
+
+\NewDocumentCommand{\ifluax}{m m O{}}{%
+ \luadirect{toggle_luaexpr(#1)}%
+ \iftoggle{luaexpr}{#2}{#3}%
+ \togglefalse{luaexpr}% safety set to false
+}
+
+\NewDocumentCommand{\ifluaxv}{m m O{}}{\ifluax{penlight.hasval(#1)}{#2}[#3]}
+
+
+% testing ifluax
+% {-->\ifluax{1 == 2}{\LARGE TRUE}[\tiny FALSE]<--test\\
+% -->\ifluax{abc == nil}{\LARGE TRUE}[\tiny FALSE]<--test}
+
+
+%%%
+
+\NewDocumentCommand{\newtbl}{m}{\luadirect{
+ penlight.tbls[\luastring{#1}] = {}
+ penlight.tbls._recent = penlight.tbls[\luastring{#1}]
+}}
+
+\NewDocumentCommand{\tblfrkv}{m m O{}}{ \luadirect{
+ penlight.tbls[\luastring{#1}] = penlight.luakeys.parse(\luastring{#2}, penlight.luakeys.parse(\luastring{#3}))
+ penlight.tbls._recent = penlight.tbls[\luastring{#1}]
+}}
+
+\NewDocumentCommand{\chgtbl}{ m }{ \luadirect{
+ penlight.tbls._recent = penlight.tbls[\luastring{#1}]
+}}
+
+\NewDocumentCommand{\gettbl}{m}{\luadirect{
+ penlight.get_tbl_item(\luastring{#1}, true)
+}}
+
+\NewDocumentCommand{\settbl}{m m}{\luadirect{
+ penlight.set_tbl_item(\luastring{#1}, \luastring{#2})
+}}
+
+\NewDocumentCommand{\deftbl}{ m m }{\luadirect{% define a table, use * to make definition
+ token.set_macro(\luastring{#2}, tostring(penlight.get_tbl_item(\luastring{#1})))
+}}
+
+\NewDocumentCommand{\gdeftbl}{ m m }{\luadirect{% define a table, use * to make global definition
+ token.set_macro(\luastring{#2}, tostring(penlight.get_tbl_item(\luastring{#1})), 'global')
+}}
+
+\NewDocumentCommand{\iftbl}{m m O{}}{\ifluax{penlight.get_tbl_item(\luastring{#1})}{#2}[#3]}
+
+\NewDocumentCommand{\iftblv}{m m O{}}{\ifluaxv{penlight.get_tbl_item(\luastring{#1})}{#2}[#3]}
+
+
+
%\NewDocumentCommand{\tblupd}{ m m}{\luadirect{
-% penlight.tablex.update(_G[\luastring{#1}], _G[\luastring{#2}])
+% penlight.tablex.update(penlight.tbls[\luastring{#1}], penlight.tbls[\luastring{#2}])
%}}
%
%\NewDocumentCommand{\tblupdkv}{ m m }{\luadirect{
-% penlight.tablex.update(_G[\luastring{#1}], penlight.luakeys.parse(\luastring{#2}))
+% penlight.tablex.update(penlight.tbls[\luastring{#1}], penlight.luakeys.parse(\luastring{#2}))
%}}
+
%
%% todo need a get table function. If blank is passed, the last table referenced is used.
%\NewDocumentCommand{\tblfrkvII}{ m m m }{\luadirect{
% _G[\luastring{#1}] = penlight.tablex.update(penlight.luakeys.parse(\luastring{#2}), luakeys.parse(\luastring{#3}))
%}}
-
%\NewDocumentCommand{\tbldo}{m m O{} }{\luadirect{
% % tex.sprint(tostring(_G[\luastring{#1}][#2]))
% % todo allow one to use pl tablex function here,
@@ -117,3 +167,14 @@
%}}
+
+
+%%%%%%%%5
+
+%\begin{luacode*}
+% function set_dim(name, len)
+% tex.sprint('\\global\\let\\'..name..'\\relax') -- reset length
+% tex.sprint('\\global\\newlength{\\'..name..'}') -- make new len
+% tex.setglue(name, tex.sp(len))
+% end
+%\end{luacode*}
diff --git a/macros/luatex/generic/penlightplus/penlightplus.tex b/macros/luatex/generic/penlightplus/penlightplus.tex
index 50f87fa38b..fec72b8dfd 100644
--- a/macros/luatex/generic/penlightplus/penlightplus.tex
+++ b/macros/luatex/generic/penlightplus/penlightplus.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2023-07-22
+% 2023-08-27
% Copyright (C) 2021-2023 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -85,20 +85,17 @@ require'penlightplus'
+The following global Lua variables are defined:
-
-\subsection*{}
-
-The following global variables are defined:
-
-\llcmd{__SKIP_TEX__} If using the \cmd{penlightplus} package with \cmd{texlua} (good for troubleshooting), set this global before loading \cmd{penlight}\\
+\cmd{__SKIP_TEX__} If using the \cmd{penlightplus} package with \cmd{texlua} (good for troubleshooting), set this global before loading \cmd{penlight}\\
The gloals flags below are taken care of in the package options:\\
-\llcmd{__PL_}\cmd{GLOBALS__} If using package with \cmd{texlua} and you don't want to set some globals (described in next sections), set this global before to \cmd{true} loading \cmd{penlight}\\
+\cmd{__PL_GLOBALS__} If using package with \cmd{texlua} and you don't want to set some globals (described in next sections), set this global before to \cmd{true} loading \cmd{penlight}\\
\cmd{__PL_NO_HYPERREF__} a flag used to change the behaviour of a function, depending on if you don't use the hyperref package\\
+\cmd{__PDFmetadata__} a table used to store PDF meta-data
\subsubsection*{penlight additions}
-Some functionality is added to penlight/lua.
+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}\\
@@ -116,18 +113,19 @@ Some functionality is added to penlight/lua.
\llcmd{_NumBkts} internal integer for tracking the number of brackets\\
\llcmd{opencmd(cs)} prints \cmd{\cs}\{ and adds to the bracket counters.\\
\\
-\llcmd{_xNoValue,}\cmd{_xTrue,_xFalse}: \cmd{xparse} equivalents for commands\\
+\llcmd{xNoValue,}\cmd{xTrue,xFalse}: \cmd{xparse} equivalents for commands\\
\\
\llcmd{prt(x),prtn(x)} print without or with a newline at end. Tries to help with special characters or numbers printing.\\
\llcmd{prtl(l),prtt(t)} print a literal string, or table\\
\llcmd{wrt(x), wrtn(x)} write to log\\
-\llcmd{help_wrt}\cmd{(s1, s2)} pretty-print something to console. S2 is a flag to help you find.\\
+\llcmd{help_wrt}\cmd{(s1, s2)} pretty-print something to console. S2 is a flag to help you find., alias is \cmd{wrth}\\
\llcmd{prt_array2d(tt)} pretty print a 2d array\\
\\
\llcmd{pkgwarn}\cmd{(pkg, msg1, msg2)} throw a package warning\\
\llcmd{pkgerror}\cmd{(pkg, msg1, msg2, stop)} throw a package error. If stop is true, immediately ceases compile.\\
\\
-\llcmd{defcmd}\cmd{(cs, val)} like \cmd{\gdef}\\
+\llcmd{defcmd}\cmd{(cs, val)} like \cmd{\gdef}, but note that no special chars allowed in \cmd{cs}(eg. \cmd{@})\\
+\llcmd{defmacro}\cmd{(cs, val)} like \cmd{\gdef}, allows special characters, but any tokens in val must be pre-defined (this uses \cmd{token.set_macro} internally)\\
\llcmd{newcmd}\cmd{(cs, val)} like \cmd{\newcommand}\\
\llcmd{renewcmd}\cmd{(cs, val)} like \cmd{\renewcommand}\\
\llcmd{prvcmd}\cmd{(cs, val)} like \cmd{\providecommand}\\
@@ -139,9 +137,11 @@ is true, it will overwrite an existing command (using \cmd{defcmd}), otherwise,
\subsubsection*{global extras}
-If \cmd{extrasglobals} is used and NOT \cmd{extras}, many additional globals are set for shortcuts\\
-All \cmd{pl.tex} modules are made global.\\
-\cmd{pl.hasval}, \cmd{pl.COMP}, \cmd{pl.utils.kpairs}, \cmd{pl.utils.npairs} become globals with the function name.\\
+If the package option \cmd{globals} is used, many additional globals are set for easier scripting.
+All \cmd{pl.tex} functions, and variables, \cmd{pl.hasval}, \cmd{pl.COMP}, \cmd{pl.utils.kpairs}, \cmd{pl.utils.npairs} become globals.
+\cmd{pl.tablex} is aliased as \cmd{TX} (which also includes all native Lua table functions), and
+\cmd{pl.array2d} is aliased as \cmd{A2d}.
+\\
@@ -150,7 +150,14 @@ All \cmd{pl.tex} modules are made global.\\
based on the letters that \cmd{spec} is set to (or \cmd{def} if nothing is provided)
This is useful if you want to write a command with flexibility on argument expansion.
The user can specify \cmd{n}, \cmd{o}, \cmd{t}, and \cmd{f} (case insensitve) if they want
-no, once, twice, or full expansion.
+no, once, twice, or full expansion. For example, we can control the expansion of args 2 and 3 with arg 1:
+
+\begin{verbatim}
+ \NewDocumentCommand{\splitToComma}{ O{nn} m m }{%
+ \MakeluastringCommands[nn]{#1}%
+ \luadirect{penlight.tex.split2comma(\plluastringA{#2},\plluastringB{#3})}%
+}
+\end{verbatim}
% BELOW IS FOR TROUBLESHOOTING ABOVE
%\def\NOTexp{\ONEexp}
@@ -171,14 +178,57 @@ no, once, twice, or full expansion.
%\luastringExpTest{ n o t f }{\NOTexp}
+\subsection*{Lua boolean expressions for LaTeX conditionals}
+
+\cmd{\ifluax{<Lua expr>}{<do if true>}[<do if false>]} and\\ \cmd{\ifluax{<Lua expr>}{<do if true>}[<do if false>]} for truthy (uses \cmd{penlight.hasval})
+
+\begin{LTXexample}
+\ifluax{3^3 == 27}{3*3*3 is 27}[WRONG]\\
+\ifluax{abc123 == nil}{Var is nil}[WRONG]\\
+\ifluax{not true}{tRuE}[fAlSe]\\
+\ifluax{''}{TRUE}[FALSE]\\
+\ifluaxv{''}{true}[false]\\
+\end{LTXexample}
+
+\subsection*{Creating and using Lua tables in LaTeX}
+\cmd{penlightplus} provides a Lua-table interface. Tables are stored in the
+\cmd{penlight.tbls} table.
+
+
+\cmd{\newtbl{t}} declares a new table with name \cmd{t}\\
+\cmd{\chgtbl{t}} changes the 'recent' table\\
+\cmd{\tblfrkv{t}{key-val string}[luakeys opts]} new table from key-vals, used \cmd{luakeys} \\
+\cmd{\settbl{i}{v}} sets a value of the table/index \cmd{i} to \cmd{v}\\
+\cmd{\gettbl{i}} gets the value and \cmd{tex.sprint()}'s it\\
+\cmd{\deftbl{i}{d}} pushes the value to a \cmd{cs} named \cmd{d}\\
+\cmd{\gdeftbl{i}{d}} pushes the value to a global\\
+\cmd{\iftbl{i}{t}[f]} runs code \cmd{t} if the item is true else \cmd{f}\\
+\cmd{\iftblv{i}{t}[f]} runs code \cmd{t} if the item is truthy else \cmd{f}\\
+
+There are 3 ways to use the index (placeholder \cmd{{i}} above).
+\cmd{t.key} where \cmd{t} is the table name and \cmd{key} is a string key,
+\cmd{t/int} where \cmd{int} is a numeric indexer (ie uses \cmd{t[int]}),
+or simply \cmd{ind} without the table name, where the assumed table is the last one that was created or changed to, (pure-numbers are not treated as strings in this case).
+
+\begin{LTXexample}
+\tblfrkv{my}{a,b,c,first=john,last=smith}[defaults={x=0,1=one,n=false,y=yes}, naked_as_value=true]
+
+\settbl{my/4}{d}\gettbl{my/4}\\
+\settbl{5}{e}\gettbl{5}\\
+\gettbl{my.x}\\
+\iftbl{n}{t}[f]\\
+\iftblv{n}{t}[f]\\
+\iftbl{my.y}{t}[f]\\
+\iftblv{y}{t}[f]\\
+\end{LTXexample}
-\subsection*{Split stuff}
+
+\subsection*{Splitting strings}
Splitting text (or a cmd) into oxford comma format via:
\cmd{\splitToComma[expansion level]{text}{text to split on}}:
\begin{LTXexample}
-
-\splitToComma{ j doe }{\and}-\\
-\splitToComma{ j doe \and s else }{\and}-\\
-\splitToComma{ j doe \and s else \and a per }{\and}-\\
@@ -188,13 +238,14 @@ Splitting text (or a cmd) into oxford comma format via:
\splitToComma[o]{\authors}{\and}
\end{LTXexample}
-The expansion level is up to two characters, \cmd{n|o|t|f}, to control teh expasion of each argument.
+The expansion level is up to two characters, \cmd{n|o|t|f}, to control the expansion of each argument.
+You can do a similar string split but to \cmd{\item} instead of commas with \cmd{\splitToItems}
\begin{LTXexample}
-spliToItems:
\begin{itemize}
\splitToItems{kale\and john}{\and}
\splitToItems{kale -john -someone else}{-}
+ \splitToItems{1,2,3,4}{,}
\end{itemize}
\end{LTXexample}