ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
Subject: Re: Suitable mechanism for Theorems and Definitions
Date: Thu, 25 Aug 2005 12:07:56 +0200	[thread overview]
Message-ID: <430D987C.7030806@elvenkind.com> (raw)
In-Reply-To: <20050824204007.GA2195@erik.fi.muni.cz>


Hi David,

Not sure if you are still interested, but here is my "optional title"
hack, revamped for a modern context distro. It creates a second
extra optional argument for the enumeration, nothing too fancy.
The example also shows a way in which you can access the number.

This does not solve the list generation, sorry.

Cheers, Taco

%===========

\unprotect
\def\dododefinecomplexenumeration#1#2#3%
   {\setvalue{\e!start#1#2}%
      {\@EA\dodoubleempty\csname dostart#1#2\endcsname}%
    \setvalue{dostart#1#2}[##1][##2]%
      {\begingroup\setvalue{#2title}{##2}\getvalue{\e!start#1i#2}[##1]}%
    \setvalue{\e!stop#1#2}{\getvalue{\e!stop#1i#2}\endgroup}}

\def\dodefinecomplexenumeration[#1][#2]%
   {\defineenumeration[i#1]
       [\c!text=#1,\c!stopper=\getvalue{do#1title},#2]%
    \setvalue{do#1title}%
       {\doifnotemptyvalue{#1title}{~(\getvalue{#1title})}}%
    \dododefinecomplexenumeration{}{#1}{#2}%
    \dododefinecomplexenumeration{\v!sub}{#1}{#2}%
    \dododefinecomplexenumeration{\v!sub\v!sub}{#1}{#2}%
    \dododefinecomplexenumeration{\v!sub\v!sub\v!sub}{#1}{#2}}

\def\definecomplexenumeration{\dodoubleempty\dodefinecomplexenumeration}

\protect

\definecomplexenumeration[lemma]

\starttext

\startlemma[lemma1][with a title]
This is lemma \rawnumber[\currentdescriptionnumber]
\stoplemma

\startsublemma[sublemma1][with another title]
This is sublemma \rawnumber[sub\currentdescriptionnumber]
\stopsublemma

\stoptext

%==============


David Antos wrote:
> On Wed, Aug 24, 2005 at 10:01:44PM +0200, Rob Ermers wrote:
> 
>>In David's mail I found one of the problem I had been thinking of too, 
>>and I tried his code. Unfortionately, it does not work.
>>
> 
> ...
> 
>>A case consists of the following elements:
>>
>>Case 1    Eating fruit is healthy
>>Text text text - case description --
> 
> 
> Hi,
> 
> I've sent Rob my style file in full, the excerpt in the mail was not
> indended to run, only as a demonstration of the idea. (If anyone wants to
> share my styles and hacks, I'll eventually publish it on the Wiki. It is
> now quite unstable but I have quite brute-force macros to typeset
> algorithms. Ugly but suits me fine :-)
> 
> I'm pretty sure that Rob's "case descriptions" are completely the same as
> my named theorems, at least in terms of macro mechanisms needed.
> 
> BTW, does anyone know the correct way to obtain current description
> generated number? Just asking again... ;-)
> 
> D.A.
> 

  reply	other threads:[~2005-08-25 10:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-19  9:48 David Antos
2005-08-21 12:27 ` David Antos
2005-08-21 15:43   ` Taco Hoekwater
2005-08-21 16:22     ` David Antos
2005-08-24 20:01       ` Rob Ermers
2005-08-24 20:40         ` David Antos
2005-08-25 10:07           ` Taco Hoekwater [this message]
2005-08-25 20:38             ` David Antos
2005-08-29 21:26             ` Hans Hagen Outside

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=430D987C.7030806@elvenkind.com \
    --to=taco@elvenkind.com \
    --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).