Annotation and background color
Hi Wolfgang, Following up one of the recent threads about your annotation module, I made some experiments and found it a wonderful and extremely useful module. Out of curiosity, I wanted to know whether there is a key to set a background color for an annotation (as it is possible to use headcolor=darkred, or textcolor=darkgray, for instance). Also I didn't get the difference between textcolor=darkgray and color=darkgray: are they the same? The example I was testing is below. Best regards: OK \usemodule[annotation] \define[2]\MyQuotationCommand {\textrule{#1}#2\textrule} \defineannotation[MyQuotation] [alternative=command, command=\MyQuotationCommand, text=Quotation , number=yes, headcolor=darkred, color=darkgray, % textcolor=darkgray, ] \starttext \startMyQuotation{Peter D. Ward} \input ward.tex \stopMyQuotation \startMyQuotation{Donald Knuth} \input knuth \stopMyQuotation \MyQuotation{Wolfgang Schster}{The annotation module is wonderful!} \stoptext
Am 07.05.2011 um 12:44 schrieb Otared Kavian:
Hi Wolfgang,
Following up one of the recent threads about your annotation module, I made some experiments and found it a wonderful and extremely useful module. Out of curiosity, I wanted to know whether there is a key to set a background color for an annotation (as it is possible to use headcolor=darkred, or textcolor=darkgray, for instance).
No, you one of ConTeXt commands/environments which have a background, e.g. framed, background or textbaxkground. \define[2]\MyQuotationCommand {\setupbackground[background=color,backgroundcolor=gray] \startbackground \textrule{#1}#2\textrule \stopbackground} or \define[2]\MyQuotationCommand {\setupbackground[background=color,backgroundcolor=gray] \textrule{#1}% \startbackground #2% \stopbackground \textrule}
Also I didn't get the difference between textcolor=darkgray and color=darkgray: are they the same?
The “color” affects the header *and* the text while “headcolor” and “textcolor” only affect one of them. You can test this when you comment headcolor/textcolor and use only color. Wolfgang
Hi Wolfgang, Many thanks for your explanations. If I may ask a further question, I would like to know at which level one can control whether the first argument of the quotation in the example \MyQuotation{Wolfgang Schuster}{The annotation module is wonderful!} is surrounded or not by parentheses? I am asking this because I defined for my own use a macro which replaces the \proclaim command of Plain TeX (which disappeared in ConTeXt): I am thinking of switching to use the annotation module, since maybe with that it should be possible to have a list of all anotations of a certain type (for instance list of all theorems, all lemmas, etc) with the page at which they appear. Also with the annotations environment it seems that one can have more fancy layouts for proclaims. My definition of proclaim works only with mkii (somehow in mkiv the section number does not appear when numbering the proclaimed stuff…). The example is below. Best regards: OK %% defining \proclaim which is built in Plain-teX %% but has disappeared from ConTeXt \defineenumeration[proclaim] [text=, style=slanted, title=yes, titleleft=, titleright=, location=serried, width=fit, right={.~}] \setupnumber[proclaim][way=bysection,numbersection=yes] % maybe one has to change this in mkiv? %% end definition \proclaim \starttext 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{Lemme} Here is another lemma. \stopproclaim \startproclaim[thm:result]{Theorem} This is our main theorem. \stopproclaim \stoptext On 7 mai 2011, at 14:04, Wolfgang Schuster wrote:
Am 07.05.2011 um 12:44 schrieb Otared Kavian:
Hi Wolfgang,
Following up one of the recent threads about your annotation module, I made some experiments and found it a wonderful and extremely useful module. Out of curiosity, I wanted to know whether there is a key to set a background color for an annotation (as it is possible to use headcolor=darkred, or textcolor=darkgray, for instance).
No, you one of ConTeXt commands/environments which have a background, e.g. framed, background or textbaxkground.
\define[2]\MyQuotationCommand {\setupbackground[background=color,backgroundcolor=gray] \startbackground \textrule{#1}#2\textrule \stopbackground}
or
\define[2]\MyQuotationCommand {\setupbackground[background=color,backgroundcolor=gray] \textrule{#1}% \startbackground #2% \stopbackground \textrule}
Also I didn't get the difference between textcolor=darkgray and color=darkgray: are they the same?
The “color” affects the header *and* the text while “headcolor” and “textcolor” only affect one of them. You can test this when you comment headcolor/textcolor and use only color.
Wolfgang
___________________________________________________________________________________ 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 ___________________________________________________________________________________
%%%%%%%%%%%%%%%%%% Otared Kavian Département de Mathématiques Université de Versailles Saint-Quentin Bâtiment Fermat 45 avenue des Etats Unis 78035 Versailles cedex Téléphone: +33 1 39 25 46 42 Secrétariat: +33 1 39 25 46 44 Secrétariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr
On Sat, 7 May 2011, Otared Kavian wrote:
I am asking this because I defined for my own use a macro which replaces the \proclaim command of Plain TeX (which disappeared in ConTeXt): I am thinking of switching to use the annotation module, since maybe with that it should be possible to have a list of all anotations of a certain type (for instance list of all theorems, all lemmas, etc) with the page at which they appear.
Have you seen my (old) MAPS article on theorems: http://www.ntg.nl/maps/36/09.pdf That gives an example of how to get a list of all enumerations. I haven't tested that with MkIV, but that example uses just lists.
Also with the annotations environment it seems that one can have more fancy layouts for proclaims.
Agreed.
My definition of proclaim works only with mkii (somehow in mkiv the section number does not appear when numbering the proclaimed stuff…).
I don't know this. way=bysection should work for definenumber. Aditya
On 7 mai 2011, at 17:24, Aditya Mahajan wrote:
[…] Have you seen my (old) MAPS article on theorems: http://www.ntg.nl/maps/36/09.pdf
That gives an example of how to get a list of all enumerations. I haven't tested that with MkIV, but that example uses just lists.
Hi Aditya, Thanks fo rthe link: it's a pity I didn't know that article. It is very clear and useful, and if I knew this before I would have added a reference to it on the wiki, http://wiki.contextgarden.net/proclaim Just a remark about putting the list of proclaims at some place: in mkii, as you say in your article, the following \placelist[enumeration:all][width=6em,criterium=all] gives a list of all the titles and page numbers of proclaims. However it does not work with mkiv, I guess because the command has been slightly changed for placing lists: by any chance do you know what would be the correct invocation? Best regards: OK
Am 07.05.2011 um 16:37 schrieb Otared Kavian:
%% defining \proclaim which is built in Plain-teX %% but has disappeared from ConTeXt \defineenumeration[proclaim] [text=, style=slanted, title=yes, titleleft=, titleright=, location=serried, width=fit, right={.~}] \setupnumber[proclaim][way=bysection,numbersection=yes] % maybe one has to change this in mkiv? %% end definition \proclaim
\defineenumeration[proclaim] [text=, style=slanted, title=yes, titleleft=, titleright=, location=serried, width=fit, right={.~}, way=bysection, prefix=yes, prefixsegments=section] Wolfgang
On 7 mai 2011, at 17:29, Wolfgang Schuster wrote:
[…] \defineenumeration[proclaim] [text=, style=slanted, title=yes, titleleft=, titleright=, location=serried, width=fit, right={.~}, way=bysection, prefix=yes, prefixsegments=section]
Wolfgang
Hi Wolfgang, Thank you for your insight: indeed by saying way=bysection, prefix=yes, prefixsegments=section one gets the correct behavior both in mkii and mkiv (so I changed my definition of proclaim). Just out of curioisty, though it might be useful in some circumstances, how would you do in order to have ChapterNumber.SectionNumber.ProclaimNumber instead of just SectionNumber.ProclaimNumber, if at all possible? Best regards and many thanks: OK
Am 07.05.2011 um 16:37 schrieb Otared Kavian:
Hi Wolfgang,
Many thanks for your explanations. If I may ask a further question, I would like to know at which level one can control whether the first argument of the quotation in the example \MyQuotation{Wolfgang Schuster}{The annotation module is wonderful!} is surrounded or not by parentheses?
The header (First Argument of the command) consists of TEXT (“text”-key) NUMBER (incremented by context but you can enable/disable it with “number=yes|no”) LEFT SYMBOL (“left”-key, default: “(”) RIGHT SYMBOL (“right”-key, default “)”) TITLE (“title”-key or optional argument of the command/environment)
I am asking this because I defined for my own use a macro which replaces the \proclaim command of Plain TeX (which disappeared in ConTeXt): I am thinking of switching to use the annotation module, since maybe with that it should be possible to have a list of all anotations of a certain type (for instance list of all theorems, all lemmas, etc) with the page at which they appear. Also with the annotations environment it seems that one can have more fancy layouts for proclaims.
The annotation module doesn’t have so many options as enumerations and it is no replacement for them. What the module does is that it generates a environment (like \definestartstop) where you have access to the content, with your own command you can format the content in any way you like. The advantage of this method is that you can separate content and layout of certain texts which isn’t possible with build in methods, e.g. a \inmargin text will always appear in the margin and when you want the text now as quote you have to change the command from \inmargin to \quotation but with the annotation module the command in your document won’t change because the switch from \inmargin to \quotation happens in the preamble with the setup of the environment. \usemodule[annotation] \define[2]\AnnotationCommand{\quotation{#2}} \setupannotation[alternative=inmargin] %\setupannotation[alternative=command,command=\AnnotationCommand] \starttext … \startannotation Hello\stopannotation … … \startannotation Hello\stopannotation … \stoptext Wolfgang
On 7 mai 2011, at 18:32, Wolfgang Schuster wrote:
Am 07.05.2011 um 16:37 schrieb Otared Kavian:
Hi Wolfgang,
Many thanks for your explanations. If I may ask a further question, I would like to know at which level one can control whether the first argument of the quotation in the example \MyQuotation{Wolfgang Schuster}{The annotation module is wonderful!} is surrounded or not by parentheses?
The header (First Argument of the command) consists of
TEXT (“text”-key) NUMBER (incremented by context but you can enable/disable it with “number=yes|no”) LEFT SYMBOL (“left”-key, default: “(”) RIGHT SYMBOL (“right”-key, default “)”) TITLE (“title”-key or optional argument of the command/environment)
Hi, Thanks to your explanations I understood the meanings of each of the keys, and the principles of using the annotation environment. What would be the key to use in order to have (for instance) a colon « : » after the number? Best regards: OK
I am asking this because I defined for my own use a macro which replaces the \proclaim command of Plain TeX (which disappeared in ConTeXt): I am thinking of switching to use the annotation module, since maybe with that it should be possible to have a list of all anotations of a certain type (for instance list of all theorems, all lemmas, etc) with the page at which they appear. Also with the annotations environment it seems that one can have more fancy layouts for proclaims.
The annotation module doesn’t have so many options as enumerations and it is no replacement for them. What the module does is that it generates a environment (like \definestartstop) where you have access to the content, with your own command you can format the content in any way you like.
The advantage of this method is that you can separate content and layout of certain texts which isn’t possible with build in methods, e.g. a \inmargin text will always appear in the margin and when you want the text now as quote you have to change the command from \inmargin to \quotation but with the annotation module the command in your document won’t change because the switch from \inmargin to \quotation happens in the preamble with the setup of the environment.
\usemodule[annotation]
\define[2]\AnnotationCommand{\quotation{#2}}
\setupannotation[alternative=inmargin] %\setupannotation[alternative=command,command=\AnnotationCommand]
\starttext
… \startannotation Hello\stopannotation …
… \startannotation Hello\stopannotation …
\stoptext
Wolfgang
___________________________________________________________________________________ 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 ___________________________________________________________________________________
%%%%%%%%%%%%%%%%%% Otared Kavian Département de Mathématiques Université de Versailles Saint-Quentin Bâtiment Fermat 45 avenue des Etats Unis 78035 Versailles cedex Téléphone: +33 1 39 25 46 42 Secrétariat: +33 1 39 25 46 44 Secrétariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr
Am 07.05.2011 um 12:44 schrieb Otared Kavian:
\startMyQuotation{Donald Knuth} \input knuth \stopMyQuotation
\MyQuotation{Wolfgang Schster}{The annotation module is wonderful!}
With the next version you can also write \startMyQuotation[title={Donald E. Knuth}] \input knuth \stopMyQuotation and \MyQuotation[title={…}]{…} Wolfgang
participants (3)
-
Aditya Mahajan
-
Otared Kavian
-
Wolfgang Schuster