[NTG-context] \definehighlight + \words | \WORDS

Hans Hagen pragma at wxs.nl
Tue May 8 13:17:35 CEST 2012


On 8-5-2012 11:18, Philipp Gesang wrote:
> On 2012-05-08 11:07, Wolfgang Schuster wrote:
>>
>> Am 08.05.2012 um 10:35 schrieb Philipp Gesang:
>>
>>> Dear listmates,
>>>
>>> I rely on automated uppercasing and lowercasing a lot and I’m
>>> very happy with the \words and \WORD macros. But I can’t find a
>>> way to properly combine them with the “style” parameter of
>>> highlights: it breaks frames and enumerations. Example:
>>>
>>> ········································································
>>>
>>> \definehighlight [tolower] [style=\words,]  %%% This is problematic.
>>> \def\mylower#1{\bgroup\words#1\egroup}      %%% The command itself
>>>                                             %%% works, though.
>>>
>>> \starttext
>>>
>>> FOO \tolower{FOO} FOO\par         %%% Works.
>>> \framed{BAR \mylower{BAR} BAR}    %%% Works.
>>> \framed{BAR \tolower{BAR} BAR}    %%% Fails.
>>> \startitemize                     %%% Enumerations don’t work either.
>>>   \item FOO \mylower{FOO} FOO     %%% Works.
>>>   \item FOO \tolower{FOO} FOO     %%% Fails.
>>> \stopitemize
>>>
>>> \stoptext
>>>
>>> ········································································
>>>
>>> In short: while I can always wrap it in a \def, the more elegant
>>> doesn’t work in all cases. Is there anything wrong with my
>>> approach?
>>
>> You can use
>>
>>    \definehighlight [tolower] [style={\setcharactercasing[2]}]
>>
>> to create the \tolower command.
>
> Perfect, thanks a lot. So it was caused by the \groupedcommand in
> the definition of \word.

The next version will support named casing:

WORD
word
Word
Words
capitals cap
Capitals Cap
none
random




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