From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/3955 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Comments on \defineshortcut Date: Fri, 02 Feb 2001 10:07:25 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20010202100725.019aa100@server-1> References: <000301c08c98$30ec8b20$a3ccfea9@nuovo> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035394656 21576 80.91.224.250 (23 Oct 2002 17:37:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:37:36 +0000 (UTC) Cc: "ConTeXt" Original-To: "Giuseppe Bilotta" In-Reply-To: <000301c08c98$30ec8b20$a3ccfea9@nuovo> Xref: main.gmane.org gmane.comp.tex.context:3955 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:3955 At 01:16 PM 2/1/01 +0100, Giuseppe Bilotta wrote: >Hello, I'm playing with shortcuts now, and I found some limitations on the >current implementation. > >It's impossible to re-define shortcuts other than <>; the reason is that, once I >issue > >\defineshortcut [()][a][style=\overstrike] > >I cannot issue > >\defineshortcut [()][b][style=\underline] > >later because an "undefined control sequence" error is issued. \def\dodefineshortcut[#1][#2][#3]% {\ifthirdargument \ConvertConstantAfter\doifelse{#1}{} {\dododefineshortcut[<>][#2][#3]} {\dododefineshortcut[#1][#2][#3]}% \else\ifsecondargument \dododefineshortcut[<>][#1][#2]% \else \dododefineshortcut[<>][][#1]% \fi\fi} \defineshortcut [()][a][commando=\overbar] test (a:bc) test \defineshortcut [()][b][commando=\underbar] test (b:abc) test >Second problem: ligs fail in some cases (if I \defineshortcut >[--][o][style\overstrike] then the following lines misses a few beats: > >it seems -o:to work- well--does it?---really? see it this way: in --- the first - picks up everything uuntil the next - so the third - triggers a new - which cannot find its matching - >Third problem: math fails too: >> >$(a+b)/(a-c-d)_{a+b}$ >with -- and ++ defined as shortcuts fail (not on parenthesis, if I make those >active too; depends on the fact that parenthesis are delimiters in math mode?) Hm, this works ok here, unless of course you redefine + a few times since then the last meaning is used. \defineshortcut[++] saves the old meaning which is + \defineshortcut[++] saves th eole meaning which is shortcut and in math mode the second one is used which means that the first shortcut is invokes. >(possibily this depends on shortcuts not being nestable); the latter is maybe >more important. not nestable indeed since they use delimited arguments. Beware: it's a dangerous mechanism anyway, esp when you load some module that expects + to be +, so: use with care. Hans PS. Actually i implemented shortcuts as a kind of joke. ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com -------------------------------------------------------------------------