summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-18 21:31:12 +0000
committerKarl Berry <karl@freefriends.org>2022-01-18 21:31:12 +0000
commit65f9c8611e6e13d8d69b1c30a793493c32b92dee (patch)
tree8ef864571d349f7e5ae7283a46b30eb4427153a7
parent1b2af0c8685288eeeec426e34a0e48297d7cab41 (diff)
autopuncitems (18jan22)
git-svn-id: svn://tug.org/texlive/trunk@61651 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/lualatex/autopuncitems/README.md4
-rw-r--r--Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdfbin35326 -> 41875 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex20
-rw-r--r--Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua4
-rw-r--r--Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty40
5 files changed, 46 insertions, 22 deletions
diff --git a/Master/texmf-dist/doc/lualatex/autopuncitems/README.md b/Master/texmf-dist/doc/lualatex/autopuncitems/README.md
index 3cd4844b108..1b4ad8c5c61 100644
--- a/Master/texmf-dist/doc/lualatex/autopuncitems/README.md
+++ b/Master/texmf-dist/doc/lualatex/autopuncitems/README.md
@@ -1,10 +1,10 @@
# autopuncitems
-Automatically punctuate lists by passing the autopunc option to enumitem lists.
+Automatically punctuate lists by passing the autopunc option to enumitem lists. Requires LuaLaTeX.
# License
-Copyright (C) 2021 Kale Ewasiuk
+Copyright (C) 2021-2022 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/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdf b/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdf
index fd743e4d996..d2a5da00ed8 100644
--- a/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdf
+++ b/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex b/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex
index fd829b81e62..06f3f5e9bed 100644
--- a/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex
+++ b/Master/texmf-dist/doc/lualatex/autopuncitems/autopuncitems.tex
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2021-12-20
-% Copyright (C) 2021 Kale Ewasiuk
+% 2022-01-18
+% Copyright (C) 2021-2022 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
@@ -62,12 +62,19 @@
\begin{document}
\maketitle
+{\Huge TODO make an environment that can be used outside of itemize, useful for beamer possibly}
+
\section{Introduction}
-This package provides the \cmd{autopunc} option in the
-\cmd{enumitem} environemnts \cmd{itemize}, \cmd{enumerate}, and \cmd{description}
+This package provides environments \cmd{AutoPuncItemize}, \cmd{AutoPuncItemizeO}, and \cmd{AutoPuncItemizeE} (beta)
to automatically punctuate the items.
+By default, it adds the \cmd{autopunc (O|E)} options in the
+\cmd{enumitem} environments \cmd{itemize}, \cmd{enumerate}, and \cmd{description}, to wrap the contents in these enviroments.
+If you want to skip this (say if you were using the beamer class which
+may be interefered with by enum item), pass the \cmd{noenumitem} option to this package. You can still use the environments with beamer, though.
It uses lua pattern matching to modify the environment's contents.
+
+
\section{Some commands}
\llcmd{\APomit}Used in an \cmd{\item} to signify that that item should not be automatically punctuated, and not be counted. Expands to nothing.\\
\llcmd{\APpass}Used in an \cmd{\item} to signify that that item should not be automatically punctuated, and but still counted. Expands to nothing.\\
@@ -84,6 +91,11 @@ It uses lua pattern matching to modify the environment's contents.
\end{addmargin}
+\section{Variants}
+\llcmd{autopunc}Does not expand the contents of environment. Tutorial on next section shows this.\\
+\llcmd{autopuncO}Expands the contents of environment once. Useful if \cmd{\item}'s are in a command \\
+\llcmd{autopuncE}Fully expands the contents of environment first. This is in-progress and should not be used.\\
+
\section{Tutorial}
\subsection{Basic Use}
diff --git a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
index 5e8e5b10c64..fc0a4b38b5e 100644
--- a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
+++ b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.lua
@@ -1,6 +1,6 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2021-12-20
---% Copyright (C) 2021 Kale Ewasiuk
+--% 2022-01-18
+--% Copyright (C) 2021-2022 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/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
index 8045fa4737f..81c3f2dd6c3 100644
--- a/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
+++ b/Master/texmf-dist/tex/lualatex/autopuncitems/autopuncitems.sty
@@ -1,6 +1,6 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2021-12-20
-% Copyright (C) 2021 Kale Ewasiuk
+% 2022-01-18
+% Copyright (C) 2021-2022 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,10 +23,15 @@
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{autopuncitems}[2021-12-20]
+\ProvidesPackage{autopuncitems}[2022-01-18]
-\RequirePackage{enumitem}
\RequirePackage{luacode}
+\RequirePackage{etoolbox}
+
+\newtoggle{noenumitem}
+
+\DeclareOption{noenumitem}{\toggletrue{noenumitem}}
+\ProcessOptions*\relax
\luadirect{autopuncitems = require'autopuncitems'}
@@ -42,15 +47,22 @@
\NewDocumentCommand{\setAPlast}{m}{\luadirect{autopuncitems.punc[1] = \luastring{#1}}} % second last punc value
\NewDocumentCommand{\setAPseclast}{m}{\luadirect{autopuncitems.punc[2] = \luastring{#1}}} % final punc value
-\NewDocumentEnvironment{AutoPuncItemize}{ +b }{
-% \luadirect{texio.write_nl('auto >>>'..autopuncitems.go(\luastringN{#1}))}
- \luadirect{tex.print(autopuncitems.go(\luastringN{#1}))}
-}{}
+\NewDocumentEnvironment{AutoPuncItems}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastringN{#1}))}}{} % does not expand
+\NewDocumentEnvironment{AutoPuncItemsO}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastringO{#1}))}}{} % expands once
+\NewDocumentEnvironment{AutoPuncItemsE}{ +b }{\luadirect{tex.print(autopuncitems.go(\luastring{#1}))}}{} % full expansion IN-PROGRESS
-\SetEnumitemKey{autopunc}{
- first*=\expandafter\AutoPuncItemize,
- after=\endAutoPuncItemize,
+\iftoggle{noenumitem}{}{% do nothing to enumitem if noenumitem is passed. Useful for beamer
+ \RequirePackage{enumitem}
+ \global\SetEnumitemKey{autopunc}{
+ first*=\expandafter\AutoPuncItems,
+ after=\endAutoPuncItems,
+ }
+ \global\SetEnumitemKey{autopuncO}{
+ first*=\expandafter\AutoPuncItemsO,
+ after=\endAutoPuncItemsO,
+ }
+ \global\SetEnumitemKey{autopuncE}{
+ first*=\expandafter\AutoPuncItemsE,
+ after=\endAutoPuncItemsE,
+ }
}
-
-
-