ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Suitable mechanism for Theorems and Definitions
@ 2005-08-19  9:48 David Antos
  2005-08-21 12:27 ` David Antos
  0 siblings, 1 reply; 9+ messages in thread
From: David Antos @ 2005-08-19  9:48 UTC (permalink / raw)



	Hello,

I've used enumeration features for typesetting Theorems, Lemmas, and
Definitions. Two extra requirements appeared. Is this possible to create
lists of those entities (something like \placelistofTheorems :-)?

And is there a way to add names to them, resulting in something like

Definition 4.3: Interval Decision Diagram Node
blahblah

Or is there a more suitable way to do this (taking into account that I
prefer numbering Theorems, Lemmas, and Definitions in a single number
line)? "You have to program it yourself on top of enumeration" is of course
a valid answer, I just don't want to do something that is built in :-))))

Thanks,
D.A.

-- 
DCT itself provides a lossless compression and actually doesn't
compress anything.
-- Miloš Liška

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-19  9:48 Suitable mechanism for Theorems and Definitions David Antos
@ 2005-08-21 12:27 ` David Antos
  2005-08-21 15:43   ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: David Antos @ 2005-08-21 12:27 UTC (permalink / raw)



Hello,

I'll try to be more exact in my question to prevent empty answer now :-)

On Fri, Aug 19, 2005 at 11:48:34AM +0200, David Antos wrote:
> I've used enumeration features for typesetting Theorems, Lemmas, and
> Definitions. Two extra requirements appeared. Is this possible to create
> lists of those entities (something like \placelistofTheorems :-)?
> 
> And is there a way to add names to them, resulting in something like
> 
> Definition 4.3: Interval Decision Diagram Node
> blahblah

What I need is to enrich enumerations by the possibility to write into
list. How can I get the number of the current enumeration? The resulting
list should be something like
Definition 4.3 ....... pagenumber

I've managed something like
\expanded{\writetolist[MyList]{\precedingsectionnumber\numberTheorem}{}}}
(hooked into inbetween of defineenumeration) work, but it works for the
first level of enumerations only (i.e., not for \subdefinition) (well, I
don't mind it so much, but there should be a better way indeed). What is
the "politically-correct" way of obtaining the "4.3" number?

Second: I want some of the definitions to have names (to appear in the
list, too). The idea now is to re-define \startDefinition so that it
1. globaly defines a macro for the content of the name
2. the old \startDefinition will typeset
Definition 4.3: Interval Decision Diagram Node
and puts
Definition 4.3 (Interval ...) ... pagenumber
into the list, both by means of hooking into "inbetween".

Is this "simple enough" or is there a better way to do this? BTW, is it
reasonable to enrich enumerations with the possibility to create lists and
with "names"? What would be great for things like definitions and lemmas is
something that combines descriptions (that have names but no numbering) and
enumerations (that have exactly the opposite features).

Thank you,
D.A.

-- 
Sir Humphrey: "The purpose of minutes is not to record events, it is
to protect people."
-- Yes, Prime Minister (Official Secrets)

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-21 12:27 ` David Antos
@ 2005-08-21 15:43   ` Taco Hoekwater
  2005-08-21 16:22     ` David Antos
  0 siblings, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2005-08-21 15:43 UTC (permalink / raw)



Hi David,

I saw this post and thought: "didn't I have a similar problem a while
back"? And yes, I did, while I was stil working for Kluwer Academic.

The "a while" turned out to be around 1999, and the code (hack) I
used back then is no longer even remotely usable (for one because
context was still in dutch, then), but I'll see if I can update my
patch.

Taco

David Antos wrote:
> Hello,
> 
> I'll try to be more exact in my question to prevent empty answer now :-)
> 
> On Fri, Aug 19, 2005 at 11:48:34AM +0200, David Antos wrote:
> 
>>I've used enumeration features for typesetting Theorems, Lemmas, and
>>Definitions. Two extra requirements appeared. Is this possible to create
>>lists of those entities (something like \placelistofTheorems :-)?
>>
>>And is there a way to add names to them, resulting in something like
>>
>>Definition 4.3: Interval Decision Diagram Node
>>blahblah
> 
> 
> What I need is to enrich enumerations by the possibility to write into
> list. How can I get the number of the current enumeration? The resulting
> list should be something like
> Definition 4.3 ....... pagenumber
> 
> I've managed something like
> \expanded{\writetolist[MyList]{\precedingsectionnumber\numberTheorem}{}}}
> (hooked into inbetween of defineenumeration) work, but it works for the
> first level of enumerations only (i.e., not for \subdefinition) (well, I
> don't mind it so much, but there should be a better way indeed). What is
> the "politically-correct" way of obtaining the "4.3" number?
> 
> Second: I want some of the definitions to have names (to appear in the
> list, too). The idea now is to re-define \startDefinition so that it
> 1. globaly defines a macro for the content of the name
> 2. the old \startDefinition will typeset
> Definition 4.3: Interval Decision Diagram Node
> and puts
> Definition 4.3 (Interval ...) ... pagenumber
> into the list, both by means of hooking into "inbetween".
> 
> Is this "simple enough" or is there a better way to do this? BTW, is it
> reasonable to enrich enumerations with the possibility to create lists and
> with "names"? What would be great for things like definitions and lemmas is
> something that combines descriptions (that have names but no numbering) and
> enumerations (that have exactly the opposite features).
> 
> Thank you,
> D.A.
> 

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-21 15:43   ` Taco Hoekwater
@ 2005-08-21 16:22     ` David Antos
  2005-08-24 20:01       ` Rob Ermers
  0 siblings, 1 reply; 9+ messages in thread
From: David Antos @ 2005-08-21 16:22 UTC (permalink / raw)



Hello Taco,

On Sun, Aug 21, 2005 at 05:43:02PM +0200, Taco Hoekwater wrote:
> The "a while" turned out to be around 1999, and the code (hack) I
> used back then is no longer even remotely usable (for one because
> context was still in dutch, then), but I'll see if I can update my
> patch.

:-), that's great :-).

In the meantime, I solved the second part, i.e., adding the additional
describing text. It goes somehow like this (well, it's a hack, but it
works):

% MathParagraph is the enumeration (it ensures references and numbering,
% and typesetting all the texts). In command, it calls a macro that refers
% to \MathParagraphType etc.

\def\startLemma{\dosingleempty\dostartLemma}
\def\dostartLemma[#1]#2 {%
\def\MathParagraphType{Lemma}
\def\MathParagraphName{#2}
\def\MathParagraphList{MathParagraphs}
\iffirstargument
  \startMathParagraph[#1]
\else
  \startMathParagraph
\fi
}
\let\stopLemma\stopMathParagraph

So I can use
\startLemma[reference]{Algorithm xyz terminates}
...
\stopLemma

I came to the idea to misuse command= to typeset the header and write to
the list, it is given an argument containing the number of the enumeration.
Anyway, it is not easy to feed it into \expanded{\writetolist...} as the
argument is something with \edef and a pile of pretty ugly macros :-), so I
still use \precedingsectionnumber\numberMathParagraph :-(

To sum up, a good way to obtain current enumeration number (in a form that
goes into lists, etc.)  would be completely enough, provided that one
writes hacks to solve the rest (and does end up finding the real macro
names with \tracingmacros=1 :-)). Creating something like
enumerateddescription (a description with names and possibility to write
lists) would be much nicer, of course :-))

Thank you very much,
D.A.

P.S.: Hans said once that a Dutch mathematical journal is typeset with
ConTeXt. Do you have an idea how they typeset theorems?

-- 
Two million robots: (Once a tune has been worked out, the accompaniment
  should be played on a very echoey synthesiser whilst the two million
  robots sing exactly a flattened fifth out of tune. It will sound more
  ghastly than you can possibly imagine.)
-- Douglas Adams (in a script of H2G2 radio series)

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-21 16:22     ` David Antos
@ 2005-08-24 20:01       ` Rob Ermers
  2005-08-24 20:40         ` David Antos
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Ermers @ 2005-08-24 20:01 UTC (permalink / raw)


Hi friends,
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.

I don't need it for math, but for case descriptions.

A case consists of the following elements:

Case 1    Eating fruit is healthy
Text text text - case description --

Questions:
1. abcd
2. efgh
....

Answers:
1. aaa bb
2. dderere
...

Case 2   Everything about vitamins
...

The elements themselves I can put in blocks in order to be able to 
separate the q's and a's.

What I am wondering about is how to include the title in the macro.
It does not seem very difficult, but I can't figure out how.

The theorem environment seemed promising, but David's suggestion does 
not process. Has anyone an idea?

Kind regards,

Robert







fonts          : using map file: 8r-base.map
fonts          : using map file: ec-public-lm.map
fonts          : using map file: original-base.map
systems        : begin file tst4 at line 31
! Undefined control sequence.
\dostartLemma ...irstargument \startMathParagraph
                                                   [#1] \else 
\startMathParag...
l.34 ...Lemma[reference]{Algorithm xyz terminates}

?
! Undefined control sequence.
l.36 \stopLemma


David Antos wrote:
> Hello Taco,
> 
> On Sun, Aug 21, 2005 at 05:43:02PM +0200, Taco Hoekwater wrote:
> 
>>The "a while" turned out to be around 1999, and the code (hack) I
>>used back then is no longer even remotely usable (for one because
>>context was still in dutch, then), but I'll see if I can update my
>>patch.
> 
> 
> :-), that's great :-).
> 
> In the meantime, I solved the second part, i.e., adding the additional
> describing text. It goes somehow like this (well, it's a hack, but it
> works):
> 
> % MathParagraph is the enumeration (it ensures references and numbering,
> % and typesetting all the texts). In command, it calls a macro that refers
> % to \MathParagraphType etc.
> 
> \def\startLemma{\dosingleempty\dostartLemma}
> \def\dostartLemma[#1]#2 {%
> \def\MathParagraphType{Lemma}
> \def\MathParagraphName{#2}
> \def\MathParagraphList{MathParagraphs}
> \iffirstargument
>   \startMathParagraph[#1]
> \else
>   \startMathParagraph
> \fi
> }
> \let\stopLemma\stopMathParagraph
> 
> So I can use
> \startLemma[reference]{Algorithm xyz terminates}
> ...
> \stopLemma
> 
> I came to the idea to misuse command= to typeset the header and write to
> the list, it is given an argument containing the number of the enumeration.
> Anyway, it is not easy to feed it into \expanded{\writetolist...} as the
> argument is something with \edef and a pile of pretty ugly macros :-), so I
> still use \precedingsectionnumber\numberMathParagraph :-(
> 
> To sum up, a good way to obtain current enumeration number (in a form that
> goes into lists, etc.)  would be completely enough, provided that one
> writes hacks to solve the rest (and does end up finding the real macro
> names with \tracingmacros=1 :-)). Creating something like
> enumerateddescription (a description with names and possibility to write
> lists) would be much nicer, of course :-))
> 
> Thank you very much,
> D.A.
> 
> P.S.: Hans said once that a Dutch mathematical journal is typeset with
> ConTeXt. Do you have an idea how they typeset theorems?
> 

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-24 20:01       ` Rob Ermers
@ 2005-08-24 20:40         ` David Antos
  2005-08-25 10:07           ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: David Antos @ 2005-08-24 20:40 UTC (permalink / raw)


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.

-- 
Clothes make the man. Naked people have little or no influence on society.
-- Mark Twain

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-24 20:40         ` David Antos
@ 2005-08-25 10:07           ` Taco Hoekwater
  2005-08-25 20:38             ` David Antos
  2005-08-29 21:26             ` Hans Hagen Outside
  0 siblings, 2 replies; 9+ messages in thread
From: Taco Hoekwater @ 2005-08-25 10:07 UTC (permalink / raw)



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

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-25 10:07           ` Taco Hoekwater
@ 2005-08-25 20:38             ` David Antos
  2005-08-29 21:26             ` Hans Hagen Outside
  1 sibling, 0 replies; 9+ messages in thread
From: David Antos @ 2005-08-25 20:38 UTC (permalink / raw)



Hello,

On Thu, Aug 25, 2005 at 12:07:56PM +0200, Taco Hoekwater wrote:
> Not sure if you are still interested, but here is my "optional title"

sure I am :-) (And so I expect Rob to be :-)

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

Thank you very much.

> This does not solve the list generation, sorry.

List generation is easy to add if one knows how to get the number :-)

Thank you,
D.A.

-- 
- Please relax, - said the voice pleasantly, like a stewardess in  an
airliner with only one wing and two engines one of which is on fire, -
you are perfectly safe.
-- Douglas Adams, The Hitchiker's Guide to the Galaxy

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

* Re: Suitable mechanism for Theorems and Definitions
  2005-08-25 10:07           ` Taco Hoekwater
  2005-08-25 20:38             ` David Antos
@ 2005-08-29 21:26             ` Hans Hagen Outside
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen Outside @ 2005-08-29 21:26 UTC (permalink / raw)


Taco Hoekwater wrote:

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

ok, i can cook up something along these lines 

Hans 

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

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

end of thread, other threads:[~2005-08-29 21:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-19  9:48 Suitable mechanism for Theorems and Definitions 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
2005-08-25 20:38             ` David Antos
2005-08-29 21:26             ` Hans Hagen Outside

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