ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Radhelorn <radhelorn@mail.ru>
Subject: Re: About 'repeat' option of \startitemize
Date: Wed, 04 Jan 2006 22:12:48 +0300	[thread overview]
Message-ID: <43BC1E30.3000501@mail.ru> (raw)
In-Reply-To: <43AB1D82.9000205@mail.ru>

[-- 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

      reply	other threads:[~2006-01-04 19:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21  8:29 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43BC1E30.3000501@mail.ru \
    --to=radhelorn@mail.ru \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).