ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Creating List with separate numbering
@ 2003-04-15  9:03 Nigel King
  2003-04-15 16:34 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Nigel King @ 2003-04-15  9:03 UTC (permalink / raw)


Dear Contextnicians,
I would like a separate numbered list in this case called Problems. I have
created a small test file below. Unfortunately I cannot see how to get this
to number separately from section numbering. (I was not having any success
before using \definehead[Problems][section]


\definelist
    [Problems]
\definehead
    [Problems]
        [section]
\setuphead
    [Problems]
        [style=\ss\bf,color=red,before={\blank
        {\ss\bf\red Problem }},after={\qquad}]

\def\problem#1#2{{\par\Problems{#1}{\red #2}\par}}

\starttext
List of Problems\par\blank[big]
\placelist
    [Problems]
        [alternative=c,criterium=all,width=2em,interaction=all]
\blank[big]
\section{Tufte}
\input tufte
\problem{a first problem}{the first problem description}
\input tufte
\problem{a second problem}{second problem description}
\section{Another Tufte}
\stoptext

TIA
-- 
Nigel

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

* Re: Creating List with separate numbering
  2003-04-15  9:03 Creating List with separate numbering Nigel King
@ 2003-04-15 16:34 ` Hans Hagen
  2003-04-15 17:49   ` Nigel King
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2003-04-15 16:34 UTC (permalink / raw)


At 10:03 15/04/2003 +0100, you wrote:
>Dear Contextnicians,
>I would like a separate numbered list in this case called Problems. I have
>created a small test file below. Unfortunately I cannot see how to get this
>to number separately from section numbering. (I was not having any success
>before using \definehead[Problems][section]
>
>
>\definelist
>     [Problems]
>\definehead
>     [Problems]
>         [section]
>\setuphead
>     [Problems]
>         [style=\ss\bf,color=red,before={\blank
>         {\ss\bf\red Problem }},after={\qquad}]

          ^^^^^^^^^^^^^^^^^^^^^ that looks real messy -)


>\def\problem#1#2{{\par\Problems{#1}{\red #2}\par}}
>
>\starttext
>List of Problems\par\blank[big]
>\placelist
>     [Problems]
>         [alternative=c,criterium=all,width=2em,interaction=all]
>\blank[big]
>\section{Tufte}
>\input tufte
>\problem{a first problem}{the first problem description}
>\input tufte
>\problem{a second problem}{second problem description}
>\section{Another Tufte}
>\stoptext

one solution is to count yourself and feed that number into the section 
handler:

\setuphead[Problems][ownnumber=yes,expansion=yes]

\newcounter\NigelsProblem

\def\problem#1#2%
   {\par
    \doglobal\increment\NigelsProblem
    \Problems{\NigelsProblem}{#1}{\red #2}
    \par}

but ... this does not give you what you want because now your sections 
count on

% use a lower level head

\definehead
   [Problem]
   [subsubsubsection]

% cleaned up

\setuphead
   [Problem]
   [style=\ss\bf,
    color=red,
    before=\blank]

% use a label text

\setuplabeltext
   [Problem=Problems ]

% use your own numbers

\setuphead
   [Problem]
   [ownnumber=yes]

% increment and feed

\newcounter\NigelsProblem

\def\problem#1%
   {\doglobal\increment\NigelsProblem
    \Problem{\NigelsProblem}{#1}}

% nicer here

\setuplist
   [Problem]
   [alternative=c,
    criterium=all,
    width=2em,
    interaction=all]

% the test

\starttext

List of Problems

\blank[big] \placelist[Problem] \blank[big]

\section{Tufte}

\input tufte

\problem{a first problem}{the first problem description}

\section{Another Tufte}

\input tufte

\problem{a second problem}{second problem description}

\stoptext

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re: Creating List with separate numbering
  2003-04-15 16:34 ` Hans Hagen
@ 2003-04-15 17:49   ` Nigel King
  2003-04-15 19:33     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Nigel King @ 2003-04-15 17:49 UTC (permalink / raw)


> \definehead
>  [Problem]
>  [subsubsubsection]
Hans,
Thanks very much this does exactly as wanted. Luckily the real document only
goes to subsubsection!
-- 
Nigel

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

* Re: Creating List with separate numbering
  2003-04-15 17:49   ` Nigel King
@ 2003-04-15 19:33     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2003-04-15 19:33 UTC (permalink / raw)


At 18:49 15/04/2003 +0100, you wrote:
> > \definehead
> >  [Problem]
> >  [subsubsubsection]
>Hans,
>Thanks very much this does exactly as wanted. Luckily the real document only
>goes to subsubsection!

there are some 7 levels predefined but more are possible if needed, so 
subsubsubsubsub...

Hans


-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

end of thread, other threads:[~2003-04-15 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15  9:03 Creating List with separate numbering Nigel King
2003-04-15 16:34 ` Hans Hagen
2003-04-15 17:49   ` Nigel King
2003-04-15 19:33     ` 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).