From 65f9c8611e6e13d8d69b1c30a793493c32b92dee Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 18 Jan 2022 21:31:12 +0000 Subject: autopuncitems (18jan22) git-svn-id: svn://tug.org/texlive/trunk@61651 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/lualatex/autopuncitems/autopuncitems.lua | 4 +-- .../tex/lualatex/autopuncitems/autopuncitems.sty | 40 ++++++++++++++-------- 2 files changed, 28 insertions(+), 16 deletions(-) (limited to 'Master/texmf-dist/tex/lualatex') 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, + } } - - - -- cgit v1.2.3