From: Hans Hagen <pragma@wxs.nl>
Subject: Re: enumerated lists
Date: Fri, 08 Jul 2005 10:05:00 +0200 [thread overview]
Message-ID: <42CE33AC.5030505@wxs.nl> (raw)
In-Reply-To: <42CD9142.2070801@gmail.com>
Mojca Miklavec wrote:
> Frank Grieshaber wrote:
>
>> Hello all (esp. the ConTeXt-Developers),
>>
>> some time ago I sent the following email to this list and got no reply
>> so I'm resending it.
>>
>> Is there any possibility that this feature will be part of the
>> next/one of the next ConTeXt-versions?
>>
>> Frank
>
>
> I'm affraid that despite the huge amount of features that "itemize"
> offers, it should be rewritten one day. Sometimes it doesn't really work
> as expected (some comments can be found in my post
> "\setupitemize[packed,paragraph]") and the features you are mentioning
> here are missing, although they would be sensible.
>
>>> Dear all,
>>> I have a manuscript with long nested numbered enumerations and I want
>>> the numbers of all levels to be printed automatically like:
>>>
>>> 1. one
>>> 1.1 one-one
>>> 1.2 one-two
>>> 2. two
>>> 2.1 two-one
>>> 2.2.1 two-two-one
>>> ...
>>>
>>> Using the following prints only the current level's number, not all
>>> levels:
>>>
>>> \startitemize[n,packed]
>>> \item
>>> \item
>>> \startitemize[m,packed]
>>> \item
>>> \item
>>> \stopitemize
>>> \item
>>> \item
>>> \stopitemize
> PS: But once again - If anyone will be reading this post in the mail
> archive: please, don't use this trick!!! Please check first if this
> feature has been added in the meantime.
sorry for being mean again ...
% copy this into cont-new.tex
\unprotect
\def\dododosetupitemgroupconstant[#1][#2#3#4]% * permits [2]
{\processaction
[#2#3#4]
[ \v!packed*=>\packitems,
\v!intro*=>\itemintrotrue,
\v!autointro*=>\autoitemintrotrue,
\v!broad*=>\setitemparameter{#1}\c!factor{1},
#2#3*\v!broad*=>\setitemparameter{#1}\c!factor{#2#3},
#2*\v!broad*=>\setitemparameter{#1}\c!factor{#2},
\v!text*=>\textitemstrue
\settrue\inlinelistitem
\dosetuppackeditemgroup{#1}%
\packitems,
\v!columns*=>\packitems,
\v!margin*=>\setitemparameter{#1}\c!width{-2em}, % signal
\v!inmargin*=>\setitemparameter{#1}\c!width{-2em}, % signal
\v!atmargin*=>\doifnot{#1}{1}{\setitemparameter{#1}\c!width{0em}}, % signal
\v!intext*=>\settrue\inlinelistitem, % new
\v!loose*=>\optimizeitemsfalse,
\v!paragraph*=>\paragraphitemstrue
\packitems,
\v!joinedup*=>\dosetuppackeditemgroup{#1}%
\packitems,
\v!serried*=>\setitemparameter{#1}\c!factor{-1},
#2#3*\v!serried*=>\setitemparameter{#1}\c!factor{-#2#3},
#2*\v!serried*=>\setitemparameter{#1}\c!factor{-#2},
\v!stopper*=>\setitemparameter{#1}\c!placestopper\v!yes,
\v!unpacked*=>\packeditemsfalse,
\v!repeat*=>\settrue\repeatlistitem, % new
\v!standard*=>\dosetupstandarditemgroup{#1}]}
\def\dolistitem % evt aantal items opslaan per niveau, scheelt zoeken
{\iftextitems
% begin of item
\else
\par
\fi
\ignorespaces
\increment\noflistelements
\ifnum\itemcolumndepth=\zerocount \ifoptimizeitems
\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
\ifitemintro
\doitembreak\nobreak
\else
\doitembreak\itemnobreak
\fi
\else\ifnum\twopassdata=\noflistelements\relax
\doitembreak\itemnobreak
\else\ifnum\noflistelements>2
\doitembreak\itembreak
\else
\ifitemintro\else\doitembreak\itembreak\fi
\fi\fi\fi
\fi\fi
\fi
\fi\fi
\noindent
\setbox8\hbox
{\ifheaditem
\doitemattributes\itemlevel\c!headstyle\c!headcolor{\listitem}%
\else\ifsymbolitem
\symsymbol
\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{\ifsubitem\llap{+}\fi\box8\hskip\leftmargindistance}%
\else
\ifdim\dimen2=\zeropoint\relax
\calculatelistwidth1{\dimen0}%
\else
\calculatelistwidth\itemlevel{\dimen0}%
\fi
\iftextitems
\hbox{\ifsubitem+\fi\box8\hskip\fontdimen2\font}\nobreak
\else
\ifconditional\inlinelistitem
\hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}%
\else
% todo: align+marge binnen de hbox
\llap{\hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}}%
\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
\headitemfalse
\subitemfalse
\symbolitemfalse
\EveryPar{\ignorespaces}%
\ignorespaces}
\newconditional\repeatlistitem
\def\checkforrepeatedlistitem
{\ifnum\itemlevel=\plusone \ifnum\itemlevel=\plusone
\initializeboxstack{item}%
\fi \fi
\ifconditional\repeatlistitem
\savebox{item}{\itemlevel}{\hbox{\ifnum\itemlevel>\plusone \copy8\else\fi}}%
\setbox8\hbox
{\setbox\scratchbox\hbox{\foundbox{item}{\itemlevel}}%
\ifnum\itemlevel>\plusone
\hskip-\wd\scratchbox
\ifnum\countervalue{\@@itemcounter\itemlevel}>\plusone
\llap{\box\scratchbox}%
\fi
\fi
\box8}%
\fi}
\protect
% end of copy
\starttext
\startitemize[n,packed]
\item test
\item
\startitemize[m,packed,repeat]
\item test
\item test
\stopitemize
\item test
\item
\startitemize[m,packed]
\item test
\item test
\stopitemize
\stopitemize
\stoptext
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
next prev parent reply other threads:[~2005-07-08 8:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-01 19:40 Frank Grieshaber
2005-07-07 7:31 ` Frank Grieshaber
2005-07-07 8:15 ` Taco Hoekwater
2005-07-07 20:32 ` Mojca Miklavec
2005-07-08 8:05 ` Hans Hagen [this message]
2005-07-08 12:13 ` Radhelorn
2005-08-04 18:14 ` Brooks Moses
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=42CE33AC.5030505@wxs.nl \
--to=pragma@wxs.nl \
--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).