From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/3461 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Active character sequences Date: Sun, 26 Nov 2000 21:28:15 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20001126212815.01e0c640@pop.wxs.nl> References: <000101c05665$ec7eea40$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 1035394191 17297 80.91.224.250 (23 Oct 2002 17:29:51 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:29:51 +0000 (UTC) Cc: "ConTeXt" Original-To: "Giuseppe Bilotta" In-Reply-To: <000101c05665$ec7eea40$a3ccfea9@nuovo> Xref: main.gmane.org gmane.comp.tex.context:3461 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:3461 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 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 -------------------------------------------------------------------------