diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi | 196 |
1 files changed, 127 insertions, 69 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi b/Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi index 0fc20432081..cbbefd5dbcc 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/strc-itm.mkvi @@ -15,14 +15,14 @@ \registerctxluafile{strc-itm}{} -%D As we analyze/register widths and such we could as well push and pop the -%D numbers at the \LUA\ end (which saves a few calls). - -%D Cleaning up this module happened around the time when Kate Bush came up -%D with the nicest numbered list of words: 50 Words For Snow. It's therefore -%D no surprise that I had that cd running several times when updating this -%D code. One of the highlights of 2011. - +%D As we analyze/register widths and such we could as well push and pop the numbers +%D at the \LUA\ end (which saves a few calls). +%D +%D Cleaning up this module happened around the time when Kate Bush came up with the +%D nicest numbered list of words: 50 Words For Snow. It's therefore no surprise that +%D I had that cd running several times when updating this code. One of the +%D highlights of 2011. +%D %D This module needs to be rewritten but that is tricky with respect to %D compatibilitity. Basically each major variant (regular, text, columns, %D horizontal, etc) needs to be on its own. @@ -198,14 +198,15 @@ \newconditional\c_strc_itemgroups_txt \newconditional\c_strc_itemgroups_extra \newconditional\c_strc_itemgroups_repeat +\newconditional\c_strc_itemgroups_inline_head % 0 = before/after % 1 = between unless before % 2 = between -\newconstant \c_strc_itemgroups_spacing_mode \c_strc_itemgroups_spacing_mode\plustwo -\newconditional\c_strc_itemgroups_optimize \settrue\c_strc_itemgroups_optimize -\newconditional\c_strc_itemgroups_auto_concat \settrue\c_strc_itemgroups_auto_concat +\newconstant \c_strc_itemgroups_spacing_mode \c_strc_itemgroups_spacing_mode\plustwo +\newconditional\c_strc_itemgroups_optimize \settrue\c_strc_itemgroups_optimize +\newconditional\c_strc_itemgroups_auto_concat \settrue\c_strc_itemgroups_auto_concat \newsignal \d_strc_itemgroups_signal @@ -214,30 +215,28 @@ \newdimen \d_strc_itemgroups_list_width \newdimen \d_strc_itemgroups_asked_width -\newdimen \d_strc_itemgroups_max_width % multipass -\newcount \c_strc_itemgroups_max_items % multipass +\newdimen \d_strc_itemgroups_max_width % multipass +\newcount \c_strc_itemgroups_max_items % multipass \newcount \c_strc_itemgroups_n_of_items \newcount \c_strc_itemgroups_nesting \newcount \c_strc_itemgroups_column_depth -\def \v_strc_itemgroups_counter {itemgroup:\currentparentitemgroup} - -\let \m_strc_itemgroups_repeat_start \empty -\def \v_strc_itemgroups_unknown_symbol {?} +\def \v_strc_itemgroups_counter {itemgroup:\currentparentitemgroup} +\let \m_strc_itemgroups_repeat_start \empty +\def \v_strc_itemgroups_unknown_symbol {?} +\let \m_strc_itemgroups_indenting \empty +\let \m_strc_itemgroups_destination \empty -\let \m_strc_itemgroups_indenting \empty -\let \m_strc_itemgroups_destination \empty +\let \currentitemlevel \!!zerocount % public +\def \currentnofitems {\the\c_strc_itemgroups_max_items} +\def \currentitemnumber {\strc_counters_raw_sub\v_strc_itemgroups_counter\currentitemlevel} % public -\let \currentitemlevel \!!zerocount % public -\def \currentnofitems {\the\c_strc_itemgroups_max_items} -\def \currentitemnumber {\strc_counters_raw_sub\v_strc_itemgroups_counter\currentitemlevel} % public +\newtoks \itemgroupcommands % maybe public -\newtoks \itemgroupcommands % maybe public - -\def \currentitemgroupsymbol {n} % here we cannot use a _ in the name -\let \currentitemgroupconversionset \empty % here we cannot use a _ in the name -\let \currentitemgroupsegments \empty +\def \currentitemgroupsymbol {n} % here we cannot use a _ in the name +\let \currentitemgroupconversionset \empty % here we cannot use a _ in the name +\let \currentitemgroupsegments \empty \def\strc_itemgroups_register_status {\clf_registeritemgroup{\currentparentitemgroup}\c_strc_itemgroups_nesting\c_strc_itemgroups_n_of_items\dimexpr\itemgroupparameter\c!maxwidth\relax} @@ -390,6 +389,11 @@ \unexpanded\def\strc_itemgroups_process_options#options% {\processcommacommand[#options]\strc_itemgroups_process_option} % expansion of options is handy for xml +% \installcommalistprocessorcommand \strc_itemgroups_process_option_list \strc_itemgroups_process_option +% +% \unexpanded\def\strc_itemgroups_process_options#options% +% {\normalexpanded{\strc_itemgroups_process_option_list[#options]}} % expansion of options is handy for xml + \def\strc_itemgroups_process_option#option% {\edef\itemgroupconstantvalue{#option}% \ifx\itemgroupconstantvalue\empty\else @@ -437,6 +441,7 @@ \setitemgroupparameter\c!width{0em}% \fi} % signal \setvalue{\??itemgroupkeyword\v!intext }{\settrue\c_strc_itemgroups_inline} +\setvalue{\??itemgroupkeyword\v!headintext }{\settrue\c_strc_itemgroups_inline_head} \setvalue{\??itemgroupkeyword\v!loose }{\setfalse\c_strc_itemgroups_optimize} \setvalue{\??itemgroupkeyword\v!fit }{\settrue\c_strc_itemgroups_fitting} \setvalue{\??itemgroupkeyword\v!nofit }{\setfalse\c_strc_itemgroups_fitting} @@ -462,26 +467,17 @@ \setvalue{\??itemgroupkeyword\v!seven }{\letitemgroupparameter\c!n\plusseven} \setvalue{\??itemgroupkeyword\v!eight }{\letitemgroupparameter\c!n\pluseight} \setvalue{\??itemgroupkeyword\v!nine }{\letitemgroupparameter\c!n\plusnine} -%setvalue{\??itemgroupkeyword\v!standard }{\setupcurrentitemgroup -% [\c!width =1.5\emwidth,% -% \c!distance =.5\emwidth,% -% \c!factor =0,% -% \c!inner =,% -% \c!beforehead=,% -% \c!afterhead =\blank,% -% \c!before =\blank,% -% \c!inbetween =\blank,% -% \c!after =\blank]} -\setvalue{\??itemgroupkeyword\v!standard }{\setitemgroupparameter\c!width {1.5\emwidth}% - \setitemgroupparameter\c!distance {.5\emwidth}% - \letitemgroupparameter\c!factor \!!zerocount - \letitemgroupparameter\c!inner \empty - \letitemgroupparameter\c!beforehead\empty - \letitemgroupparameter\c!afterhead \blank - \letitemgroupparameter\c!before \blank - \letitemgroupparameter\c!inbetween \blank - \letitemgroupparameter\c!after \blank} - +\setvalue{\??itemgroupkeyword\v!standard }{\setitemgroupparameter\c!width {1.5\emwidth}% + \setitemgroupparameter\c!distance {.5\emwidth}% + %\letitemgroupparameter\c!factor \!!zerocount + \letitemgroupparameter\c!factor {\zerocount}% + \setitemgroupparameter\c!packcriterium{\zerocount}% + \letitemgroupparameter\c!inner \empty + \letitemgroupparameter\c!beforehead \empty + \letitemgroupparameter\c!afterhead \blank + \letitemgroupparameter\c!before \blank + \letitemgroupparameter\c!inbetween \blank + \letitemgroupparameter\c!after \blank} \def\strc_itemgroups_initialize_local {\setfalse\c_strc_itemgroups_inline @@ -506,9 +502,9 @@ \setfalse\c_strc_itemgroups_columns % to be checked \let\m_strc_itemgroups_destination\empty - \let\strc_itemgroups_used_symbol\empty % ** start value + \let\strc_itemgroups_used_symbol \empty % ** start value \let\strc_itemgroups_margin_symbol\empty - \let\strc_itemgroups_extra_symbol\empty + \let\strc_itemgroups_extra_symbol \empty % \global\letitemgroupparameter\c!maxwidth\!!zeropoint } @@ -526,6 +522,11 @@ \def\strc_itemgroups_preset_stage_one#options% {\processcommacommand[#options]\strc_itemgroups_preset_stage_one_indeed} +% \installcommalistprocessorcommand \strc_itemgroups_preset_stage_one_list \strc_itemgroups_preset_stage_one_indeed +% +% \def\strc_itemgroups_preset_stage_one#options% +% {\normalexpanded{\strc_itemgroups_preset_stage_one_list[#options]}} + \def\strc_itemgroups_preset_stage_one_indeed#option% {\ifcsname\??itemgroupfirst#option\endcsname \lastnamedcs @@ -625,10 +626,17 @@ % can be made a bit faster +% \def\strc_itemgroups_setup_each#category#whatever% +% {\doifelseassignment{#whatever} +% {\strc_itemgroups_normal_setup[#category][#whatever]} +% {\strc_itemgroups_normal_setup[#category][\c!option={#whatever}]}} + \def\strc_itemgroups_setup_each#category#whatever% - {\doifelseassignment{#whatever} - {\strc_itemgroups_normal_setup[#category][#whatever]} - {\strc_itemgroups_normal_setup[#category][\c!option={#whatever}]}} + {\ifcondition\validassignment{#whatever}% + \strc_itemgroups_normal_setup[#category][#whatever]% + \else + \strc_itemgroups_normal_setup[#category][\c!option={#whatever}]% + \fi} \def\strc_itemgroups_setup_list_level_a#category#whatever#level% {\strc_itemgroups_normal_setup[#category:#level][#whatever]} @@ -636,10 +644,17 @@ \def\strc_itemgroups_setup_list_level_b#category#whatever#level% {\strc_itemgroups_normal_setup[#category:#level][\c!option={#whatever}]} +% \def\strc_itemgroups_setup_list#subcategories#category#whatever% +% {\doifelseassignment{#whatever} +% {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}} +% {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}}} + \def\strc_itemgroups_setup_list#subcategories#category#whatever% - {\doifelseassignment{#whatever} - {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}} - {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}}} + {\ifcondition\validassignment{#whatever}% + \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}% + \else + \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}% + \fi} \def\strc_itemgroups_increment_item_counter {\ifconditional\c_strc_itemgroups_sub \else @@ -762,7 +777,7 @@ \d_strc_itemgroups_list_width\d_strc_itemgroups_max_width \else\ifnum\itemgroupparameter\c!factor>\zerocount \d_strc_itemgroups_list_width\itemgroupparameter\c!step\relax - \ifdim\d_strc_itemgroups_list_width=\zeropoint \d_strc_itemgroups_list_width=.5em\fi + \ifzeropt\d_strc_itemgroups_list_width \d_strc_itemgroups_list_width=.5em\fi \multiply\d_strc_itemgroups_list_width \itemgroupparameter\c!factor \advance\d_strc_itemgroups_list_width\itemgroupparameter\c!width\relax \else @@ -786,9 +801,11 @@ \ifthirdargument \strc_itemgroups_start_indeed[#options][#settings]% \else\ifsecondargument - \doifelseassignment{#options} - {\strc_itemgroups_start_indeed[][#options]} - {\strc_itemgroups_start_indeed[#options][]}% + \ifcondition\validassignment{#options}% + \strc_itemgroups_start_indeed[][#options]% + \else + \strc_itemgroups_start_indeed[#options][]% + \fi \else \strc_itemgroups_start_indeed[][]% \fi\fi} @@ -856,11 +873,21 @@ \fi \fi % + \ifconditional\c_strc_itemgroups_pack + \ifnum\currentnofitems>\itemgroupparameter\c!packcriterium\relax\else + \setfalse\c_strc_itemgroups_pack + \fi + \fi + % \ifnum\c_strc_itemgroups_nesting=\plusone % NIEUW \doadaptleftskip {\itemgroupparameter\c!margin}% \doadaptleftskip {\itemgroupparameter\c!leftmargin}% \doadaptrightskip{\itemgroupparameter\c!rightmargin}% \fi + % + \doadaptleftskip {\itemgroupparameter\c!leftmargindistance}% + \doadaptrightskip{\itemgroupparameter\c!rightmargindistance}% + % \usealignparameter\itemgroupparameter \edef\m_strc_itemgroups_indenting{\itemgroupparameter\c!indenting}% \ifnum\c_strc_itemgroups_nesting>\zerocount @@ -1183,19 +1210,25 @@ \unexpanded\def\strc_itemgroups_stop_head_indeed {\removeunwantedspaces \dostoptagged - \ifconditional\c_strc_itemgroups_text - \space - \ignorespaces + \ifconditional\c_strc_itemgroups_inline_head + \space + \ignorespaces \else - \par - \fi - \strc_itemgroups_insert_breakno - \ifconditional\c_strc_itemgroups_pack\else\strc_itemgroups_after_head_command\fi - \strc_itemgroups_insert_breakno} + \ifconditional\c_strc_itemgroups_text + \space + \ignorespaces + \else + \par + \fi + \strc_itemgroups_insert_breakno + \ifconditional\c_strc_itemgroups_pack\else\strc_itemgroups_after_head_command\fi + \strc_itemgroups_insert_breakno + \fi} \unexpanded\def\strc_itemgroups_head_body_indeed {\dostarttagged\t!itembody\empty - \noindentation} + \noindentation + \ignorespaces} % Simple commands. @@ -1469,7 +1502,7 @@ \ifdim\d_strc_itemgroups_asked_width<\zeropoint\relax \strc_itemgroups_handle_lapped_item_negative \else - \ifdim\d_strc_itemgroups_asked_width=\zeropoint\relax + \ifzeropt\d_strc_itemgroups_asked_width \strc_itemgroups_calculate_list_width\plusone \else \strc_itemgroups_calculate_list_width\c_strc_itemgroups_nesting @@ -1763,6 +1796,8 @@ [\c!margin=\zeropoint, \c!leftmargin=\zeropoint, \c!rightmargin=\zeropoint, + \c!leftmargindistance=\zeropoint, + \c!rightmargindistance=\zeropoint, \c!indentnext=\v!yes, \c!width=1.5\emwidth, \c!factor=0, @@ -1797,6 +1832,7 @@ \c!lefttext=(, \c!righttext=), \c!start=1, + \c!packcriterium=\zerocount, \c!criterium=\v!all, % permits 0 and negative numbers %\c!option=, \c!textdistance=\v!space, % none big medium small <dimension> @@ -1820,4 +1856,26 @@ \defineitemgroup [\v!itemize] +%D This is really ugly I should get rid of the global mess, whuch is a side +%D effect of the simple \type {\item} interface that we're stuck with for +%D compatibility reasons. See footnotes for usage. It's probablynot robust +%D for mixed itemgroups so in the end I need to get rid of the globals. One +%D problem is that counters are set. + +\defineitemgroup + [\v!itemize:\v!note] + +\def\strc_itemgroups_push + {\edef\strc_itemgroups_pop + {\xdef\noexpand\currentitemlevel{\currentitemlevel}% + \global\c_strc_itemgroups_nesting \the\c_strc_itemgroups_nesting \relax + \global\c_strc_itemgroups_column_depth\the\c_strc_itemgroups_column_depth\relax}% + \global\c_strc_itemgroups_column_depth\zerocount + \global\c_strc_itemgroups_nesting \zerocount + \glet\currentitemlevel\!!zerocount + \unexpanded\def\startitemize{\startitemgroup[\v!itemize:\v!note]}% + \unexpanded\def\stopitemize {\stopitemgroup}} + +\let\strc_itemgroups_pop\relax + \protect \endinput |