On Fri, 19 Jan 2007, Taco Hoekwater wrote:
Aditya Mahajan wrote:
4. The theorem should have a title. The title should be optional.
Is partially implemented
I used to work around that by defining a layer on top of the
enumerations that always define the enumeration's settings
on the fly. Quite inefficient, but it worked OK. Support in the
core would be much nicer, though.
Here is my first attempt. I added new keys titleleft, titleright, and
titlecommand to provide more customization. The solution is not
pretty, mainly because title was an afterthought, rather than being
there from the beginning.
% This is the usual visual output
\defineenumeration
[lemma]
[ title=yes,
text=Lemma,
titledistance=.5em,
textdistance=1em,
titlestyle=bold,
titleleft=(,
titleright=),
stopper=.,
location=hanging,
style=italic,
]
\startlemma {with a title of a certain length}
\input tufte
\stoplemma
\startlemma
With no title
\input tufte
\stoplemma
Basically, works with and without any title.
The list of enumerations does not look good, and I do not know how to
configure it.
The last things, that is the end of proof marker, is right now not
possible in ConTeXt. There are a lot of things that need to be taken
care of while having a end-of-proof marker: basically, you need to
ensure that there is no page break between the proof and the marker.
Also the marker needs to be moved up or down, depending on how the
proof ends. At the very least, ConTeXt should have something that
ensures that the end of proof marker does not go onto a page of its
own.
End of proof markers are a pain, and I see no easy solution.
I will try to implement a rudimetary support for end of proof markers,
something similar to what amsthm does. The right way to do it is too
complicated for me to understand :-(
The code is attached and suggestions for improvement are welcome.
Aditya
\unprotect
%D Temporary
\def\c!titleleft{titleleft}
\def\c!titleright{titleright}
\def\c!titlecommand{titlecommand}
%D To be added to syst-ext.tex
\def\dowithoptargument#1%
{\def\useoneargument##1{#1{##1}}
\def\fakeoneargument{#1{}}
\doifnextcharelse\bgroup{\useoneargument}{\fakeoneargument}}
%D Patch for core-des.tex
\def\@@startdescription[#1][#2]%
{\def\currentdescription{#1}%
\doifelse{\descriptionparameter\c!title}\v!yes
{\dowithoptargument{\@@startsomedescription{#1}[#2]}}
{\@@startsomedescription{#1}[#2]{}}}
\def\@@description[#1][#2]%
{\def\currentdescription{#1}%
\doifelse{\descriptionparameter\c!title}\v!yes
{\dowithoptargument{\@@somedescription{#1}[#2]}}
{\@@somedescription{#1}[#2]{}}}
\def\special@@descriptionhandler[#1]#2#3%
{\strut
\doifelse{\descriptionparameter\c!number}\v!no
\!!doneafalse{\doifelse{#1}{-}\!!doneafalse\!!doneatrue}%
\chardef\descriptioncoupling\zerocount
\iflocation
\doifsomething{\descriptionparameter\c!coupling}
{\processaction % genereert > of <
[\descriptionparameter\c!couplingway]
[ \v!local=>\chardef\descriptioncoupling\plusone, % old: default
\v!global=>\chardef\descriptioncoupling\plustwo]}% new: global
crosslinking
\fi
\setupnumber % the number is called indirectly
[\currentdescriptionnumber]
[\c!sectionnumber=\descriptionparameter\c!sectionnumber]%
\if!!donea
\makeprecedingsectionnumber[\currentdescriptionnumber]%
\prepareprefixnumber{\??dd\currentdescription}\precedingsectionnumber\preparednumber
\iftrialtypesetting\startlocal\fi
\getvalue{\e!next\currentdescription}% tricky but we need the preroll
\iftrialtypesetting\stoplocal\fi
% \getvalue{\e!next#2#1}%
\iflocation
\bgroup
\letvalue{\??dd\currentdescription\c!sectionnumber}\v!yes
\protectconversion
\makeprecedingsectionnumber[\currentdescriptionnumber]%
\prepareprefixnumber{\??dd\currentdescription}\precedingsectionnumber\preparednumber
\ifcase\descriptioncoupling \or
\xdef\@@internalenumber{\doshowdnnumber}%
\rawreference\s!num{#1:\@@internalenumber}{}%
\or
\xdef\@@internalenumber{\countervalue{\??dd\c!coupling\currentdescription}}%
\rawreference\s!num{\currentdescription:\@@internalenumber}{}%
\fi
\egroup
\fi
%\makeprecedingsectionnumber[\currentdescriptionnumber]%
%\prepareprefixnumber{\??dd\currentdescription}\precedingsectionnumber\preparednumber
\disablepseudocaps % sorry, uppercase causes troubles
\doattributes % \nocase primitive needed
{\??dd\currentdescription}\c!headstyle\c!headcolor % todo: sub as well
{\descriptionparameter\c!command
{\showdntext
% \domakednnumber % right should be after the title
\descriptionparameter\c!left
\strut\doshowdnnumber
\doif{\descriptionparameter\c!title}\v!yes % new, for david antos
{\doifsomething{#2}
{\doattributes{\??dd\currentdescription}\c!titlestyle\c!titlecolor
{\hskip\descriptionparameter\c!titledistance%
% \descriptionparameter\c!titlecommand%
{\descriptionparameter\c!titleleft%
\begstrut#2\endstrut%
\descriptionparameter\c!titleright}}}}%
% Remaining part of \domakednnumbed
\descriptionparameter\c!stopper
\descriptionparameter\c!right
}}% \c!command is hook for taco
\doifsomething{\descriptionparameter\c!list} % also for david antos
{\dowritetolist
{\descriptionparameter\c!type:\descriptionparameter\c!list}
{\showdnlisttext\doshowdnnumber}{#2}{\currentdescription}}%
\iflocation\ifcase\descriptioncoupling \else
\edef\localconnection{\descriptionparameter\c!coupling:\@@internalenumber}%
\doifreferencefoundelse\localconnection
{\in[\localconnection]}\donothing % genereert > of <
\fi\fi
\doifnot{#1}{-}{\rawreference\s!num{#1}{\doshowdnnumber}}%
\else % Why was this strange expansion needed?
\edef\!!stringa{\showdnpuretext}% nog eens testen binnen \expanded
\expanded{\doattributes{\??dd\currentdescription}\noexpand\c!headstyle\noexpand\c!headcolor
{\noexpand\descriptionparameter\noexpand\c!command{\!!stringa}}}%
\doifnot{#1}{-}{\rawreference\s!num{#1}{}}%
\fi}
\protect
\starttext
\defineenumeration
[lemma]
[ title=yes,
text=Lemma,
titledistance=.5em,
textdistance=1em,
% left=***,
% right=**,
% command=\framed,
% titlecommand=\inframed,
titlestyle=bold,
titleleft=(,
titleright=),
stopper=.,
location=hanging,
style=italic,
]
\startlemma[lemma 1] {with a title of a certain length}
\input tufte
\stoplemma
\startlemma[lemma 2]
With no title
\input tufte
\stoplemma
We have two lemmas, \in Lemma[lemma 1] and \in Lemma[lemma 2].
\stoptext
_______________________________________________
ntg-context mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/ntg-context