* Active character sequences
@ 2000-11-24 21:18 Giuseppe Bilotta
2000-11-24 23:04 ` Johannes H?sing
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-11-24 21:18 UTC (permalink / raw)
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 |>|;
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);
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);
is there a way to implement 2) without conflicting with 3)? Or to implement
1) without conflicting with \defineshortcuts?
Giuseppe Bilotta
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Active character sequences
2000-11-24 21:18 Active character sequences Giuseppe Bilotta
@ 2000-11-24 23:04 ` Johannes H?sing
2000-11-26 10:55 ` Giuseppe Bilotta
[not found] ` <3A1FB8BE.303@ortec.nl>
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Johannes H?sing @ 2000-11-24 23:04 UTC (permalink / raw)
On Fri, Nov 24, 2000 at 10:18:34PM +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 |>|;
>
> 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);
>
Both of these would clash with the notation in Noweb, which is a very
common Literate Programming tool.
--
Johannes Hüsing <hannes@ruhrau.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Active character sequences
[not found] ` <3A1FB8BE.303@ortec.nl>
@ 2000-11-26 10:53 ` Giuseppe Bilotta
0 siblings, 0 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-11-26 10:53 UTC (permalink / raw)
Cc: ConTeXt
> > 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 |>|;
> >
> By head (no docs currently here) it is
> \setuplanguage
> [leftquotation=$<<$,
> rightquotation=$>>$]
>
Well, that's not exactly what I meant. I don't want $<<$ and $>>$ to be used
by |<| and |>|, I want to write << and >> instead of |<| and |>| (like in
LaTeX).
Giuseppe Bilotta
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Active character sequences
2000-11-24 23:04 ` Johannes H?sing
@ 2000-11-26 10:55 ` Giuseppe Bilotta
0 siblings, 0 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-11-26 10:55 UTC (permalink / raw)
Johannes Hüsing 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 |>|;
> >
> > 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);
> >
>
> Both of these would clash with the notation in Noweb, which is a very
> common Literate Programming tool.
>
Granted (even if I don't use Noweb, and only use, seldom, (C)WEB; what is
Noweb? References, anyone?). But what if I wanted to use them anyway?
Giuseppe Bilotta
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Active character sequences
2000-11-24 21:18 Active character sequences Giuseppe Bilotta
2000-11-24 23:04 ` Johannes H?sing
[not found] ` <3A1FB8BE.303@ortec.nl>
@ 2000-11-26 20:28 ` Hans Hagen
2000-11-27 23:28 ` Giuseppe Bilotta
3 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2000-11-26 20:28 UTC (permalink / raw)
Cc: ConTeXt
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Active character sequences
2000-11-24 21:18 Active character sequences Giuseppe Bilotta
` (2 preceding siblings ...)
2000-11-26 20:28 ` Hans Hagen
@ 2000-11-27 23:28 ` Giuseppe Bilotta
3 siblings, 0 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2000-11-27 23:28 UTC (permalink / raw)
Ok, the game is not worth the candle. I will keep the suggestions in mind,
anyway, in case they might turn useful (especially the local-usableness in
specific contexts). Thank you all.
Giuseppe Bilotta
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2000-11-27 23:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-24 21:18 Active character sequences 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
2000-11-27 23:28 ` Giuseppe Bilotta
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).