summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-itm.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-itm.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/core-itm.tex499
1 files changed, 339 insertions, 160 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-itm.tex b/Master/texmf-dist/tex/context/base/core-itm.tex
index 9642b0f945d..605e3ef1d49 100644
--- a/Master/texmf-dist/tex/context/base/core-itm.tex
+++ b/Master/texmf-dist/tex/context/base/core-itm.tex
@@ -25,7 +25,7 @@
\stopmessages
\startmessages german library: layouts
- 9: z.Z. nicht mehr als -- Niveaus in Posten
+ 9: z.Z. nicht mehr als -- Ebenen in Aufzaehlungen
\stopmessages
\startmessages czech library: layouts
@@ -69,15 +69,107 @@
\newconditional\afterlistitem \setfalse\afterlistitem
\newconditional\nowhitelistitem \setfalse\nowhitelistitem
\newconditional\joinedlistitem \setfalse\joinedwhitelistitem
+\newconditional\reverselistitem \setfalse\reverselistitem
+\newconditional\continuelistitems \setfalse\continuelistitems
+\newconditional\fittinglistitems \setfalse\fittinglistitems
-\newcounter\noflists
-\newcounter\itemlevel
-\newcounter\itemcolumndepth
-\newcounter\maxitemlevel
+\newcount\noflists
+\newcount\currentnoflists
+\newcount\itemcolumndepth
+\newcount\itemdepth
+\newcount\maxitemdepth
\definetwopasslist\s!list
-\let\currentitemgroup\empty
+\let\currentitemlevel \!!zerocount
+\let\currentitemgroup \empty
+\let\currentnofitems \!!zerocount
+\let\currentmaxnofitems\!!zerocount
+\let\currentminnofitems\!!zerocount
+\let\currentitemoffset \!!zerocount
+\def\currentitemnumber{\countervalue{\@@itemcounter\currentitemlevel}}
+
+% tricky ... we cannot use trialtypesetting here because there can be
+% multiple itemizes in e.g. a table, so we need something more advanced
+% where counters etc are reset to pre-outertrial values
+
+\def\dolistreference
+ {\ifconditional\continuelistitems
+ \savetaggedtwopassdata\s!list{\number\currentnoflists}{\number\currentnoflists}%
+ {\currentitemlevel:\noflistelements:c:\getitemparameter\currentitemlevel\c!maxwidth}%
+ \else
+ \savetaggedtwopassdata\s!list{\number\currentnoflists}{\number\currentnoflists}%
+ {\currentitemlevel:\noflistelements:n:\getitemparameter\currentitemlevel\c!maxwidth}%
+ \fi}
+
+\def\splititemtwopassdata#1%
+ {\expanded{\findtwopassdata{\s!list}{\number#1}}%
+ \expandafter\dosplititemtwopassdata\twopassdata:0:0:0:0:0\relax}
+
+\def\dosplititemtwopassdata#1:#2:#3:#4:#5\relax
+ {\edef\itemdatal{#1}\edef\itemdatan{#2}\edef\itemdatat{#3}\edef\itemdataw{#4}}
+
+\def\checkcurrentnofitems
+ {\splititemtwopassdata\currentnoflists
+ \iftwopassdatafound
+ \ifcase\itemdatan\relax % \scratchcounter
+ \let\currentnofitems \!!zerocount
+ \let\currentminnofitems\!!plusone
+ \let\currentmaxnofitems\!!zerocount
+ \else
+ \scratchcounter\itemdatan\relax
+ \edef\currentnofitems{\the\scratchcounter}%
+ \let\currentitemtag\itemdatat
+ \doloop
+ {\splititemtwopassdata{\numexpr\currentnoflists+\recurselevel\relax}%
+ \iftwopassdatafound
+ \ifnum\itemdatal=\currentitemlevel\relax
+ \doifelse{c}\itemdatat
+ {\advance\scratchcounter\itemdatan\relax}
+ {\exitloop}%
+ \fi
+ \else
+ \exitloop
+ \fi}%
+ \edef\currentmaxnofitems{\the\scratchcounter}%
+ \scratchcounter\zerocount
+ \doif{c}\currentitemtag
+ {\doloop
+ {\splititemtwopassdata{\numexpr\currentnoflists-\recurselevel\relax}%
+ \iftwopassdatafound
+ \ifnum\itemdatal=\currentitemlevel\relax
+ \doifelse{c}\itemdatat
+ {\advance\scratchcounter\itemdatan\relax}
+ {\advance\scratchcounter\itemdatan\exitloop}%
+ \fi
+ \else
+ \exitloop
+ \fi}}%
+ \advance\scratchcounter\plusone
+ \edef\currentminnofitems{\the\scratchcounter}%
+ % [[\currentnofitems,\currentminnofitems,\currentmaxnofitems]]
+ \fi
+ \fi}
+
+% \startitemize[n,packed]
+% \item test \item test \item test
+% \stopitemize
+%
+% \startitemize[n,packed,reverse]
+% \item test \item test \item test
+% \stopitemize
+%
+% \startitemize[n,packed,reverse] \item test \item test \stopitemize
+% \startitemize[continue]
+% \item test \startitemize[n,packed] \item test \item test \stopitemize
+% \item test
+% \item test
+% \stopitemize
+% \startitemize[continue] \item test \stopitemize
+%
+% \startitemize[n,packed] \item test \item test \stopitemize
+% \startitemize[continue] \item test \stopitemize
+% \startitemize[continue] \item test \stopitemize
\def\unknownitemreference{0} \let\itemreferences\unknownitemreference
@@ -111,9 +203,6 @@
\def\doitembreak#1{\ifconditional\optimizelistitem\ifconditional\textlistitem\else\dosomebreak#1\fi\fi}
-\def\dolistreference
- {\savetaggedtwopassdata{\s!list}{\currentlist}{\currentlist}{\noflistelements}}
-
\def\initializeitemgroupslevel#1%
{\ifundefined{\@@globalitemsymbol{#1}}%
\edef\itemreferences{\itemreferences,#1}%
@@ -129,7 +218,7 @@
\def\doinitializeitemgrouplevel#1%
{\copyparameters
[\??op\currentitemgroup#1][\??oo]
- [\c!width,\c!factor,\c!distance,\c!align,\c!option,
+ [\c!width,\c!factor,\c!distance,\c!align,\c!symalign,\c!option,
\c!style,\c!marstyle,\c!symstyle,\c!headstyle,
\c!color,\c!marcolor,\c!symcolor,\c!headcolor,
\c!beforehead,\c!afterhead,\c!before,\c!inbetween,\c!after,
@@ -145,13 +234,13 @@
\def\dosetupitemgroups[#1]% still undocumented
{\getparameters[\??oo][\c!levels=4,#1]%
% will change (remove)
- \ifnum\@@oolevels>\maxitemlevel
- \edef\maxitemlevel{\@@oolevels}%
- \dorecurse\maxitemlevel{\initializeitemgroupslevel\recurselevel}%
+ \ifnum\@@oolevels>\maxitemdepth
+ \maxitemdepth\@@oolevels\relax
+ \dorecurse\maxitemdepth{\initializeitemgroupslevel\recurselevel}%
\fi}
\def\doitemreference#1,#2,#3\\%
- {\ifnum\itemlevel>#1\relax
+ {\ifnum\currentitemlevel>#1\relax
\ifnum#1>\zerocount \tempsymbol \fi
\getvalue{\@@currentitemsymbol{#2}}%
\doitemreference#2,#3\\%
@@ -161,17 +250,18 @@
{\expandafter\doitemreference\itemreferences,,\\}
\def\packitems
- {\ifcase\itemlevel \else \settrue\packlistitem \fi}
+ {\ifcase\currentitemlevel \else \settrue\packlistitem \fi}
\def\dosetupitemgroupvariable[#1]% [#2]% niveau instellingen
{\doifelsenothing{#1}
- {\getparameters[\??op\currentitemgroup\itemlevel]}% [#2]}%
+ {\getparameters[\??op\currentitemgroup\currentitemlevel]}% [#2]}%
{\getparameters[\??op\currentitemgroup#1]}}% [#2]}}
\newconditional\inlinelistitem \setfalse\inlinelistitem
\def\dododosetupitemgroupconstant[#1][#2#3#4]% * permits [2]
- {\processaction
+ {\global\setitemparameter\currentitemlevel\c!maxwidth{0}%
+ \processaction
[#2#3#4]
[ \v!packed*=>\packitems,
\v!intro*=>\settrue\introlistitem, % here? not set to false
@@ -193,6 +283,8 @@
\v!atmargin*=>\doifnot{#1}{1}{\setitemparameter{#1}\c!width{0em}}, % signal
\v!intext*=>\settrue\inlinelistitem, % new
\v!loose*=>\setfalse\optimizelistitem,
+ \v!fit*=>\settrue\fittinglistitems,
+ \v!nofit*=>\setfalse\fittinglistitems,
\v!paragraph*=>\settrue\paragraphlistitem
\packitems,
\v!joinedup*=>\settrue\joinedlistitem % \dosetuppackeditemgroup{#1}%
@@ -203,6 +295,7 @@
\v!stopper*=>\setitemparameter{#1}\c!placestopper{\v!yes}, % keep {}
\v!unpacked*=>\setfalse\packlistitem,
\v!repeat*=>\settrue\repeatlistitem, % new
+ \v!reverse*=>\settrue\reverselistitem,
\v!standard*=>\dosetupstandarditemgroup{#1}]}
\def\dosetupstandarditemgroup#1%
@@ -231,27 +324,27 @@
\def\itembeforecommand
{\ifconditional\nowhitelistitem
\ifconditional\beforelistitem
- \ifcase\itemlevel\or\getitemparameter\itemlevel\c!before\fi
+ \ifcase\currentitemlevel\or\getitemparameter\currentitemlevel\c!before\fi
\else
\nowhitespace
\fi
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!before
+ \getitemparameter\currentitemlevel\c!before
\fi\fi}
\def\itemaftercommand
{\ifconditional\nowhitelistitem
\ifconditional\afterlistitem
- \ifcase\itemlevel\or\getitemparameter\itemlevel\c!after\fi
+ \ifcase\currentitemlevel\or\getitemparameter\currentitemlevel\c!after\fi
\else
\nowhitespace
\fi
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!after
+ \getitemparameter\currentitemlevel\c!after
\fi\fi}
\def\iteminbetweencommand
@@ -260,7 +353,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!inbetween
+ \getitemparameter\currentitemlevel\c!inbetween
\fi\fi}
\def\itembeforeheadcommand
@@ -269,7 +362,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!beforehead
+ \getitemparameter\currentitemlevel\c!beforehead
\fi\fi}
\def\itemafterheadcommand
@@ -278,7 +371,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!afterhead
+ \getitemparameter\currentitemlevel\c!afterhead
\fi\fi}
% \def\dosetuppackeditemgroup#1%
@@ -301,18 +394,18 @@
\def\dodododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifnot{#2}{}
{\doifelse{#1}\v!each
- {\dorecurse\maxitemlevel{\ExpandFirstAfter\dododododosetupitemgroup[\recurselevel][#2]}}
+ {\dorecurse\maxitemdepth{\ExpandFirstAfter\dododododosetupitemgroup[\recurselevel][#2]}}
{\ExpandFirstAfter\dododododosetupitemgroup[#1][#2]}}}
\def\dododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifelse{#2}{}
- {\ifcase\itemlevel\relax
+ {\ifcase\currentitemlevel\relax
\dodododosetupitemgroup[\v!each][#1]%
\else
- \dodododosetupitemgroup[\itemlevel][#1]%
+ \dodododosetupitemgroup[\currentitemlevel][#1]%
\fi}
{\doifelsenothing{#1}
- {\dodododosetupitemgroup[\itemlevel][#2]}
+ {\dodododosetupitemgroup[\currentitemlevel][#2]}
{\dodododosetupitemgroup[#1][#2]}}}
\def\dodosetupitemgroup[#1][#2][#3][#4]%
@@ -332,25 +425,35 @@
\def\doadvanceitem
{\ifconditional\sublistitem\else\ifconditional\symbollistitem\else
- \pluscounter{\@@itemcounter\itemlevel}%
+ \pluscounter{\@@itemcounter\currentitemlevel}%
\fi\fi}
\def\setitemlevel#1%
- {\ifnum\itemlevel>\zerocount
+ {\ifnum\currentitemlevel>\zerocount
\settrue\firstlistitem
- \doifnotinset\v!continue{#1}
- {\doifinset{0}{#1}{\setitemparameter\itemlevel\c!start{0}}%
- \doifsomething{\getitemparameter\itemlevel\c!start}
- {\setcounter{\@@itemcounter\itemlevel}{\getitemparameter\itemlevel\c!start}%
- \minuscounter{\@@itemcounter\itemlevel}%
- \letitemparameter\itemlevel\c!start\empty}}%
+ %
+ \expanded{\setitemparameter{\currentitemlevel}{\c!start}{1}}%
+ \doifinset{0}{#1}{\setitemparameter\currentitemlevel\c!start{0}}%
+ \setcounter{\@@itemcounter\currentitemlevel}{0}%
+ \doifelsenothing{\getitemparameter\currentitemlevel\c!start}
+ {\def\currentitemoffset{1}}
+ {\def\currentitemoffset{\getitemparameter\currentitemlevel\c!start}%
+ \letitemparameter\currentitemlevel\c!start\empty}%
+ %
\def\tempnumber
- {\countervalue{\@@itemcounter\itemlevel}}%
- \doifelse{\getitemparameter\itemlevel\c!placestopper}\v!yes
- {\def\tempsymbol{\getitemparameter\itemlevel\c!stopper}}
+ {\countervalue{\@@itemcounter\currentitemlevel}}%
+ \doifelse{\getitemparameter\currentitemlevel\c!placestopper}\v!yes
+ {\def\tempsymbol{\getitemparameter\currentitemlevel\c!stopper}}
{\let\tempsymbol\empty}%
\fi}
+\def\actualitemnumber
+ {\ifconditional\reverselistitem
+ \convertnumber\currentitemsymbol{\numexpr\currentmaxnofitems+\currentitemoffset-\currentitemnumber+1\relax}%
+ \else
+ \convertnumber\currentitemsymbol{\numexpr\currentminnofitems+\currentitemoffset+\currentitemnumber-1\relax}%
+ \fi}
+
% PAS OP: ook 'opelkaar' en zo worden getest, nog eens afvangen!
\def\unknownitemsymbol{?}
@@ -358,24 +461,23 @@
\def\setitemmark#1% % en pas op: resets \docommand
{\doifsymboldefinedelse{#1}
{\edef\currentitemsymbol{#1}%
- \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
- \setgvalue{\@@localitemsymbol \itemlevel}{\unknownitemsymbol}%
+ \setxvalue{\@@globalitemsymbol\currentitemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol \currentitemlevel}{\unknownitemsymbol}%
\def\listitem{\symbol[\currentitemsymbol]}%
\let\@@opsymbol\empty}% \let\docommand\gobbleoneargument}
{\doifconversiondefinedelse{#1}
{\edef\currentitemsymbol{#1}%
- \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
- \setgvalue{\@@localitemsymbol \itemlevel}%
- {\convertnumber{\currentitemsymbol}{\countervalue{\@@itemcounter\itemlevel}}}%
+ \setxvalue{\@@globalitemsymbol\currentitemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol\currentitemlevel }{\actualitemnumber }%
\ifconditional\textlistitem
- \doifsomething{\getitemparameter\itemlevel\c!lefttext}
+ \doifsomething{\getitemparameter\currentitemlevel\c!lefttext}
{\let\tempsymbol\empty}%
\fi
\def\listitem
- {\getitemparameter\itemlevel
+ {\getitemparameter\currentitemlevel
{\ifconditional\textlistitem\c!lefttext\else\c!left\fi}%
- \getvalue{\@@localitemsymbol\itemlevel}\tempsymbol
- \getitemparameter\itemlevel
+ \getvalue{\@@localitemsymbol\currentitemlevel}\tempsymbol
+ \getitemparameter\currentitemlevel
{\ifconditional\textlistitem\c!righttext\else\c!right\fi}}%
\let\@@opsymbol\empty}%\let\docommand\gobbleoneargument}
{}}}
@@ -400,9 +502,22 @@
\def\startitemgroup
{\dotripleempty\dostartitemgroup}
+% \def\dostartitemgroup[#1][#2][#3]%
+% {\bgroup
+% \def\currentitemgroup{#1}%
+% \ifthirdargument
+% \dodostartitemgroup[#2][#3]%
+% \else
+% \doifassignmentelse{#2}
+% {\dodostartitemgroup[][#2]}
+% {\dodostartitemgroup[#2][]}%
+% \fi}
+
\def\dostartitemgroup[#1][#2][#3]%
{\bgroup
- \def\currentitemgroup{#1}%
+ \ifnum\currentitemlevel=\zerocount
+ \def\currentitemgroup{#1}% no nested mixing of itemgroups
+ \fi
\ifthirdargument
\dodostartitemgroup[#2][#3]%
\else
@@ -413,15 +528,16 @@
\def\dodostartitemgroup[#1]% [#2]%
{\relax % prevents lookahead
- \ifnum\itemlevel=\maxitemlevel\relax
- \showmessage\m!layouts9\maxitemlevel
+ \ifnum\currentitemlevel=\maxitemdepth\relax
+ \showmessage\m!layouts9{\number\maxitemdepth}%
\let\itemincrement\zerocount
\else
\let\itemincrement\plusone
\fi
- \doglobal\increment(\itemlevel,\itemincrement)%
- \initializeitemgrouplevel\itemlevel % safeguard
- \edef\itemgroupoptions{\getitemparameter\itemlevel\c!option}%
+ \global\advance\itemdepth\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
+ \initializeitemgrouplevel\currentitemlevel % safeguard
+ \edef\itemgroupoptions{\getitemparameter\currentitemlevel\c!option}%
\ifx\itemgroupoptions\empty
\edef\itemgroupoptions{#1}%
\else
@@ -492,6 +608,16 @@
\ifx\startcolumns\undefined \def\startcolumns[#1]{} \fi
\ifx\stopcolumns \undefined \let\stopcolumns\relax \fi
+\def\dosetsymalign#1% hm, we should use one of the core-spa macros or make a helper
+ {\processaction
+ [#1]
+ [ \v!flushleft=>\let\symalignleft\relax,
+ \v!right=>\let\symalignleft\relax,
+ \v!flushright=>\let\symalignleft\hfill,
+ \v!left=>\let\symalignleft\hfill,
+ \v!middle=>\let\symalignleft\hfil,
+ \v!center=>\let\symalignleft\hfil]}
+
\def\redostartitemgroup[#1][#2]%
{\setfalse\inlinelistitem % new, no indent (leftskip)
\setfalse\concatnextitem % new, concat
@@ -505,72 +631,86 @@
\ifconditional\textlistitem\else\doifnotinset\v!text{#1}\par\fi % suboptimal
\fi
\begingroup
- \doifinsetelse\v!intro{#1}{\settrue\introlistitem}{\setfalse\introlistitem}%
- \doifinsetelse\v!random{#1}{\settrue\randomizeitems}{\setfalse\randomizeitems}%
+ % new where, ok or not / we should integrate random, intro, continue here
+ % beware, the following no longer inherit from the previous level, is this ok?
+ \setfalse\reverselistitem
+ \setfalse\introlistitem
+ \setfalse\autointrolistitem
+ \setfalse\beforelistitem
+ \setfalse\afterlistitem
+ \setfalse\nowhitelistitem
+ \setfalse\randomizeitems
+ %
+ \doifinsetelse\v!intro {#1}{\settrue\introlistitem }{\setfalse\introlistitem }%
+ \doifinsetelse\v!random {#1}{\settrue\randomizeitems }{\setfalse\randomizeitems }%
+ \doifinsetelse\v!continue{#1}{\settrue\continuelistitems}{\setfalse\continuelistitems}%
% == \doifinsetelse\v!intro{#1}\settrue\setfalse\introlistitem
- \doglobal\increment\noflists
- \let\currentlist\noflists
+ \global\advance\noflists\plusone
+ \currentnoflists=\noflists
\newcounter\noflistelements
\setfalse\headlistitem
\setfalse\sublistitem
\setfalse\symbollistitem
\let\marsymbol\relax
- \globallet\somdestination\empty
+ \globallet\doitemdestination\empty
\let\symsymbol\empty
+ \let\symalignleft\relax
\the\itemgroupcommands
- % \getitemparameter\itemlevel\empty
+\checkcurrentnofitems
+ % \getitemparameter\currentitemlevel\empty
\let\listitem\empty % ** start value
\doifelsenothing{#1} % iffirstargument
- {\edef\@@opsymbol{\getitemparameter\itemlevel\c!symbol}%
- \letgvalueempty{\@@globalitemsymbol\itemlevel}%
- \global\letitemparameter\itemlevel\v!continue\empty
+ {\edef\@@opsymbol{\getitemparameter\currentitemlevel\c!symbol}%
+ \letgvalueempty{\@@globalitemsymbol\currentitemlevel}%
+ \global\letitemparameter\currentitemlevel\v!continue\empty
% \setitemmark\@@opsymbol % ** default value
- \dosetupitemgroupvariable[\itemlevel][#2]}
- {\dosetupitemgroupconstant[\itemlevel][#1]%
- \dosetupitemgroupvariable[\itemlevel][#2]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]}
+ {\dosetupitemgroupconstant[\currentitemlevel][#1]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]%
\doifinsetelse\v!continue{#1}% \noexpand, else problems in non-etex with chinese
- {\edef\@@opsymbol{\noexpand\getvalue{\@@globalitemsymbol\itemlevel}}%
- \getitemparameter\itemlevel\v!continue}
- {\edef\@@opsymbol{\noexpand\getitemparameter{\itemlevel}{\c!symbol}}%
- \global\setitemparameter\itemlevel\v!continue
- {\dosetupitemgroupconstant[\itemlevel][#1]%
- \dosetupitemgroupvariable[\itemlevel][#2]}}%
+ {\edef\@@opsymbol{\noexpand\getvalue{\@@globalitemsymbol\currentitemlevel}}%
+ \getitemparameter\currentitemlevel\v!continue}
+ {\edef\@@opsymbol{\noexpand\getitemparameter{\currentitemlevel}{\c!symbol}}%
+ \global\setitemparameter\currentitemlevel\v!continue
+ {\dosetupitemgroupconstant[\currentitemlevel][#1]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]}}%
\def\docommand##1% \setitemmark resets \docommand
{\doifnot{##1}{0}{\setitemmark{##1}}}%
% \processcommalist[#1,\@@opsymbol]\docommand
\processcommalist[#1]\docommand}% ** preset sequence or provided sequence
% moved to here, after settings
- \ifnum\itemlevel=\plusone % NIEUW
+ \ifnum\currentitemlevel=\plusone % NIEUW
\doadaptleftskip {\getitemparameter1\c!margin}%
\doadaptleftskip {\getitemparameter1\c!leftmargin}%
\doadaptrightskip{\getitemparameter1\c!rightmargin}%
\fi
- \dosetraggedcommand{\getitemparameter\itemlevel\c!align}\raggedcommand
- \doifsomething{\getitemparameter\itemlevel\c!indenting}
+ \dosetraggedcommand{\getitemparameter\currentitemlevel\c!align}\raggedcommand
+ \dosetsymalign{\getitemparameter\currentitemlevel\c!symalign}%
+ \doifsomething{\getitemparameter\currentitemlevel\c!indenting}
{% is \expanded needed?
- \expanded{\setupindenting[\getitemparameter\itemlevel\c!indenting]}}%
+ \expanded{\setupindenting[\getitemparameter\currentitemlevel\c!indenting]}}%
%
\setitemlevel{#1}% moved to here
\ifx\listitem\empty
\setitemmark\@@opsymbol % ** default value
\ifx\listitem\empty
- \edef\currentitemsymbol{\itemlevel}% ** fall back
+ \edef\currentitemsymbol{\currentitemlevel}% ** fall back
\fi
\fi
\ifconditional\autointrolistitem\ifnum\prevgraf<3
\settrue\introlistitem
\fi\fi
\ifconditional\paragraphlistitem
- \ifnum\itemlevel>\plusone
- \letitemparameter\itemlevel\c!inbetween\empty
+ \ifnum\currentitemlevel>\plusone
+ \letitemparameter\currentitemlevel\c!inbetween\empty
\fi
\fi
\ifconditional\packlistitem
- \letitemparameter\itemlevel\c!inbetween\empty
+ \letitemparameter\currentitemlevel\c!inbetween\empty
\fi
\doifinset\v!columns{#1}%
- {\ifinsidecolumns\else\ifnum\itemcolumndepth=\zerocount
- \globallet\itemcolumndepth\itemlevel
+ {\ifinsidecolumns\else\ifcase\itemcolumndepth
+ \global\itemcolumndepth\currentitemlevel\relax
\itembeforecommand
\processfirstactioninset
[#1]
@@ -579,15 +719,21 @@
\v!three=>\!!counta3\relax,
\v!four=>\!!counta4\relax,
\v!five=>\!!counta5\relax,
- \s!unknown=>\@EA\!!counta\getitemparameter\itemlevel\c!n]%
+ \s!unknown=>\@EA\!!counta\getitemparameter\currentitemlevel\c!n]%
\startcolumns
- [\c!n=\!!counta, % netter \??op\itemlevel\c!n
+ [\c!n=\!!counta, % netter \??op\currentitemlevel\c!n
\c!height=,
\c!rule=\v!off,
\c!balance=\v!yes,
\c!align=\v!no]%
- \fi\fi}
- \calculatelistwidth\itemlevel{\dimen0}%
+ \fi\fi}%
+\ifconditional\fittinglistitems
+ \splititemtwopassdata\currentnoflists
+ \ifdim\itemdataw sp>\zeropoint
+ \expanded{\setitemparameter{\currentitemlevel}{\c!width}{\itemdataw sp}}%
+ \fi
+\fi
+ \calculatelistwidth\currentitemlevel{\dimen0}%
\ifdim\dimen0>\zeropoint\relax
\ifconditional\inlinelistitem\else
\advance\leftskip \dimen0\relax
@@ -616,19 +762,19 @@
\else
\par
\fi
- \ifnum\itemcolumndepth=\zerocount \dolistreference \fi % beware !
+ \dolistreference
\ifconditional\firstlistitem \else \endgroup \fi % toegevoegd, eerste \som opent groep
- \ifnum\itemcolumndepth=\itemlevel\relax
+ \ifnum\itemcolumndepth=\currentitemlevel\relax
\stopcolumns
- \doglobal\newcounter\itemcolumndepth
+ \global\itemcolumndepth\zerocount
\itemaftercommand
\dontrechecknextindentation
\else
- \ifnum\itemlevel=\plusone
+ \ifnum\currentitemlevel=\plusone
\doitembreak\allowbreak % toegevoegd
- \itemaftercommand % \getitemparameter\itemlevel\c!after
+ \itemaftercommand % \getitemparameter\currentitemlevel\c!after
% was: \dochecknextindentation\??oo, is now:
- \dochecknextindentation{\??op\currentitemgroup\itemlevel}%
+ \dochecknextindentation{\??op\currentitemgroup\currentitemlevel}%
\else
% nieuw, not yet nobreak handling
\ifcase\autoitemgroupspacing
@@ -639,11 +785,19 @@
\dontrechecknextindentation
\fi
\fi
- \endgroup
- \doglobal\decrement(\itemlevel,\itemincrement)%
- \egroup
- % new needed in sidefloats (surfaced in volker's proceedings)
- \ifconditional\textlistitem\else\par\fi
+ % new test, needed in sidefloats (surfaced in volker's proceedings)
+ \ifconditional\textlistitem % else forgotten
+ \endgroup
+ \global\advance\itemdepth-\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
+ \egroup
+ \else
+ \endgroup
+ \global\advance\itemdepth-\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
+ \egroup
+ \par
+ \fi
\dorechecknextindentation}
\newtoks\itemgroupcommands
@@ -652,7 +806,7 @@
{\doitemgroupitem}
\def\itemgroupbutton[#1]%
- {\gdef\somdestination{#1}%
+ {\gdef\doitemdestination{#1}%
\itemgroupitem}
\def\itemgroupdummy
@@ -663,15 +817,15 @@
\itemgroupitem}
\def\itemgroupsymbol#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!symstyle\c!symcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!symstyle\c!symcolor{#1}}%
\settrue\symbollistitem
\itemgroupitem}
\def\itemgroupedge#1%
{\itemgroupsymbol
- {\calculatelistwidth\itemlevel{\dimen0}%
+ {\calculatelistwidth\currentitemlevel{\dimen0}%
\hbox to \dimen0
- {#1\hskip\getitemparameter\itemlevel\c!distance}}}
+ {#1\hskip\getitemparameter\currentitemlevel\c!distance}}}
\def\itemgrouphead
{\settrue\headlistitem\doitemgrouphead}
@@ -681,13 +835,13 @@
\def\doitemgroupitems[#1]%
{\itemgroupedge
- {\dorecurse{0\getitemparameter\itemlevel\c!items}{\listitem\hss}%
+ {\dorecurse{0\getitemparameter\currentitemlevel\c!items}{\listitem\hss}%
\unskip}}
\def\itemgroupmargin#1%
{\def\marsymbol
{\llap
- {\doitemattributes\itemlevel\c!marstyle\c!marcolor{#1}%
+ {\doitemattributes\currentitemlevel\c!marstyle\c!marcolor{#1}%
\hskip\leftskip\hskip\leftmargindistance}}%
\itemgroupitem}
@@ -729,10 +883,23 @@
% \headsym{xx} test \par test
% \stopitemize
+% aligned items
+%
+% \startitemize[n,fit,broad][itemalign=flushright]
+% \dorecurse{100}{\item The first item.}
+% \stopitemize
+%
+% \setupitemgroup[itemize][each][fit]
+% \setupitemgroup[itemize][each][distance=.5em,factor=1,itemalign=flushright]
+%
+% \startitemize[n]
+% \dorecurse{100}{\item The first item.}
+% \stopitemize
+
\appendtoks \let\headsym \itemgroupheadsym \to \itemgroupcommands
\def\itemgroupheadsym#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!symstyle\c!symcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!symstyle\c!symcolor{#1}}%
\settrue\symbollistitem
\settrue\headlistitem
\doitemgrouphead}
@@ -752,7 +919,7 @@
\newconditional\txtlistitem \setfalse\txtlistitem
\def\itemgrouptext#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!headstyle\c!headcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!headstyle\c!headcolor{#1}}%
\settrue\symbollistitem
\settrue\txtlistitem
\itemgroupitem}
@@ -765,71 +932,77 @@
\def\dodotxtitem
{\scratchdimen\wd8
- \advance \scratchdimen \getitemparameter\itemlevel\c!distance\relax
+ \advance \scratchdimen \getitemparameter\currentitemlevel\c!distance\relax
\ifdim\scratchdimen>\dimen0
\advance\scratchdimen -\dimen0
\else
\scratchdimen\z@
\fi
- \llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}}%
+ \llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hss}}% was: \hfill
\hskip\scratchdimen}
-\def\dolistitem % evt aantal items opslaan per niveau, scheelt zoeken
- {\ifconditional\textlistitem
- % begin of item
- \else
- \par
- \fi
-% \ignorespaces
- \increment\noflistelements
- \ifnum\itemcolumndepth=\zerocount \ifconditional\optimizelistitem
- \ifnum\noflistelements=\plusone % tgv bv kolommen/nesting
- \findtwopassdata\s!list{\noflists}% % wordt soms de volgorde
- \fi % verstoord, vandaar \find
- \iftwopassdatafound
- \ifcase0\twopassdata\relax \twopassdatafoundfalse \fi
- \fi
- \iftwopassdatafound
- \ifnum\twopassdata=3
- \ifnum\noflistelements>1
+\def\optimizelistitemsbreak
+ {\ifcase\itemcolumndepth \ifconditional\optimizelistitem
+ \ifcase \currentnofitems \else
+ \ifnum\currentnofitems=\plusthree
+ \ifnum\noflistelements>\plusone
\doitembreak\itemnobreak
\fi
- \else\ifnum\twopassdata>3
- \ifnum\noflistelements=2
+ \else\ifnum\currentnofitems>\plusthree
+ \ifnum\noflistelements=\plustwo
\ifconditional\introlistitem
\doitembreak\nobreak
\else
\doitembreak\itemnobreak
\fi
- \else\ifnum\twopassdata=\noflistelements\relax
+ \else\ifnum\currentnofitems=\noflistelements\relax
\doitembreak\itemnobreak
- \else\ifnum\noflistelements>2
+ \else\ifnum\noflistelements>\plustwo
\doitembreak\itembreak
\else
\ifconditional\introlistitem\else\doitembreak\itembreak\fi
\fi\fi\fi
\fi\fi
\fi
- \fi\fi
+ \fi\fi}
+
+\def\dolistitem % evt aantal items opslaan per niveau, scheelt zoeken
+ {\ifconditional\textlistitem
+ % begin of item
+ \else
+ \par
+ \fi
+% \ignorespaces
+ \increment\noflistelements
+ \optimizelistitemsbreak
\noindent
\setbox8\hbox
{\ifconditional\headlistitem
\ifconditional\symbollistitem
\symsymbol
\else
- \doitemattributes\itemlevel\c!headstyle\c!headcolor{\listitem}%
+ \doitemattributes\currentitemlevel\c!headstyle\c!headcolor{\listitem}%
\fi
\else
\ifconditional\symbollistitem
\symsymbol % no attributes, why?
\else
- \doitemattributes\itemlevel\c!style\c!color{\listitem}%
+ \doitemattributes\currentitemlevel\c!style\c!color{\listitem}%
\fi
\fi}%
- \doifsomething\somdestination
- {\setbox8\hbox{\goto{\box8}[\somdestination]}}%
- \globallet\somdestination\empty
- \dimen2=\getitemparameter\itemlevel\c!width\relax
+\ifconditional\fittinglistitems
+ \ifdim\wd8>\getitemparameter\currentitemlevel\c!maxwidth sp\relax
+ \expanded{\global\noexpand\setitemparameter{\currentitemlevel}{\c!maxwidth}{\number\wd8}}%
+ \fi
+ \splititemtwopassdata\currentnoflists
+ \ifdim\itemdataw sp>\zeropoint
+ \setbox8\simplealignedbox{\getitemparameter\currentitemlevel\c!itemalign}{\itemdataw sp}{\box8}%
+ \fi
+\fi
+ \doifsomething\doitemdestination
+ {\setbox8\hbox{\goto{\box8}[\doitemdestination]}}%
+ \globallet\doitemdestination\empty
+ \dimen2=\getitemparameter\currentitemlevel\c!width\relax
% new, prevents loops when symbol is (not yet found) graphic
\ht8=\strutheight
\dp8=\strutdepth
@@ -841,23 +1014,28 @@
\ifdim\dimen2=\zeropoint\relax
\calculatelistwidth1{\dimen0}%
\else
- \calculatelistwidth\itemlevel{\dimen0}%
+ \calculatelistwidth\currentitemlevel{\dimen0}%
\fi
\ifconditional\textlistitem
\hbox{\ifconditional\sublistitem+\fi\box8\hskip\interwordspace}\nobreak
\else\ifconditional\inlinelistitem
- \hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}%
+ \hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hss}% was: \hfill
\else\ifconditional\txtlistitem
\dodotxtitem
\else
% todo: align+marge binnen de hbox
- \llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}}%
+% \llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}}%
+ \llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi
+ \symalignleft
+ \box8\hfil
+ \hskip\getitemparameter\currentitemlevel\c!distance% T h
+ }}%
\fi\fi\fi
\fi
\forceunexpanded % needed for m conversion (\os) / i need to look into this
- \setevalue{\@@currentitemsymbol\itemlevel}%
- {\getvalue{\@@localitemsymbol\itemlevel}}% still problems with \uchar ?
- %{\noexpand\getvalue{\@@localitemsymbol\itemlevel}}% no, spoils subrefs
+ \setevalue{\@@currentitemsymbol\currentitemlevel}%
+ {\getvalue{\@@localitemsymbol\currentitemlevel}}% still problems with \uchar ?
+ %{\noexpand\getvalue{\@@localitemsymbol\currentitemlevel}}% no, spoils subrefs
\resetunexpanded
\setfalse\headlistitem
\setfalse\sublistitem
@@ -870,17 +1048,17 @@
\newconditional\repeatlistitem
\def\checkforrepeatedlistitem
- {\ifnum\itemlevel=\plusone
+ {\ifnum\currentitemlevel=\plusone
\initializeboxstack{item}%
\fi
\ifconditional\repeatlistitem
- \savebox{item}{\itemlevel}{\hbox{\copy8}}%
+ \savebox{item}{\currentitemlevel}{\hbox{\copy8}}%
\setbox8\hbox to \wd8
{\setbox\scratchbox\hbox
- {\scratchcounter\itemlevel
+ {\scratchcounter\currentitemlevel
\advance\scratchcounter\minusone
\dorecurse\scratchcounter{\foundbox{item}{\recurselevel}}}%
- \ifnum\itemlevel>\plusone
+ \ifnum\currentitemlevel>\plusone
\ifdim\wd\scratchbox>\zeropoint
\hskip-\dimen2
\box\scratchbox
@@ -923,22 +1101,22 @@
\doitembreak\nobreak % new, concat
\fi % new, concat
\doadvanceitem
- \ifnum\itemcolumndepth=0\relax\ifnum\noflistelements>0\relax
+ \ifcase\itemcolumndepth \ifnum\noflistelements>0\relax
\doitembreak\nobreak
\fi\fi
\ifconditional\firstlistitem
\setfalse\firstlistitem
\begingroup
- \ifcase\itemlevel
+ \ifcase\currentitemlevel
\or % 1
- \ifnum\itemcolumndepth=0\relax
+ \ifcase\itemcolumndepth
\ifconditional\introlistitem\doitembreak\nobreak\fi
- \itembeforecommand % \getitemparameter\itemlevel\c!before
+ \itembeforecommand % \getitemparameter\currentitemlevel\c!before
\ifconditional\introlistitem\doitembreak\nobreak\fi
\fi
\else % 2 en hoger
\ifconditional\paragraphlistitem \else
- \let\previtemlevel\itemlevel
+ \let\previtemlevel\currentitemlevel
\decrement\previtemlevel
\ifcase\autoitemgroupspacing\relax % nieuw
\itembeforecommand
@@ -970,7 +1148,7 @@
\ifconditional\packlistitem
\setupwhitespace[\v!none]%
\fi
- \getitemparameter\itemlevel\c!inner
+ \getitemparameter\currentitemlevel\c!inner
\marsymbol
\let\marsymbol\relax
\doifsomething{#1}
@@ -983,7 +1161,7 @@
\setfalse\concatnextitem % new, concat
\nobreak % else problems with intext items
\hskip\itemsignal % new, concat
- \getitemparameter\itemlevel\c!command} % \defaultitemcommand
+ \getitemparameter\currentitemlevel\c!command} % \defaultitemcommand
\def\defaultitemcommand
{\EveryPar{\ignorespaces}% needed ?
@@ -1017,10 +1195,10 @@
% \def\complexdoitemgrouphead[#1]#2\par% % beter in \complexdosom hangen met een if
% {\ifconditional\firstlistitem\else\doitembreak\allowbreak\fi
% \ifconditional\packlistitem\else\itembeforeheadcommand\fi
-% \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\itemlevel % incr in \complexdosom
+% \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\currentitemlevel % incr in \complexdosom
% \doitembreak\allowbreak
% \fi\fi\fi
-% \complexdoitemgroupitem[#1]{\doitemattributes\itemlevel\c!headstyle\c!headcolor
+% \complexdoitemgroupitem[#1]{\doitemattributes\currentitemlevel\c!headstyle\c!headcolor
% {\ignorespaces#2}}%
% \ifconditional\textlistitem
% \removeunwantedspaces\space\ignorespaces
@@ -1040,12 +1218,12 @@
\def\complexdoitemgrouphead[#1]% beter in \complexdosom hangen met een if
{\ifconditional\firstlistitem\else\doitembreak\allowbreak\fi
\ifconditional\packlistitem\else\itembeforeheadcommand\fi
- \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\itemlevel % incr in \complexdosom
+ \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\currentitemlevel % incr in \complexdosom
\doitembreak\allowbreak
\fi\fi\fi
\complexdoitemgroupitem[#1]%
\bgroup
- \dostartitemattributes\itemlevel\c!headstyle\c!headcolor\empty
+ \dostartitemattributes\currentitemlevel\c!headstyle\c!headcolor\empty
\ignorespaces
\let\par\enditemhead} % brrrr but simple anyway
@@ -1097,6 +1275,7 @@
\c!distance=.5em,
%\c!align=\v!normal, % definitely not \v!normal, see mails and
\c!align=, % debug reports of David A & Patrick G on context list
+ \c!symalign=,
\c!color=,
\c!indenting=, % untouched if empty
\c!color=,
@@ -1122,7 +1301,7 @@
\c!start=1,
\c!option=,
\c!command=\defaultitemcommand,
- \c!symbol=\itemlevel] % \v!niveau
+ \c!symbol=\currentitemlevel] % \v!niveau
\def\defineitemgroup
{\dodoubleempty\dodefineitemgroup}
@@ -1135,8 +1314,8 @@
\setvalue{\e!stop#1}{\stopitemgroup}%
\setvalue{\e!setup#1\e!endsetup}{\setupitemgroup[#1]}%
\getparameters[\??ig#1][\c!levels=3,#2]%
- \ifnum\getvalue{\??ig#1\c!levels}<\maxitemlevel\relax
- \letvalue{\??ig#1\c!levels}\maxitemlevel
+ \ifnum\getvalue{\??ig#1\c!levels}<\maxitemdepth\relax
+ \setevalue{\??ig#1\c!levels}{\number\maxitemdepth}%
\fi
\dorecurse{\getvalue{\??ig#1\c!levels}}{\initializeitemgrouplevel\recurselevel}%
\popmacro\currentitemgroup}}