From: Tomas Hala <tomas.hala@mendelu.cz>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: packed list only if items > 5
Date: Fri, 15 Nov 2019 00:04:03 +0100 [thread overview]
Message-ID: <20191114230354.GA28185@akela.mendelu.cz> (raw)
In-Reply-To: <9f573237-ae59-78d0-83c5-b887b2c62257@gmx.es>
Hi Pablo,
I am not sure if the itemize environment can be configured on the fly.
The following code should solve your problem:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecounter[minforpacked] \setcounter[minforpacked][5]
\def\mystartitemize#1\stopitemize{%
\definecounter[mycounter]
{\def\startitem##1\stopitem{\incrementcounter[mycounter]}#1}
\ifnum \rawcountervalue[mycounter]>\rawcountervalue[minforpacked] \setupitemize[packed]\fi
\startitemize#1\stopitemize}
\starttext
\mystartitemize %normal
\dorecurse{2}{\startitem text\stopitem}
\stopitemize
\thinrule
\mystartitemize %packed
\dorecurse{7}{\startitem text\stopitem}
\stopitemize
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Best wishes,
Tomáš
Thu, Nov 14, 2019 ve 09:07:21PM +0100 Pablo Rodriguez napsal(a):
# Dear list,
#
# I have the following sample:
#
# \starttext
# \startitemize[\ifnum\currentnofitems>5 packed\fi]
# \dorecurse{7}
# {\startitem\currentitemnumber/\currentnofitems\stopitem}
# \stopitemize
# \stoptext
#
# Is there any way to get a packed list if and only if it contains more
# than a given number of items?
#
# Many thanks for your help,
#
# Pablo
# --
# http://www.ousia.tk
# ___________________________________________________________________________________
# If your question is of interest to others as well, please add an entry to the Wiki!
#
# maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
# webpage : http://www.pragma-ade.nl / http://context.aanhet.net
# archive : https://bitbucket.org/phg/context-mirror/commits/
# wiki : http://contextgarden.net
# ___________________________________________________________________________________
Tomáš Hála
--------------------------------------------------------------------
Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno, tel. +420 545 13 22 28
--------------------------------------------------------------------
http://akela.mendelu.cz/~thala
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2019-11-14 23:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 20:07 Pablo Rodriguez
2019-11-14 23:04 ` Tomas Hala [this message]
2019-11-15 9:03 ` Hans Hagen
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=20191114230354.GA28185@akela.mendelu.cz \
--to=tomas.hala@mendelu.cz \
--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).