ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Creating List with separate numbering
Date: Tue, 15 Apr 2003 18:34:51 +0200	[thread overview]
Message-ID: <5.2.0.9.1.20030415183153.014d9b80@server-1> (raw)
In-Reply-To: <BAC18971.F9DA%king@dircon.co.uk>

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

  reply	other threads:[~2003-04-15 16:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-15  9:03 Nigel King
2003-04-15 16:34 ` Hans Hagen [this message]
2003-04-15 17:49   ` Nigel King
2003-04-15 19:33     ` 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=5.2.0.9.1.20030415183153.014d9b80@server-1 \
    --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).