[NTG-context] Request: Numbercommand key for \setupcaption

Hans Hagen pragma at wxs.nl
Sat Apr 11 15:41:11 CEST 2015


On 4/11/2015 9:07 AM, Wolfgang Schuster wrote:
>
>> Am 10.04.2015 um 15:22 schrieb Hans Hagen <pragma at wxs.nl
>> <mailto:pragma at wxs.nl>>:
>>
>> On 4/10/2015 12:38 PM, Wolfgang Schuster wrote:
>>> Hi Hans,
>>>
>>> can you add a number command key to \setupcaption because when you
>>> use a language which uses left and right labels for the number
>>> the numberstopper key can’t be used anymore to put a symbol after the
>>> float counter without misusing the label texts.
>>>
>>>
>>> For example the following example should print
>>>
>>>     LEFT 1 RIGHT: Dummy figure
>>>
>>> as figure caption but it shows only
>>>
>>>     LEFT 1 RIGHT Dummy figure
>>>
>>> without the color after “RIGHT”.
>>>
>>>
>>> %%%% begin example
>>> \useMPlibrary[dum]
>>>
>>> \setuplabeltext[en][figure={LEFT , RIGHT}]
>>>
>>> \definereferenceformat[infigure][label=*]
>>>
>>> \setupcaption[figure][numbercommand=\groupedcommand{}{:}]
>>>
>>> \starttext
>>>
>>> \startplacefigure[reference=fig:dummy,title=Dummy figure]
>>> \externalfigure[dummy]
>>> \stopplacefigure
>>>
>>> See \infigure[fig:dummy].
>>>
>>> \stoptext
>>> %%%% end example
>>
>> beta:
>>
>> \useMPlibrary[dum]
>>
>> \setuplabeltext[en][figure={LEFT , RIGHT}]
>>
>> \definereferenceformat[infigure][label=*]
>>
>> \setupcaption
>>  [figure]
>>  [textcommand=\groupedcommand{<}{>},
>>   numbercommand=\groupedcommand{[}{]}]
>>
>> \starttext
>>
>>    \startplacefigure[reference=fig:dummy,title=Dummy figure]
>>        \externalfigure[dummy]
>>    \stopplacefigure
>>
>>    See \infigure[fig:dummy].
>>
>> \stoptext
>
> The numbercommand key should include the labels.
>
> \unprotect
> \unexpanded\def\thecurrentfloatnumber
>    {\ifnofloatcaption \else \ifnofloatnumber \else
>       \ifx\currentfloatnumber\relax\else
>         \floatcaptionparameter\c!numbercommand
>           {\namedtaggedlabeltexts
>             \t!floatlabel \currentfloat
>             \t!floatnumber\currentfloat
>
>   {\clf_savedlistprefixednumber{\currentfloat}\currentfloatnumber\relax
>                \thecurrentfloatnumbersuffix}}%
>       \fi
>     \fi \fi}
> \protect
>
> \useMPlibrary[dum]
>
> \setuplabeltext[en][figure={LEFT , RIGHT}]
>
> \definereferenceformat[infigure][label=*]
>
> \setupcaption
>   [figure]
>   [textcommand=\groupedcommand{<}{>},
>    numbercommand=\groupedcommand{[}{]}]
>
> \starttext
>
>     \startplacefigure[reference=fig:dummy,title=Dummy figure]
>         \externalfigure[dummy]
>     \stopplacefigure
>
>     See \infigure[fig:dummy].
>
> \stoptext

hm, tricky as then the part wrapped around the number will not get 
tagged properly ... needs a bit more work

-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------


More information about the ntg-context mailing list