ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Help watned for numbered descriptions
@ 2009-11-30 14:15 Otared Kavian
  2009-11-30 16:49 ` Hans Hagen
  2009-11-30 17:27 ` Aditya Mahajan
  0 siblings, 2 replies; 7+ messages in thread
From: Otared Kavian @ 2009-11-30 14:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I need help for the following situation: in a maths paper I would like to have Definitions, Lemmas, Theorems, etc, numbered in a sequential way in each section if any, the numbers being set before the header, and also to be able to refer to them through cross references. For instance, when there is indeed at least a section, in section 1, I would like to have something like

	1.1 Definition. Here is the text of the definition in slanted style.
	… some text…
	1.2 Lemma. Here is the text of the lemma  in slanted style.
	…some text…
	1.3 Theorem. Here is the text of the theorem  in slanted style.
	…some text…
	1.4 Corollary. Here is the text of the corollary  in slanted style.

And if there is no section at all:

	1. Definition. Here is the text of the definition  in slanted style.
	… some text…
	2. Lemma. Here is the text of the lemma  in slanted style.
	…some text…
	3. Theorem. Here is the text of the theorem  in slanted style.
	…some text…
	4. Corollary. Here is the text of the corollary  in slanted style.

One way would be to define 4 descriptions or enumerations with 
\definedescription or \defineenumeration
but then I don't know how to have numbers incremented in a sequential way in all these descriptions. 
Another issue with this approach would be that then if one wants to have for example a Conjecture or a Guess, one has to define a new description or enumeration.

Has anyone run into such a situation?

The example below shows what I need to do (but actually I wasn't able to add the section number as a prefix to the number…).
Best regards: OK

%%%% begin
\newcounter\Lemmacount
\setcounter\Lemmacount1
\def\Lemmanumber%
   {\global\increment\Lemmacount
    {\bf \Lemmacount.~}}
    
\def\startLemma#1%
   {\blank \Lemmanumber~{\bf #1.} \start\sl}
\def\stopLemma%
   {\blank \stop}

\starttext
Some text before the numbered descriptions start.

\startLemma{Definition}
This is the first numbered definition; it's short.
\stopLemma

Here some more text\dots and then a lemma:

\startLemma{Lemma}
This is another numbered definition.  It's long enough to wrap around onto
more than one line, so as to show that these can be numbered and contain as well blank lines and formulas
\startformula
a^2 + b^2 = c^2
\stopformula
And some comment after the formula.
\stopLemma

And here is the remainder of the text\dots
\stoptext
%%%% end
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 14:15 Help watned for numbered descriptions Otared Kavian
@ 2009-11-30 16:49 ` Hans Hagen
  2009-11-30 17:27 ` Aditya Mahajan
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2009-11-30 16:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Otared Kavian wrote:
> Hi all,
> 
> I need help for the following situation: in a maths paper I would like to have Definitions, Lemmas, Theorems, etc, numbered in a sequential way in each section if any, the numbers being set before the header, and also to be able to refer to them through cross references. For instance, when there is indeed at least a section, in section 1, I would like to have something like
> 
> 	1.1 Definition. Here is the text of the definition in slanted style.
> 	… some text…
> 	1.2 Lemma. Here is the text of the lemma  in slanted style.
> 	…some text…
> 	1.3 Theorem. Here is the text of the theorem  in slanted style.
> 	…some text…
> 	1.4 Corollary. Here is the text of the corollary  in slanted style.
> 
> And if there is no section at all:
> 
> 	1. Definition. Here is the text of the definition  in slanted style.
> 	… some text…
> 	2. Lemma. Here is the text of the lemma  in slanted style.
> 	…some text…
> 	3. Theorem. Here is the text of the theorem  in slanted style.
> 	…some text…
> 	4. Corollary. Here is the text of the corollary  in slanted style.
> 
> One way would be to define 4 descriptions or enumerations with 
> \definedescription or \defineenumeration
> but then I don't know how to have numbers incremented in a sequential way in all these descriptions. 
> Another issue with this approach would be that then if one wants to have for example a Conjecture or a Guess, one has to define a new description or enumeration.
> 
> Has anyone run into such a situation?

is quite trivial but there is an inheritance bug in mkiv so more later


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 14:15 Help watned for numbered descriptions Otared Kavian
  2009-11-30 16:49 ` Hans Hagen
@ 2009-11-30 17:27 ` Aditya Mahajan
  2009-11-30 18:34   ` Otared Kavian
  1 sibling, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2009-11-30 17:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 30 Nov 2009, Otared Kavian wrote:

> Another issue with this approach would be that then if one wants to have 
> for example a Conjecture or a Guess, one has to define a new description 
> or enumeration.

One way around this is the following.

\defineenumeration[proclaim][text=,style=slanted,title=yes,titleleft=,titleright=,location=serried,width=fit]

and then

\startproclaim{Definition}
..
\stopproclaim

etc.


Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 17:27 ` Aditya Mahajan
@ 2009-11-30 18:34   ` Otared Kavian
  2009-11-30 21:29     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Otared Kavian @ 2009-11-30 18:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans, Aditya,

Many thanks for your attention: the solution suggested by Aditya is very satisfactory for the time being, as far as one uses mkii.
I added an entry on the wiki about proclaim:

	http://wiki.contextgarden.net/proclaim

However, as Hans says, there is a slight problem with mkiv and the way things get numbered.

Best regards: OK

On 30 nov. 2009, at 18:27, Aditya Mahajan wrote:

> On Mon, 30 Nov 2009, Otared Kavian wrote:
> 
>> Another issue with this approach would be that then if one wants to have for example a Conjecture or a Guess, one has to define a new description or enumeration.
> 
> One way around this is the following.
> 
> \defineenumeration[proclaim][text=,style=slanted,title=yes,titleleft=,titleright=,location=serried,width=fit]
> 
> and then
> 
> \startproclaim{Definition}
> ..
> \stopproclaim
> 
> etc.
> 
> 
> Aditya
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 18:34   ` Otared Kavian
@ 2009-11-30 21:29     ` Hans Hagen
  2009-12-01  5:10       ` Otared Kavian
  2009-12-03 18:31       ` Otared Kavian
  0 siblings, 2 replies; 7+ messages in thread
From: Hans Hagen @ 2009-11-30 21:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Otared Kavian wrote:
> Hi Hans, Aditya,
> 
> Many thanks for your attention: the solution suggested by Aditya is very satisfactory for the time being, as far as one uses mkii.
> I added an entry on the wiki about proclaim:
> 
> 	http://wiki.contextgarden.net/proclaim
> 
> However, as Hans says, there is a slight problem with mkiv and the way things get numbered.

i uploaded a beta

\defineenumeration[one]
\defineenumeration[two]   [one] % clone one
\defineenumeration[three] [counter=one,style=slanted] % only use counter 
of one
\defineenumeration[four]  [three] % clone three
\defineenumeration[five]  [three] [counter=five] % clone three and use 
own counter
\defineenumeration[six]   [three] [counter=four] % clone tree and use 
counter four (undefined)

\setupenumerations[one]  [prefix=yes,prefixsegments=section]
\setupenumerations[two]  [prefix=yes,prefixsegments=section]
\setupenumerations[three][prefix=yes,prefixsegments=section]
\setupenumerations[four] [prefix=yes,prefixsegments=chapter:section]
\setupenumerations[five] [prefix=yes,prefixsegments=chapter:section]
\setupenumerations[six]  [prefix=yes,prefixsegments=chapter:section]

\starttext

\chapter{test}

\startone   test test  1 \stopone
\starttwo   test test  2 \stoptwo
\startthree test test  3 \stopthree
\startfour  test test  4 \stopfour
\startfive  test test  1 \stopfive
\startsix   test test  1 \stopsix

\chapter{test}

\section{test}

\startone   test test  6 \stopone
\starttwo   test test  7 \stoptwo
\startthree test test  8 \stopthree
\startfour  test test  9 \stopfour
\startfive  test test  2 \stopfive
\startsix   test test  2 \stopsix

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 21:29     ` Hans Hagen
@ 2009-12-01  5:10       ` Otared Kavian
  2009-12-03 18:31       ` Otared Kavian
  1 sibling, 0 replies; 7+ messages in thread
From: Otared Kavian @ 2009-12-01  5:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

Thanks for your insight! Your solution works very well with the new beta mkiv (ConTeXt version 2009.11.30 22:20).

I'll add a note on proclaim and enumerations on the wiki (not today though…).

Best regards: OK

On 30 nov. 2009, at 22:29, Hans Hagen wrote:

> Otared Kavian wrote:
>> Hi Hans, Aditya,
>> Many thanks for your attention: the solution suggested by Aditya is very satisfactory for the time being, as far as one uses mkii.
>> I added an entry on the wiki about proclaim:
>> 	http://wiki.contextgarden.net/proclaim
>> However, as Hans says, there is a slight problem with mkiv and the way things get numbered.
> 
> i uploaded a beta
> 
> \defineenumeration[one]
> \defineenumeration[two]   [one] % clone one
> \defineenumeration[three] [counter=one,style=slanted] % only use counter of one
> \defineenumeration[four]  [three] % clone three
> \defineenumeration[five]  [three] [counter=five] % clone three and use own counter
> \defineenumeration[six]   [three] [counter=four] % clone tree and use counter four (undefined)
> 
> \setupenumerations[one]  [prefix=yes,prefixsegments=section]
> \setupenumerations[two]  [prefix=yes,prefixsegments=section]
> \setupenumerations[three][prefix=yes,prefixsegments=section]
> \setupenumerations[four] [prefix=yes,prefixsegments=chapter:section]
> \setupenumerations[five] [prefix=yes,prefixsegments=chapter:section]
> \setupenumerations[six]  [prefix=yes,prefixsegments=chapter:section]
> 
> \starttext
> 
> \chapter{test}
> 
> \startone   test test  1 \stopone
> \starttwo   test test  2 \stoptwo
> \startthree test test  3 \stopthree
> \startfour  test test  4 \stopfour
> \startfive  test test  1 \stopfive
> \startsix   test test  1 \stopsix
> 
> \chapter{test}
> 
> \section{test}
> 
> \startone   test test  6 \stopone
> \starttwo   test test  7 \stoptwo
> \startthree test test  8 \stopthree
> \startfour  test test  9 \stopfour
> \startfive  test test  2 \stopfive
> \startsix   test test  2 \stopsix
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                             | 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Help watned for numbered descriptions
  2009-11-30 21:29     ` Hans Hagen
  2009-12-01  5:10       ` Otared Kavian
@ 2009-12-03 18:31       ` Otared Kavian
  1 sibling, 0 replies; 7+ messages in thread
From: Otared Kavian @ 2009-12-03 18:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I put the solution given by Hans on the wiki under the keyword « proclaim » but didn't know how to make a cross link between this entry and other relevant entries such as \defineenumeration.
Here is the link:
	http://wiki.contextgarden.net/proclaim

Best regards: OK

On 30 nov. 2009, at 22:29, Hans Hagen wrote:

> Otared Kavian wrote:
>> Hi Hans, Aditya,
>> Many thanks for your attention: the solution suggested by Aditya is very satisfactory for the time being, as far as one uses mkii.
>> I added an entry on the wiki about proclaim:
>> 	http://wiki.contextgarden.net/proclaim
>> However, as Hans says, there is a slight problem with mkiv and the way things get numbered.
> 
> i uploaded a beta
> 
> \defineenumeration[one]
> \defineenumeration[two]   [one] % clone one
> \defineenumeration[three] [counter=one,style=slanted] % only use counter of one
> \defineenumeration[four]  [three] % clone three
> \defineenumeration[five]  [three] [counter=five] % clone three and use own counter
> \defineenumeration[six]   [three] [counter=four] % clone tree and use counter four (undefined)
> 
> \setupenumerations[one]  [prefix=yes,prefixsegments=section]
> \setupenumerations[two]  [prefix=yes,prefixsegments=section]
> \setupenumerations[three][prefix=yes,prefixsegments=section]
> \setupenumerations[four] [prefix=yes,prefixsegments=chapter:section]
> \setupenumerations[five] [prefix=yes,prefixsegments=chapter:section]
> \setupenumerations[six]  [prefix=yes,prefixsegments=chapter:section]
> 
> \starttext
> 
> \chapter{test}
> 
> \startone   test test  1 \stopone
> \starttwo   test test  2 \stoptwo
> \startthree test test  3 \stopthree
> \startfour  test test  4 \stopfour
> \startfive  test test  1 \stopfive
> \startsix   test test  1 \stopsix
> 
> \chapter{test}
> 
> \section{test}
> 
> \startone   test test  6 \stopone
> \starttwo   test test  7 \stoptwo
> \startthree test test  8 \stopthree
> \startfour  test test  9 \stopfour
> \startfive  test test  2 \stopfive
> \startsix   test test  2 \stopsix
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                             | 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-12-03 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-30 14:15 Help watned for numbered descriptions Otared Kavian
2009-11-30 16:49 ` Hans Hagen
2009-11-30 17:27 ` Aditya Mahajan
2009-11-30 18:34   ` Otared Kavian
2009-11-30 21:29     ` Hans Hagen
2009-12-01  5:10       ` Otared Kavian
2009-12-03 18:31       ` Otared Kavian

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