From: Hans Hagen <pragma@wxs.nl>
Cc: "ConTeXt" <ntg-context@ntg.nl>
Subject: Re: Comments on \defineshortcut
Date: Fri, 02 Feb 2001 10:07:25 +0100 [thread overview]
Message-ID: <3.0.6.32.20010202100725.019aa100@server-1> (raw)
In-Reply-To: <000301c08c98$30ec8b20$a3ccfea9@nuovo>
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
-------------------------------------------------------------------------
next prev parent reply other threads:[~2001-02-02 9:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-01 12:16 Giuseppe Bilotta
2001-02-02 9:07 ` Hans Hagen [this message]
2001-02-02 21:47 ` Giuseppe Bilotta
2001-02-04 17:52 ` Hans Hagen
2001-02-04 17:53 ` Hans Hagen
2001-02-02 23:18 ` Giuseppe Bilotta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3.0.6.32.20010202100725.019aa100@server-1 \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).