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

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat Apr 11 09:07:36 CEST 2015


> Am 10.04.2015 um 15:22 schrieb Hans Hagen <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

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150411/3a93914d/attachment-0001.html>


More information about the ntg-context mailing list