Suitable mechanism for Theorems and Definitions
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
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)
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.
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)
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?
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
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.
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
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 -----------------------------------------------------------------
participants (4)
-
David Antos
-
Hans Hagen Outside
-
Rob Ermers
-
Taco Hoekwater