[NTG-context] in text enumeration?

Aditya Mahajan adityam at umich.edu
Thu May 10 15:56:43 CEST 2007


On Tue, 8 May 2007, Michael wrote:

> On  7 May 2007, Aditya Mahajan wrote:
>
> On Mon, 7 May 2007, Michael wrote:
>
>>
>> Hi, I'd like to define a 'enumeration' so I can type \doc, \doc, which
>> expands to 'Document A', 'Document B' (so I don't have to keep track of the
>> A/B/C.
>>
>>
>> A defineenumeration does almost what I want except I want the 'Document A'
>> to be part of a sentence rather than a special heading.  (There is no
>> 'intext' option in the 'location' parameter.).
>
>> \defineenumeration[location=serried, width=broad]
>
>> (try width=fit or wide also)
>
> Thanks.  Here is a minimal example that almost works, except for the
> 'conversion'.

Ah, I remembered that this was a bug in core-des. I had corrected this 
while adding an improved support for theorems to core-des. I will be 
sending that updated file to Hans in a few days and the bug should be 
fixed. If you need an immediate fix, I can send you a patch.

> \setupoutput[pdf]
> \defineenumeration
>  [demo]
>  [text=Demo,location=serried,before=,width=fit,conversion=Character]
> \starttext
> Please see \demo\ first.
>
> Please see (\demo) afterward.
> \stoptext
>
> The space between 'Demo' and 1 is still a bit larger than normal text.  How
> to fix that?

This is not how enumerations are supposed to be used. Add style=italic 
to see what I mean. Everything after \demo to the end of the paragraph 
is a group, so you can get unexpected results, e.g.

\defineenumeration
   [demo]
   [text=Demo,location=serried,before=,width=fit,conversion=Character]

\newif\iftestcase

\def\test{ Test case is \iftestcase True \else False \fi}


  \starttext

\test

\testcasetrue

\test

  Please see \demo\ \testcasefalse \test first.

\test

  Please see (\demo) afterward.
  \stoptext

For your purpose, I will suggest something simpler:

\definenumber[demo][conversion=Character]
\setuplabeltext[demo=Demo]

\def\demo%
   {\incrementnumber[demo]%
    \bold{\labeltext{demo}\space\getnumber[demo]}}

  Please see \demo\ first.

  Please see (\demo) afterward.


If you want, it is easy to extend this definition to something like 
\definesimpleenumeration

Aditya


More information about the ntg-context mailing list