Difference between revisions of "Proclaim"
Line 1: | Line 1: | ||
In Plain-TeX there is the command \proclaim which is very handy when writing mathematics and stating Theorems, Lemmas, Definitions and so on. Unfortunately it doesn't allow one to number automatically these statements in order to refer to them through cross referencing, and somehow it has disappeared from ConTeXt. | In Plain-TeX there is the command \proclaim which is very handy when writing mathematics and stating Theorems, Lemmas, Definitions and so on. Unfortunately it doesn't allow one to number automatically these statements in order to refer to them through cross referencing, and somehow it has disappeared from ConTeXt. | ||
− | If one wishes to number in a sequential way all these « proclaims », here is a solution: | + | If one wishes to number in a sequential way all these « proclaims », here is a solution, which works veru well in ConTeXt mkii (for a solution with mkiv see below): |
<texcode> | <texcode> | ||
Line 70: | Line 70: | ||
</texcode> | </texcode> | ||
− | and we get this: | + | and we get this upon typesetting in mkii: |
+ | |||
+ | |||
<context> | <context> | ||
Line 129: | Line 131: | ||
Note that we can refer to our results in the following way: according to the definition \in[def:test] we see that theorem \in[thm:result] is | Note that we can refer to our results in the following way: according to the definition \in[def:test] we see that theorem \in[thm:result] is | ||
an easy consequence of lemma \in[lem:resultB]. | an easy consequence of lemma \in[lem:resultB]. | ||
+ | |||
+ | \stoptext | ||
+ | |||
+ | </context> | ||
+ | |||
+ | |||
+ | In mkiv there is another solution which consists in defining first a certain « enumeration » (in the example below for Remarks) and then use the counter created for this enumeration in other enumerations such as Lemmas, Theorems, etc. | ||
+ | |||
+ | <texcode> | ||
+ | |||
+ | %% Defining \proclaim style Remark, Lemmas, Theorem, Corollary, etc | ||
+ | \defineenumeration[remark] | ||
+ | [text=Remark, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | right={.~}] | ||
+ | \setupenumerations[remark] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] % or prefixsegments=chapter:section | ||
+ | \setupnumber[remark][way=bysection] | ||
+ | |||
+ | \defineenumeration[lemma] | ||
+ | [text=Lemma, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | counter=remark, % only use counter of remark | ||
+ | style=slanted, | ||
+ | right={.~}] | ||
+ | \setupenumerations[lemma] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] | ||
+ | |||
+ | \defineenumeration[theorem] | ||
+ | [text=Theorem, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | counter=remark, | ||
+ | style=slanted, | ||
+ | right={.~}] | ||
+ | \setupenumerations[theorem] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] | ||
+ | |||
+ | \starttext | ||
+ | |||
+ | \title{First and only title of the article} | ||
+ | |||
+ | Here we don't have any section. | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma[lem:elem] | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \section{This is a section} | ||
+ | |||
+ | Here we do have a section. | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \startremark[rem:silly] | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem[thm:deep] | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | As mentioned in remark \in[rem:silly], the results of lemma \in[lem:elem] and that of theorem \in[thm:deep] are trivial. | ||
+ | |||
+ | \stoptext | ||
+ | |||
+ | </texcode> | ||
+ | |||
+ | This results in the following: | ||
+ | |||
+ | |||
+ | <context> | ||
+ | |||
+ | \defineenumeration[remark] | ||
+ | [text=Remark, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | right={.~}] | ||
+ | \setupenumerations[remark] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] % or prefixsegments=chapter:section | ||
+ | \setupnumber[remark][way=bysection] | ||
+ | |||
+ | \defineenumeration[lemma] | ||
+ | [text=Lemma, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | counter=remark, % only use counter of remark | ||
+ | style=slanted, | ||
+ | right={.~}] | ||
+ | \setupenumerations[lemma] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] | ||
+ | |||
+ | \defineenumeration[theorem] | ||
+ | [text=Theorem, | ||
+ | location=serried, | ||
+ | width=fit, | ||
+ | counter=remark, | ||
+ | style=slanted, | ||
+ | right={.~}] | ||
+ | \setupenumerations[theorem] | ||
+ | [prefix=yes, | ||
+ | prefixsegments=section] | ||
+ | |||
+ | \starttext | ||
+ | |||
+ | \title{First and only title of the article} | ||
+ | |||
+ | Here we don't have any section. | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma[lem:elem] | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \section{This is a section} | ||
+ | |||
+ | Here we do have a section. | ||
+ | |||
+ | \startremark | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | \startremark[rem:silly] | ||
+ | This is a silly remark. | ||
+ | \stopremark | ||
+ | |||
+ | \startlemma | ||
+ | This is an elementary result. | ||
+ | \stoplemma | ||
+ | |||
+ | \starttheorem[thm:deep] | ||
+ | This is a deep theorem. | ||
+ | \stoptheorem | ||
+ | |||
+ | As mentioned in remark \in[rem:silly], the results of lemma \in[lem:elem] and that of theorem \in[thm:deep] are trivial. | ||
\stoptext | \stoptext | ||
</context> | </context> |
Revision as of 18:16, 3 December 2009
In Plain-TeX there is the command \proclaim which is very handy when writing mathematics and stating Theorems, Lemmas, Definitions and so on. Unfortunately it doesn't allow one to number automatically these statements in order to refer to them through cross referencing, and somehow it has disappeared from ConTeXt.
If one wishes to number in a sequential way all these « proclaims », here is a solution, which works veru well in ConTeXt mkii (for a solution with mkiv see below):
%% defining an enumeration environment replacing Plain-TeX's \proclaim % \defineenumeration[proclaim] [text=, style=slanted, title=yes, titleleft=, titleright=, location=serried, width=fit, right={. }] \setupnumber[proclaim][way=bysection,numbersection=yes] %% this can be changed according to one's wishes % %% end definition \proclaim
After having defined this, one can use it in the following way:
\starttext \title{On proclamations} \blank When there is not a declared section, the numbers have no prefix as in the following: \startproclaim[def:test]{Definition} This is a definition. \stopproclaim \startproclaim{Lemma} This is a lemma. \stopproclaim \section{Here is a section} When there is a declared section, the numbers have as prefix the section number, as in the following: \startproclaim{Lemma} Here is another lemma. \stopproclaim \startproclaim[thm:result]{Theorem} This is our main theorem. \stopproclaim \section{Here is another section} When there is a declared section the numbers have as prefix the section number, as in the following: \startproclaim[lem:resultB]{Lemma} Here is an elementary lemma. \stopproclaim \startproclaim{Corollary} This is a corollary. \stopproclaim Note that we can refer to our results in the following way: according to the definition \in[def:test] we see that theorem \in[thm:result] is an easy consequence of lemma \in[lem:resultB]. \stoptext
and we get this upon typesetting in mkii:
In mkiv there is another solution which consists in defining first a certain « enumeration » (in the example below for Remarks) and then use the counter created for this enumeration in other enumerations such as Lemmas, Theorems, etc.
%% Defining \proclaim style Remark, Lemmas, Theorem, Corollary, etc \defineenumeration[remark] [text=Remark, location=serried, width=fit, right={.~}] \setupenumerations[remark] [prefix=yes, prefixsegments=section] % or prefixsegments=chapter:section \setupnumber[remark][way=bysection] \defineenumeration[lemma] [text=Lemma, location=serried, width=fit, counter=remark, % only use counter of remark style=slanted, right={.~}] \setupenumerations[lemma] [prefix=yes, prefixsegments=section] \defineenumeration[theorem] [text=Theorem, location=serried, width=fit, counter=remark, style=slanted, right={.~}] \setupenumerations[theorem] [prefix=yes, prefixsegments=section] \starttext \title{First and only title of the article} Here we don't have any section. \startremark This is a silly remark. \stopremark \startlemma[lem:elem] This is an elementary result. \stoplemma \starttheorem This is a deep theorem. \stoptheorem \startremark This is a silly remark. \stopremark \startlemma This is an elementary result. \stoplemma \starttheorem This is a deep theorem. \stoptheorem \section{This is a section} Here we do have a section. \startremark This is a silly remark. \stopremark \startlemma This is an elementary result. \stoplemma \starttheorem This is a deep theorem. \stoptheorem \startremark[rem:silly] This is a silly remark. \stopremark \startlemma This is an elementary result. \stoplemma \starttheorem[thm:deep] This is a deep theorem. \stoptheorem As mentioned in remark \in[rem:silly], the results of lemma \in[lem:elem] and that of theorem \in[thm:deep] are trivial. \stoptext
This results in the following: