texlive[61825] Master/texmf-dist: autopuncitems (31jan22)

commits+karl at tug.org commits+karl at tug.org
Mon Jan 31 22:14:33 CET 2022


Revision: 61825
          http://tug.org/svn/texlive?view=revision&revision=61825
Author:   karl
Date:     2022-01-31 22:14:32 +0100 (Mon, 31 Jan 2022)
Log Message:
-----------
autopuncitems (31jan22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdf
    trunk/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex
    trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
    trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty

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

Modified: trunk/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex	2022-01-31 21:14:19 UTC (rev 61824)
+++ trunk/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex	2022-01-31 21:14:32 UTC (rev 61825)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at gmail.com)
-% 2022-01-18
+% 2022-01-30
 % Copyright (C) 2021-2022 Kale Ewasiuk
 %
 % Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -62,7 +62,6 @@
 \begin{document}
 \maketitle
 
-{\Huge TODO make an environment that can be used outside of itemize, useful for beamer possibly}
 
 \section{Introduction}
 This package provides environments \cmd{AutoPuncItemize}, \cmd{AutoPuncItemizeO}, and \cmd{AutoPuncItemizeE} (beta)
@@ -209,5 +208,38 @@
 \end{itemize}
 \end{LTXexample}
 
+You may want to use the \cmd{AutoPuncItems} environment outside a list environment instead,
+say perhaps if you're using the \cmd{beamer}.
+Note that  nested lists are normally not punctuated, and since the first-level list is inside the environment, it's considered nested.
+If you would like to disable the prevention of auto-punctuating all nested lists, use the \cmd{\disableAPprotectnest}.
+Note that nested lists will cause an error to occur.
+
+\begin{LTXexample}
+\disableAPprotectnest
+\begin{AutoPuncItems}
+\begin{itemize}
+    \item one
+    \item two
+    \item three
+    \item four
+\end{itemize}
+\end{AutoPuncItems}
+\end{LTXexample}
+
+The normal way to use the environment should be inside the first list, like so.
+
+\begin{LTXexample}
+\enableAPautopassnest % default settn
+\begin{itemize}
+\begin{AutoPuncItems}
+    \item one
+    \item two
+    \item three
+    \item four
+\end{AutoPuncItems}
+\end{itemize}
+\end{LTXexample}
+
+
 \end{document}
 

Modified: trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua	2022-01-31 21:14:19 UTC (rev 61824)
+++ trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua	2022-01-31 21:14:32 UTC (rev 61825)
@@ -1,5 +1,5 @@
 --% Kale Ewasiuk (kalekje at gmail.com)
---% 2022-01-18
+--% 2022-01-30
 --% Copyright (C) 2021-2022 Kale Ewasiuk
 --%
 --% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -41,6 +41,7 @@
 ap.code = 0 -- code for skipping punc if > 0, keep in count if == 1, omit from count if == 2
 
 ap.autopassnested = true
+ap.skipnextprot = false
 
 function ap.start(s)
      ap.curr = 0
@@ -70,6 +71,8 @@
         return d
 end
 
+
+
 function ap.protectnest(s)
     local x = ''
     if ap.autopassnested then x = ap.pass..'{}' end
@@ -88,12 +91,16 @@
 
 
 function ap.go(s)
-    s = ap.protectnest(s)
+    if ap.skipnextprot then
+        s =  s:gsub(ap.item, ap.itemp)
+    else
+        s = ap.protectnest(s)
+    end
     ap.start(s) -- start counters
     --texio.write_nl('yooo...'..s)
     s = s:gsub(ap.itemp, '\0\0'):gsub('\0', '', 1)  -- make all items \0\0 then change first item to one \0
     s = s:gsub('(%z)(%Z*)(%z?)',  -- find betwen \0 .. \0
-            function(it, s, _it)  -- discarding duplicate item '_it' that was made in first gsub
+            function(it, s)  -- discarding duplicate item '_it' that was made in first gsub
                 ap.addcount(s) -- add count, helps determine delimiter
                 return ap.rtrim(it..s)..ap.getdelim()..' '
             end

Modified: trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty	2022-01-31 21:14:19 UTC (rev 61824)
+++ trunk/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty	2022-01-31 21:14:32 UTC (rev 61825)
@@ -1,5 +1,5 @@
 % Kale Ewasiuk (kalekje at gmail.com)
-% 2022-01-18
+% 2022-01-30
 % 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.
 
 
-\ProvidesPackage{autopuncitems}[2022-01-18]
+\ProvidesPackage{autopuncitems}[2022-01-30]
 
 \RequirePackage{luacode}
 \RequirePackage{etoolbox}
@@ -40,6 +40,8 @@
 
 \newcommand{\disableAPautopassnest}{\luadirect{autopuncitems.autopassnested = false}}
 \newcommand{\enableAPautopassnest}{\luadirect{autopuncitems.autopassnested = true}}
+\newcommand{\disableAPprotectnest}{\luadirect{autopuncitems.skipnextprot = true}}
+\newcommand{\enableAPprotectnest}{\luadirect{autopuncitems.skipnextprot = false}}
 
 \NewDocumentCommand{\setAPeach}{m m m}{\setAPdef{#1}\setAPseclast{#2}\setAPlast{#3}} % set each one, default, second last, last
 \NewDocumentCommand{\setAPall}{m}{\setAPdef{#1}\setAPseclast{#1}\setAPlast{#1}} % set all the same



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