[NTG-context] About \defineshortcut
Hans Hagen
pragma at wxs.nl
Tue Dec 20 23:28:41 CET 2005
Radhelorn wrote:
> Taco Hoekwater wrote:
>
>>> For example after command:
>>>
>>> \defineshortcut [//] [] [style=\em]
>>
>>
>>> I can get slash only by \textslash (which is expected) and it breaks
>>> things like:
>>>
>>> \typefile {some/dir/file}
>>>
>>> So how to revert to previous meaning of '/'? It is possible to do it
>>> only temporarily?
>>
>>
>> Explicit \start a /b/ c \stop style grouping is normally best, but
>> a shortcut is just an active character with a closing defimiter,
>> so this will work for you special case:
>>
>> \catcode`\/=\other
>> \typefile {some/dir/file}
>> \catcode`\/=\active
>>
>
> I've experimented with various macros to undefine/temporarily disable
> shortcuts and found that most convenient variant is to insert this
> catcode changing into \typefile command. Why not to do this for every
> command, that accepts path parameters? This slows process down too much?
>
> But this is just an afterthought.
>
> 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 -)
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
Hans
More information about the ntg-context
mailing list