One-off theorem titles
Currently I am using something like \defineenumeration[lemma] [location=serried, headstyle=bold, text=Lemma, width=broad, style=italic] to define theorems, lemmas, etc. Sometimes a theorem or lemma will have its own name (e.g. Yoneda Lemma), and I find it slightly cumbersome to write something like 3.1 Theorem (Yoneda Lemma) 3.1 Lemma (Yoneda) 3.1 Lemma (Yoneda Lemma) and was really hoping that \startlemma[text={Yoneda Lemma}] would give me the desired 3.1 Yoneda Lemma but it doesn't. I would like to keep the whole setup the same and only change the text for this instance. Is there any way to implement this except for defining a whole new enumeration for one theorem/lemma/proposition by \startenumeration[text={Yoneda Lemma},location= ... ] Thank you. Severin
Hi Severin, Maybe this is what you want: %%%%% begin %% 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] %% end definition \proclaim %% defining \remark \defineenumeration[remark] [text=, style=rm, title=yes, titleleft=, titleright=, location=serried, width=fit, right={.~}] \setupnumber[remark][number=proclaim] %% end definition \remark \starttext \input knuth.tex \startproclaim[lem:Yoneda]{Yanada Theorem} This is a theorem in set category theory. \stopproclaim \startremark{Remark} The above theorem and this remark are numbered sequentially. \stopremark \section{A new section} \input knuth.tex \startproclaim[lem:Yoneda2]{Yanada Theorem} As said above, this is a theorem in set category theory. \stopproclaim \startremark{Remark} The above theorem and this remark are numbered sequentially. \stopremark \stoptext %%%%% end Best regards: OK On 3 mars 2011, at 09:05, S Barmeier wrote:
Currently I am using something like
\defineenumeration[lemma] [location=serried, headstyle=bold, text=Lemma, width=broad, style=italic]
to define theorems, lemmas, etc.
Sometimes a theorem or lemma will have its own name (e.g. Yoneda Lemma), and I find it slightly cumbersome to write something like
3.1 Theorem (Yoneda Lemma) 3.1 Lemma (Yoneda) 3.1 Lemma (Yoneda Lemma)
and was really hoping that
\startlemma[text={Yoneda Lemma}]
would give me the desired
3.1 Yoneda Lemma
but it doesn't. I would like to keep the whole setup the same and only change the text for this instance. Is there any way to implement this except for defining a whole new enumeration for one theorem/lemma/proposition by
\startenumeration[text={Yoneda Lemma},location= ... ]
Thank you. Severin
___________________________________________________________________________________ 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 03.03.2011 um 09:05 schrieb S Barmeier:
\startenumeration[text={Yoneda Lemma},location= ... ]
Enumeration don’t support key-val-input for the commands and environments (although it isn’t hard to add it). The both arguments are “[reference]” and “{title}”. Besides the already presented solution here is one which use the annotation module (local replacement of the enumeration text doesn’t work because \setupenumerations resets the counter): \usemodule[annotation] % solution 1 %\defineenumeration % [thelemma] % [ location=serried, % text=Lemma, % width=broad] % %\define[2]\LemmaCommand % {\doiftext % {\placeannotationtitle} % {\setupenumerations[thelemma][text=\placeannotationtitle]}% % \startthelemma#2\stopthelemma} \defineenumeration [thelemma] [ location=serried, text=\placeannotationtitle, width=broad] \define[2]\LemmaCommand {\doiftextelse{\placeannotationtitle} {} {\def\placeannotationtitle{Lemma}}% \startthelemma#2\stopthelemma} \defineannotation [lemma] [alternative=command, command=\LemmaCommand] % solution 2 %\defineenumeration % [theproclaim] % [ location=serried, % text=Proclaim, % width=broad] % %\define[2]\ProclaimCommand % {\doiftext % {\placeannotationtext} % {\setupenumerations[theproclaim][text=\placeannotationtext]}% % \starttheproclaim#2\stoptheproclaim} \defineenumeration [theproclaim] [ location=serried, text=\placeannotationtext, width=broad] \define[2]\ProclaimCommand {\doiftextelse{\placeannotationtext} {} {\def\placeannotationtext{Proclaim}}% \starttheproclaim#2\stoptheproclaim} \defineannotation [proclaim] [alternative=command, command=\ProclaimCommand] \starttext \startlemma … \stoplemma \startlemma{Another Lemma} … \stoplemma \blank[2*line] \startproclaim … \stopproclaim \startproclaim[text={Another Proclaim}] … \stopproclaim \stoptext Wolfgang
On Thu, 3 Mar 2011, Wolfgang Schuster wrote:
Am 03.03.2011 um 09:05 schrieb S Barmeier:
\startenumeration[text={Yoneda Lemma},location= ... ]
Enumeration don’t support key-val-input for the commands and environments (although it isn’t hard to add it). The both arguments are “[reference]” and “{title}”.
Besides the already presented solution here is one which use the annotation module (local replacement of the enumeration text doesn’t work because \setupenumerations resets the counter):
\usemodule[annotation]
A very useful module to have! But how is it different from enumerations (apart from having a modern interface)? in particular, would you consider reimplimenting definitions and enumerations by using annotations as a base? I am a bit surprised by the naming of the internal macros: annotation_cmd annotation__cmd annotation___cmd I know that \do \dodo \dododo is not the best notation, but I don't find _ __ ___ better. Aditya
Am 03.03.2011 um 19:18 schrieb Aditya Mahajan:
\usemodule[annotation]
A very useful module to have! But how is it different from enumerations (apart from having a modern interface)? in particular, would you consider reimplimenting definitions and enumerations by using annotations as a base?
That’s only one way what you can use the module for. The main purpose are todo lists etc., e.g. \defineannotation[todo] \starttext \todo{Add a table} \stoptext And later you can remove all remaining \todo texts with \setupannotation[todo][alternative=none]
I am a bit surprised by the naming of the internal macros:
annotation_cmd annotation__cmd annotation___cmd
I liked the LaTeX3 system to have names in the form \<module>_<command>, with this you have a easy way to protect internal commands and to avoid command clashes, e.g. you define the command \getfirstcharacter in your filter module but this name is already used in the core (syst-aux.mkiv) and with the name \filter_getfirstcharacter you can avoid this without thinking too much about a good name.
I know that \do \dodo \dododo is not the best notation, but I don't find _ __ ___ better.
I don’t like the __ and ___ either but do you know a better way for good names without using do, dodo, nodo, yes or nop? I first thought about this: \def\module_command {\dosingleempty\module_docommand} \def\module_docommand[#1]{} but i don’t liked it and in the end i use now this: \def\module_command {\dosingleempty\module__command} \def\module__command[#1]{} Wolfgang
On Thu, 3 Mar 2011, Wolfgang Schuster wrote:
I am a bit surprised by the naming of the internal macros:
annotation_cmd annotation__cmd annotation___cmd
I liked the LaTeX3 system to have names in the form \<module>_<command>, with this you have a easy way to protect internal commands and to avoid command clashes,
I also like \<module>_<command>. That is better than \<module><command> that I have been using. Of course, this means that _ should not have its usual meaning. I haven't checked on how \unprotect works in MkII. If it makes _ a letter, then I'll switch to \<module>_<command>. Another option might be to use \<module>.<command> with . having the right catcode. That will give macro names a more OOP feel.
e.g. you define the command \getfirstcharacter in your filter module but this name is already used in the core (syst-aux.mkiv) and with the name \filter_getfirstcharacter you can avoid this without thinking too much about a good name.
I didn't know that. I'll change that name. So far, I have been using \externafillter<command> for most commands, and sometimes it gets unreadable.
I know that \do \dodo \dododo is not the best notation, but I don't find _ __ ___ better.
I don’t like the __ and ___ either but do you know a better way for good names without using do, dodo, nodo, yes or nop?
I find that \module__command and \module___command are hard to distinguish. For helper macros, a better idea might be: \module_command \module_command! \module_command!! These commands are easy to distinguish visually. But this will not work for too well for three or four levels. I think that none of the schemes look good for three or four levels. Perhaps we could mix both existing schemes to get something reasonable: \module_command \module_command! \module_command!do \module_command!redo or maybe \module_command \module_command_one \module_command_two \module_command_three etc. Aditya
On 4-3-2011 12:55, Aditya Mahajan wrote:
I also like \<module>_<command>. That is better than \<module><command> that I have been using. Of course, this means that _ should not have its usual meaning. I haven't checked on how \unprotect works in MkII. If it makes _ a letter, then I'll switch to \<module>_<command>.
the main disadvantage of _ (at least in the past) is that it can get invisible on a low res screen
Another option might be to use \<module>.<command> with . having the right catcode. That will give macro names a more OOP feel.
indeed, but unfortunately it clashes with . being other in dimensions (althoug i can imagine that we patch luatex to accept it)
I know that \do \dodo \dododo is not the best notation, but I don't find _ __ ___ better.
I don’t like the __ and ___ either but do you know a better way for good names without using do, dodo, nodo, yes or nop?
we can have module_do_bla or module_x_bla module_xx_bla etc
I find that \module__command and \module___command are hard to distinguish. For helper macros, a better idea might be:
\module_command \module_command! \module_command!!
or \module_!_command \module_!!_command
These commands are easy to distinguish visually. But this will not work for too well for three or four levels. I think that none of the schemes look good for three or four levels. Perhaps we could mix both existing schemes to get something reasonable:
\module_command \module_command! \module_command!do \module_command!redo
or maybe
\module_command \module_command_one \module_command_two \module_command_three
or \module_command_a \module_command_b \module_command_aa (used by _a) etc actually we can use ^ if we want: \module_^_command \module_^^_command Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, Mar 4, 2011 at 11:33 AM, Hans Hagen
On 4-3-2011 12:55, Aditya Mahajan wrote:
I also like \<module>_<command>. That is better than \<module><command> that I have been using. Of course, this means that _ should not have its usual meaning. I haven't checked on how \unprotect works in MkII. If it makes _ a letter, then I'll switch to \<module>_<command>.
the main disadvantage of _ (at least in the past) is that it can get invisible on a low res screen
Another option might be to use \<module>.<command> with . having the right catcode. That will give macro names a more OOP feel.
indeed, but unfortunately it clashes with . being other in dimensions (althoug i can imagine that we patch luatex to accept it) why not \<module>:<command> ? (it's erlang style) -- luigi
On Fri, 4 Mar 2011, luigi scarso wrote:
On Fri, Mar 4, 2011 at 11:33 AM, Hans Hagen
wrote: On 4-3-2011 12:55, Aditya Mahajan wrote:
I also like \<module>_<command>. That is better than \<module><command> that I have been using. Of course, this means that _ should not have its usual meaning. I haven't checked on how \unprotect works in MkII. If it makes _ a letter, then I'll switch to \<module>_<command>.
the main disadvantage of _ (at least in the past) is that it can get invisible on a low res screen
Another option might be to use \<module>.<command> with . having the right catcode. That will give macro names a more OOP feel.
indeed, but unfortunately it clashes with . being other in dimensions (althoug i can imagine that we patch luatex to accept it) why not \<module>:<command>
Wrong catcode :-( I would prefer the C++ style <module>::<command> A single : is not visually distinct. Aditya
Am 04.03.2011 um 11:33 schrieb Hans Hagen:
I don’t like the __ and ___ either but do you know a better way for good names without using do, dodo, nodo, yes or nop?
we can have module_do_bla or module_x_bla module_xx_bla etc
I think module_bla, module_bla_do, module_bla_redo etc. is better
I find that \module__command and \module___command are hard to distinguish. For helper macros, a better idea might be:
\module_command \module_command! \module_command!!
or
\module_!_command \module_!!_command
In which are these alternatives are better than my module__command, you replace only the _ by !
These commands are easy to distinguish visually. But this will not work for too well for three or four levels. I think that none of the schemes look good for three or four levels. Perhaps we could mix both existing schemes to get something reasonable:
\module_command \module_command! \module_command!do \module_command!redo
or maybe
\module_command \module_command_one \module_command_two \module_command_three
or
\module_command_a \module_command_b \module_command_aa (used by _a)
+1
etc
actually we can use ^ if we want:
\module_^_command \module_^^_command
Just another form of module_!_command or module__command. Wolfgang
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row (i'll put a few mkvi modules in the core to get a feeling .. using _ does not always look better btw) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, 4 Mar 2011, Hans Hagen wrote:
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row
(i'll put a few mkvi modules in the core to get a feeling .. using _ does not always look better btw)
Here is an experiment with @ and _. I would prefer to change @ to :: (but for that we would need to change the ptrcatcodes). https://github.com/adityam/filter/raw/dev/t-filter.tex Aditya
On Sat, 5 Mar 2011, Aditya Mahajan wrote:
On Fri, 4 Mar 2011, Hans Hagen wrote:
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row
(i'll put a few mkvi modules in the core to get a feeling .. using _ does not always look better btw)
Here is an experiment with @ and _. I would prefer to change @ to :: (but for that we would need to change the ptrcatcodes).
@Hans: does it make sense to change the catcode of underscore to letter in ptrcatcodes in MkII? Or would that just open a pandora's box? Aditya
On 6-3-2011 6:39, Aditya Mahajan wrote:
On Sat, 5 Mar 2011, Aditya Mahajan wrote:
On Fri, 4 Mar 2011, Hans Hagen wrote:
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row
(i'll put a few mkvi modules in the core to get a feeling .. using _ does not always look better btw)
Here is an experiment with @ and _. I would prefer to change @ to :: (but for that we would need to change the ptrcatcodes).
@Hans: does it make sense to change the catcode of underscore to letter in ptrcatcodes in MkII? Or would that just open a pandora's box?
i have no clue ... in mkiv we have a pseudo active _ in math mode that handles it there (these "8000 codes) .. so doing it will take quite some testing so best postpone it till after the tex live code freeze as mkii is the context on tex live Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, 6 Mar 2011, Hans Hagen wrote:
@Hans: does it make sense to change the catcode of underscore to letter in ptrcatcodes in MkII? Or would that just open a pandora's box?
i have no clue ... in mkiv we have a pseudo active _ in math mode that handles it there (these "8000 codes) .. so doing it will take quite some testing so best postpone it till after the tex live code freeze as mkii is the context on tex live
OK. I will use a private catcode table in my module, so that it works wit both MkII and MkIV. Aditya
Am 06.03.2011 um 00:03 schrieb Aditya Mahajan:
On Fri, 4 Mar 2011, Hans Hagen wrote:
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row
(i'll put a few mkvi modules in the core to get a feeling .. using _ does not always look better btw)
Here is an experiment with @ and _. I would prefer to change @ to :: (but for that we would need to change the ptrcatcodes).
+1 for “:” I can then change this \unexpanded\def\annotation_placement_define {\dodoubleargument\annotation_placement__define} \def\annotation_placement__define[#name][#command]% {\setvalue{annotation:#name}{#command}} to (took the “o” from latex3 :) \unexpanded\def\annotation_placement_define {\dodoubleargument\annotation_placement_define:oo} \def\annotation_placement_define:oo[#name][#command]% {\setvalue{annotation:#name}{#command}} Wolfgang
Am 04.03.2011 um 19:56 schrieb Hans Hagen:
On 4-3-2011 7:05, Wolfgang Schuster wrote:
In which are these alternatives are better than my module__command, you replace only the _ by !
because an ! stands out; anyway, we should avoid multiple _ in a row
It may stand out but it looks even worse. I replaces now multiple _ except in a two cases where i found no solution which looks satisfying to me, this is one: \unexpanded\def\annotation_placement_define {\dodoubleargument\annotation_placement__define} \def\annotation_placement__define[#name][#command]% {\setvalue{annotation:#name}{#command}} Wolfgang
On 4-3-2011 12:55, Aditya Mahajan wrote:
Another option might be to use \<module>.<command> with . having the right catcode. That will give macro names a more OOP feel.
in a mkvi file we can actually support \module.command if we want as we can convert it into \module_command so both would be equivalent then ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Thu, 3 Mar 2011, S Barmeier wrote:
Currently I am using something like
\defineenumeration[lemma] [location=serried, headstyle=bold, text=Lemma, width=broad, style=italic]
to define theorems, lemmas, etc.
Sometimes a theorem or lemma will have its own name (e.g. Yoneda Lemma), and I find it slightly cumbersome to write something like
3.1 Theorem (Yoneda Lemma) 3.1 Lemma (Yoneda) 3.1 Lemma (Yoneda Lemma)
and was really hoping that
\startlemma[text={Yoneda Lemma}]
would give me the desired
3.1 Yoneda Lemma
but it doesn't. I would like to keep the whole setup the same and only change the text for this instance. Is there any way to implement this except for defining a whole new enumeration for one theorem/lemma/proposition by
\startenumeration[text={Yoneda Lemma},location= ... ]
@Hans: Does it make sense to redo all the theorem etc using the new structure code? There is a little difference between \startsection .... \stopsection \starttheorem .... \stoptheorem except that in enumerations the title is optional and there are a few predefined header styles (location=whatever), and enumerations have a closesymbol. That will easily allow: \startthoerem[text={Yoneda Lemma}] etc and one will also get the option of setting the list text, bookmarks, and page marks. Aditya
participants (6)
-
Aditya Mahajan
-
Hans Hagen
-
luigi scarso
-
Otared Kavian
-
S Barmeier
-
Wolfgang Schuster