[NTG-context] About \defineshortcut

Radhelorn radhelorn at mail.ru
Wed Dec 21 08:53:34 CET 2005


Hans Hagen wrote:
> Radhelorn wrote:
>> I think that \defineshortcut commands are most useful inside some 
>> environment (start/stop pair). So it is possible to have such 
>> environment that restores back all catcode changes (or other variable 
>> changes) made inside it (like local variables in some programming 
>> laguages)? This can have many other uses.
>>
> i have no idea why you use shortcuts (i implemented it as a gimmick -)

Well I was reading sources and stumbled over these commands. I am using 
shortcuts to typeset programming examples in non standard languages and 
pseudo-code.

> 
> grouping is doable with:
> 
> \starttext
> 
> \startsetups whatever
>    \defineshortcut [b] [style=bold]
>    \defineshortcut [e] [style=slanted]
> \stopsetups
> 
> \definestartstop[whatever][commands=\setups{whatever}]
> 
> \input tufte
> 
> oeps <b:oeps> or <e:oeps>
> 
> \startwhatever
> oeps <b:oeps> or <e:oeps>
> \stopwhatever
> 
> oeps <b:oeps> or <e:oeps>
> 
> \input tufte
> 
> \stoptext
> 

Many thanks! I've looked this indeed!

It is a pity that such useful command (setups) remains undocumented. As 
far as I understand inside setups can be any commands and environment 
changes are fully restored after their execution. Right? And \setups 
command can replace any single command (in arguments and such).

If this is OK, then I will try to collect some more examples and post 
them on the WIKI later this week.

-- 
Radhelorn <radhelorn at mail.ru>


More information about the ntg-context mailing list