ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* packed list only if items > 5
@ 2019-11-14 20:07 Pablo Rodriguez
  2019-11-14 23:04 ` Tomas Hala
  2019-11-15  9:03 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Rodriguez @ 2019-11-14 20:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: packed list only if items > 5
  2019-11-14 20:07 packed list only if items > 5 Pablo Rodriguez
@ 2019-11-14 23:04 ` Tomas Hala
  2019-11-15  9:03 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Tomas Hala @ 2019-11-14 23:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: packed list only if items > 5
  2019-11-14 20:07 packed list only if items > 5 Pablo Rodriguez
  2019-11-14 23:04 ` Tomas Hala
@ 2019-11-15  9:03 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2019-11-15  9:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 11/14/2019 9:07 PM, Pablo Rodriguez wrote:
> 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?

It could be some option (but as there is an underlying changed needed i 
want to discuss it with WS first, as we don't want compatibility 
issues), think of something:

\startitemize[packed][packcriterium=5]
     \dorecurse{7}{\startitem\currentitemnumber/\currentnofitems\stopitem}
\stopitemize



Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-15  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 20:07 packed list only if items > 5 Pablo Rodriguez
2019-11-14 23:04 ` Tomas Hala
2019-11-15  9:03 ` Hans Hagen

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).