* About 'repeat' option of \startitemize
@ 2005-12-21 8:29 Radhelorn
2005-12-21 13:17 ` Hans Hagen
0 siblings, 1 reply; 8+ messages in thread
From: Radhelorn @ 2005-12-21 8:29 UTC (permalink / raw)
Hello All!
A while ago Hans introduced 'repeat' option for \startitemize to make
nested items. I've decided to give it a try:
\startitemize[repeat]
\item item1
\startitemize
\item item1.1
\item item1.2
\item item1.3
\stopitemize
\item
\startitemize
\item item2.1
\item item2.2
\item item2.3
\item item2.4
\stopitemize
\stopitemize
gives:
1. item1
1. item1.1
2.2. item1.2
3.3. item1.3
2.1. item2.1
2.2. item2.2
3.3. item2.3
4.4. item2.4
should:
1. item1
1.1. item1.1
1.2. item1.2
1.3. item1.3
2.1. item2.1
2.2. item2.2
2.3. item2.3
2.4. item2.4
From my observations of mysterious box manipulations in core-itm I
think that fix for repeating first digit can be as simple as removing
one of these \plusone's somewhere. But it is possible to make both 1.1
and 2.1 work as in my example?
And it seems that space after dot in nested lists is slightly bigger. Is
this intentional?
--
Radhelorn <radhelorn@mail.ru>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-21 8:29 About 'repeat' option of \startitemize Radhelorn
@ 2005-12-21 13:17 ` Hans Hagen
2005-12-21 17:29 ` Radhelorn
0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2005-12-21 13:17 UTC (permalink / raw)
Radhelorn wrote:
> Hello All!
> A while ago Hans introduced 'repeat' option for \startitemize to make
> nested items. I've decided to give it a try:
next time give it a try when i just made it; it took some time to figure
out what was wrong (rather tricky code)
\unprotect
\def\checkforrepeatedlistitem
{\ifnum\itemlevel=\plusone
\initializeboxstack{item}%
\fi
\ifconditional\repeatlistitem
\savebox{item}{\itemlevel}{\hbox{\copy8}}%
\setbox8\hbox to \wd8
{\setbox\scratchbox\hbox
{\scratchcounter\itemlevel
\advance\scratchcounter\minusone
\dorecurse\scratchcounter{\foundbox{item}{\recurselevel}}}%
\ifnum\itemlevel>\plusone
\ifdim\wd\scratchbox>\zeropoint
\hskip-\dimen2
\box\scratchbox
\fi
\fi
\box8 }%
\fi}
\showframe
\starttext
\startbuffer
\item
\startitemize[n]
\item item 1.1
\item item 1.2
\startitemize[n]
\item item 1.2.1
\item item 1.2.2
\stopitemize
\item item 1.3
\stopitemize
\item
\startitemize[n]
\item item 2.1
\item item 2.2
\stopitemize
\item item 3
\startitemize[n]
\item item 3.1
\item item 3.2
\stopitemize
\item
\startitemize[n]
\item item 4.1
\item item 4.2
\stopitemize
\stopbuffer
\startitemize[n,repeat,6*broad,packed]
\getbuffer
\stopitemize
\blank[3*big]
\startitemize[n,repeat,packed]
\getbuffer
\stopitemize
\blank[3*big]
\setupitemize[each][atmargin][width=3em]
\startitemize[n,repeat,packed]
\getbuffer
\stopitemize
\stoptext
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-21 13:17 ` Hans Hagen
@ 2005-12-21 17:29 ` Radhelorn
2005-12-21 18:06 ` Hans Hagen
0 siblings, 1 reply; 8+ messages in thread
From: Radhelorn @ 2005-12-21 17:29 UTC (permalink / raw)
Hans Hagen wrote:
> Radhelorn wrote:
>
>> Hello All!
>> A while ago Hans introduced 'repeat' option for \startitemize to make
>> nested items. I've decided to give it a try:
>
>
> next time give it a try when i just made it; it took some time to figure
> out what was wrong (rather tricky code)
>
Thanks! Soon you will be fixing bugs even earlier than we will be
noticing them!
But there is another problem. When using itemize without repeat option
indentation is right, but with this option indentation (both before
number and after number) of nested items is different for different levels:
1. item
1.1 item
1.2.1 item
1.2.1.1.item
1.2.2.1em
Something needs to be done with this, but I'm afraid that this will
complicate macros even more.
--
Radhelorn <radhelorn@mail.ru>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-21 17:29 ` Radhelorn
@ 2005-12-21 18:06 ` Hans Hagen
2005-12-22 20:49 ` Radhelorn
0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2005-12-21 18:06 UTC (permalink / raw)
Radhelorn wrote:
> Hans Hagen wrote:
>
>> Radhelorn wrote:
>>
>>> Hello All!
>>> A while ago Hans introduced 'repeat' option for \startitemize to
>>> make nested items. I've decided to give it a try:
>>
>>
>>
>> next time give it a try when i just made it; it took some time to
>> figure out what was wrong (rather tricky code)
>>
>
> Thanks! Soon you will be fixing bugs even earlier than we will be
> noticing them!
>
> But there is another problem. When using itemize without repeat option
> indentation is right, but with this option indentation (both before
> number and after number) of nested items is different for different
> levels:
>
> 1. item
> 1.1 item
> 1.2.1 item
> 1.2.1.1.item
> 1.2.2.1em
>
for that you can best set up a dedicated instance of itemize
(defineitemgroup) and assign the right widths to the levels
Hans
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-21 18:06 ` Hans Hagen
@ 2005-12-22 20:49 ` Radhelorn
2005-12-22 21:10 ` Hans Hagen
0 siblings, 1 reply; 8+ messages in thread
From: Radhelorn @ 2005-12-22 20:49 UTC (permalink / raw)
Hans Hagen wrote:
>> Radhelorn wrote:
>>
>> 1. item
>> 1.1 item
>> 1.2.1 item
>> 1.2.1.1.item
>> 1.2.2.1em
>>
> for that you can best set up a dedicated instance of itemize
> (defineitemgroup) and assign the right widths to the levels
>
I'm sorry to disturb you with my endless requests but it seems that
options of itemgroups is not interact properly.
I've tried as you suggested this way:
\defineitemgroup[myitemize]
\setupitemgroup[myitemize][n,width=4em]
\startmyitemize
\item item 1
\item item 2
\stopmyitemize
It gives many "missing or ungrouped '=' after 'n'" messages and changes
item symbol to default dot. I've also tried n=1 or n=2 (seen in the
sources). This gives same result, but without error message.
Thanks for your patience.
--
Radhelorn <radhelorn@mail.ru>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-22 20:49 ` Radhelorn
@ 2005-12-22 21:10 ` Hans Hagen
2005-12-22 21:41 ` Radhelorn
0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2005-12-22 21:10 UTC (permalink / raw)
Radhelorn wrote:
> Hans Hagen wrote:
>
>>> Radhelorn wrote:
>>>
>>> 1. item
>>> 1.1 item
>>> 1.2.1 item
>>> 1.2.1.1.item
>>> 1.2.2.1em
>>>
>> for that you can best set up a dedicated instance of itemize
>> (defineitemgroup) and assign the right widths to the levels
>>
> I'm sorry to disturb you with my endless requests but it seems that
> options of itemgroups is not interact properly.
>
> I've tried as you suggested this way:
>
> \defineitemgroup[myitemize]
> \setupitemgroup[myitemize][n,width=4em]
\setupitemgroup[myitemize][each][width=4em]
\setupitemgroup[myitemize][each][n]
>
> \startmyitemize
> \item item 1
> \item item 2
> \stopmyitemize
>
> It gives many "missing or ungrouped '=' after 'n'" messages and
> changes item symbol to default dot. I've also tried n=1 or n=2 (seen
> in the sources). This gives same result, but without error message.
>
> Thanks for your patience.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-22 21:10 ` Hans Hagen
@ 2005-12-22 21:41 ` Radhelorn
2006-01-04 19:12 ` Radhelorn
0 siblings, 1 reply; 8+ messages in thread
From: Radhelorn @ 2005-12-22 21:41 UTC (permalink / raw)
Hans Hagen wrote:
>>
>> \defineitemgroup[myitemize]
>> \setupitemgroup[myitemize][n,width=4em]
>
>
> \setupitemgroup[myitemize][each][width=4em]
> \setupitemgroup[myitemize][each][n]
>
>
Thanks. This will do for a time. Actually I have another observation in
behaviour of 'repeat' option but will try to experiment with this a
little more. This itm module is too elaborate.
--
Radhelorn <radhelorn@mail.ru>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: About 'repeat' option of \startitemize
2005-12-22 21:41 ` Radhelorn
@ 2006-01-04 19:12 ` Radhelorn
0 siblings, 0 replies; 8+ messages in thread
From: Radhelorn @ 2006-01-04 19:12 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
Radhelorn wrote:
> I have another observation in
> behaviour of 'repeat' option but will try to experiment with this a
> little more. This itm module is too elaborate.
>
After Taco's t-itmfix I've came up with my own little fix. Please observe.
--
Radhelorn <radhelorn@mail.ru>
[-- Attachment #2: rptfix.tex --]
[-- Type: text/x-tex, Size: 3987 bytes --]
\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
\doitembreak\itemnobreak
\fi
\else\ifnum\twopassdata>3
\ifnum\noflistelements=2
\ifconditional\introlistitem
\doitembreak\nobreak
\else
\doitembreak\itemnobreak
\fi
\else\ifnum\twopassdata=\noflistelements\relax
\doitembreak\itemnobreak
\else\ifnum\noflistelements>2
\doitembreak\itembreak
\else
\ifconditional\introlistitem\else\doitembreak\itembreak\fi
\fi\fi\fi
\fi\fi
\fi
\fi\fi
\noindent
\setbox8\hbox
{\ifconditional\headlistitem
\ifconditional\symbollistitem
\symsymbol
\else
\doitemattributes\itemlevel\c!headstyle\c!headcolor{\listitem}%
\fi
\else
\ifconditional\symbollistitem
\symsymbol % no attributes, why?
\else
\doitemattributes\itemlevel\c!style\c!color{\listitem}%
\fi
\fi}%
\doifsomething\somdestination
{\setbox8\hbox{\goto{\box8}[\somdestination]}}%
\globallet\somdestination\empty
\dimen2=\getitemparameter\itemlevel\c!width\relax
% new, prevents loops when symbol is (not yet found) graphic
\ht8=\strutheight
\dp8=\strutdepth
% so that content differs per run (esp mp graphics afterwards)
\checkforrepeatedlistitem
\ifdim\dimen2<\zeropoint\relax
\llap{\ifconditional\sublistitem\llap{+}\fi\box8\hskip\leftmargindistance}%
\else
\ifdim\dimen2=\zeropoint\relax
\calculatelistwidth1{\dimen0}%
\else
\calculatelistwidth\itemlevel{\dimen0}%
\fi
\ifconditional\textlistitem
\hbox{\ifconditional\sublistitem+\fi\box8\hskip\fontdimen2\font}\nobreak
\else\ifconditional\inlinelistitem
\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}%
\else\ifconditional\txtlistitem
\dodotxtitem
% \hskip-\dimen0 this makes them touch
\else
% todo: align+marge binnen de hbox
\llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi\box8\hfill}}%
\hskip\fullwidth % added for 'repeat' option fix
\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
\resetunexpanded
\setfalse\headlistitem
\setfalse\sublistitem
\setfalse\symbollistitem
\EveryPar{\ignorespaces}% needed ?
\ignorespaces}
% I don't think this is the best way but it will require minimal
% change to the original sources.
\def\checkforrepeatedlistitem
{\global\newdimen\fullwidth
\ifnum\itemlevel=\plusone
\initializeboxstack{item}%
\fi
\ifconditional\repeatlistitem
\savebox{item}{\itemlevel}{\hbox{\copy8}}%
\setbox8\hbox to \wd8
{\setbox\scratchbox\hbox
{\scratchcounter\itemlevel
\advance\scratchcounter\minusone
\dorecurse\scratchcounter{\foundbox{item}{\recurselevel}}}%
\ifnum\itemlevel>\plusone
\ifdim\wd\scratchbox>\zeropoint
%\hskip-\dimen2
\global\advance\fullwidth\wd\scratchbox
\box\scratchbox
\fi
\fi
\box8}%
\fi}
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-01-04 19:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-21 8:29 About 'repeat' option of \startitemize Radhelorn
2005-12-21 13:17 ` Hans Hagen
2005-12-21 17:29 ` Radhelorn
2005-12-21 18:06 ` Hans Hagen
2005-12-22 20:49 ` Radhelorn
2005-12-22 21:10 ` Hans Hagen
2005-12-22 21:41 ` Radhelorn
2006-01-04 19:12 ` Radhelorn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).