From: Hans Hagen <pragma@wxs.nl>
Cc: "ConTeXt" <ntg-context@ntg.nl>
Subject: Re: Active character sequences
Date: Sun, 26 Nov 2000 21:28:15 +0100 [thread overview]
Message-ID: <3.0.6.32.20001126212815.01e0c640@pop.wxs.nl> (raw)
In-Reply-To: <000101c05665$ec7eea40$a3ccfea9@nuovo>
At 10:18 PM 11/24/00 +0100, Giuseppe Bilotta wrote:
>Hello, these are a few things I would like to obtain with ConTeXt now:
>
>1) I would like to have << and >> as synonyms for |<| and |>|;
This is a bad idea, since < [ ( are used for special purposes. Making <
active an active character is not a problem, but it may clash with other
functionality.
>2) I would like to be able to define in and easy way similar commands, to
>give similar meanings to [[ and ]] (giving hollow opening and closing
>brackets, which I have already assigned to appropriate cs's);
That would brake all [parameters] since from then on "[ the active char"
would be different from "[ the other char' (in tex characters can have 16
different states!). Partial hacks are possible but never 100% safe.
If your font would have a << as a ligature, it would be ok.
>3) At the same time, I would like to use [ ... ] pairs as described in the
>cont-new.tex module (\defineshortcuts, which only works with < ... > pairs);
eh, core-new.tex i suppose, unless you have an old version
>is there a way to implement 2) without conflicting with 3)? Or to implement
>1) without conflicting with \defineshortcuts?
For the same reasons, as under (2) we can not use [] here, unless under a
specific regime, like:
\startshortcuts
no setup commands, only [short] cuts
\stopshortcuts
but i see more dangers than benefits.
Anyhow, to prove the concept:
\unprotect
\def\defineshortcut%
{\dotripleargument\dodefineshortcut}
\def\dodefineshortcut[#1][#2][#3]%
{\ifthirdargument
\doifelsenothing{#1}
{\dododefineshortcut[<>][#2][#3]}
{\dododefineshortcut[#1][#2][#3]}%
\else\ifsecondargument
\dododefineshortcut[<>][#1][#2]%
\else
\dododefineshortcut[<>][][#1]%
\fi\fi}
\def\dododefineshortcut[#1#2][#3][#4]% #1 is the trigger, #2 the delimiter
{\doifundefined{\??te\??te\string#2}{\letvalue{\??te\??te\string#2}=#1}%
\defineactivecharacter #1 {\@EA\doshortcut\string#2} %
\getparameters
[\??te\string#2#3]
[\c!commandos=,\c!commando=,\c!letter=,\c!kleur=,#4]}
\def\doshortcut#1%
{\ifmmode
\getvalue{\??te\??te#1}%
\else
\bgroup
\catcode`#1=\@@other
\def\dodoshortcut##1#1%
{\def\shorttag{\??te#1}%
\def\shortcut{##1}%
\dododoshortcut##1:\end}%
\@EA\dodoshortcut
\fi}
\def\dododoshortcut#1:#2\end
{\doifelsenothing{#2}
{\doifundefinedelse{\shorttag\c!commandos}
{\shortcut}
{\@EA\dodododoshortcut\@EA\shorttag\@EA:\shortcut:\end}}
{\doifundefinedelse{\shorttag#1\c!commandos}
{\shortcut}
{\dodododoshortcut\shorttag#1:#2\end}}%
\egroup}
\def\dodododoshortcut#1:#2:\end
{\getvalue{#1\c!commandos}%
\doattributes{#1}\c!letter\c!kleur{\getvalue{#1\c!commando}{#2}}}
\defineshortcut [<>] [i] [letter=\it]
\defineshortcut [()] [b] [letter=\bf]
\defineshortcut [++] [s] [letter=\sl]
\defineshortcut [//] [u] [letter=\underbars]
\defineshortcut [--] [a] [letter=\overstrike]
it seems <i:to work> well
it seems (b:to work) well
it seems +s:to work+ well
it seems /u:to work/ well
it seems -a:to work- well
But i must admit that i never used it so far, just playing a bit around -)
Beware, this kind of trickery can spoil utility file loading in certain
cases [catcode clashing].
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE
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:[~2000-11-26 20:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-24 21:18 Giuseppe Bilotta
2000-11-24 23:04 ` Johannes H?sing
2000-11-26 10:55 ` Giuseppe Bilotta
[not found] ` <3A1FB8BE.303@ortec.nl>
2000-11-26 10:53 ` Giuseppe Bilotta
2000-11-26 20:28 ` Hans Hagen [this message]
2000-11-27 23:28 ` 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.20001126212815.01e0c640@pop.wxs.nl \
--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).