ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Reimplementing xspace
@ 2002-01-17 12:43 Giuseppe Bilotta
  2002-01-17 22:03 ` Marco Kuhlmann
  2002-01-20 20:35 ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Giuseppe Bilotta @ 2002-01-17 12:43 UTC (permalink / raw)


Hello,

this is another request from it.comp.software.tex: reimplementing
xspace. By itself the thing is pretty easy, you just need the
code:

\catcode`\@=11
\protected\def\xspace{\futurelet\@let@token\@xspace}
\def\@xspace{%
  \ifx\@let@token\bgroup\else
  \ifx\@let@token\egroup\else
  \ifx\@let@token\/\else
  \ifx\@let@token\ \else
  \ifx\@let@token~\else
  \ifx\@let@token.\else
  \ifx\@let@token!\else
  \ifx\@let@token,\else
  \ifx\@let@token:\else
  \ifx\@let@token;\else
  \ifx\@let@token?\else
  \ifx\@let@token/\else
  \ifx\@let@token'\else
  \ifx\@let@token)\else
  \ifx\@let@token-\else
  %\ifx\@let@token\@xobeysp\else %this would be
  %                              %nobreakspace
  \ifx\@let@token\space\else
  \ifx\@let@token\blankspace\else
   \space
   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\catcode`\@=12

so the problem is rather on how to integrate this with the rest of
ConTeXt: there are some features of ConTeXt (e.g. logos,
abbreviations) for which obeying spaces should be an option. Right
now, you have to do something like:

\logo[tempTEX]{\TeX}
\def\TEX{\tempTEX\xspace}

to achieve the same result.

Any comments?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Reimplementing xspace
  2002-01-17 12:43 Reimplementing xspace Giuseppe Bilotta
@ 2002-01-17 22:03 ` Marco Kuhlmann
  2002-01-17 23:05   ` Re[2]: " Giuseppe Bilotta
  2002-01-20 19:50   ` Hans Hagen
  2002-01-20 20:35 ` Hans Hagen
  1 sibling, 2 replies; 10+ messages in thread
From: Marco Kuhlmann @ 2002-01-17 22:03 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

* Giuseppe Bilotta <bourbaki@bigfoot.com> (2002-01-17 13:43:19 +0100):

> so the problem is rather on how to integrate this with the rest of
> ConTeXt: there are some features of ConTeXt (e.g. logos,
> abbreviations) for which obeying spaces should be an option.

I think this definitely needs consideration. It belongs to a
broader topic "programmable typography", to which I would add
issues like

  - dotted abbreviations (normally, you want a dot after them,
    but not at the end of a sentence),

  - capitals (it would be great if ConTeXt could automatically
    detect sequences of capitals and optionally typeset them a
    little smaller than the rest of the text),

  - hanging punctuation (does not work for all punctuation yet,
    and does not? work for left margins),

and some others.

    Marco

[-- Attachment #2: Type: application/pgp-signature, Size: 248 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re[2]: Reimplementing xspace
  2002-01-17 22:03 ` Marco Kuhlmann
@ 2002-01-17 23:05   ` Giuseppe Bilotta
  2002-01-17 23:12     ` Marco Kuhlmann
  2002-01-20 19:50   ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Giuseppe Bilotta @ 2002-01-17 23:05 UTC (permalink / raw)
  Cc: ntg-context

MK>   - hanging punctuation (does not work for all punctuation yet,
MK>     and does not? work for left margins),

ConTeXt does this and more than this (i.e. not only hanging
punctuation but hanging everything. You need pdfTeX to run this,
though.)

--
Giuseppe "Oblomov" Bilotta


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Reimplementing xspace
  2002-01-17 23:05   ` Re[2]: " Giuseppe Bilotta
@ 2002-01-17 23:12     ` Marco Kuhlmann
  2002-01-18 11:23       ` Re[2]: " Giuseppe Bilotta
  2002-01-20 20:09       ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Marco Kuhlmann @ 2002-01-17 23:12 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

* Giuseppe Bilotta <bourbaki@bigfoot.com> (2002-01-18 00:05:17 +0100):

> ConTeXt does this and more than this (i.e. not only hanging
> punctuation but hanging everything. You need pdfTeX to run
> this, though.)

It does do left margins? Cool, I didn't know that. But I had
trouble convincing it to put the German quotes ,, '' in the
margin. Hans said that this was because they are defined as
double commas in ConTeXt, rather than as single letters.

    Marco

[-- Attachment #2: Type: application/pgp-signature, Size: 248 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re[2]: Reimplementing xspace
  2002-01-17 23:12     ` Marco Kuhlmann
@ 2002-01-18 11:23       ` Giuseppe Bilotta
  2002-01-20 20:12         ` Hans Hagen
  2002-01-20 20:09       ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Giuseppe Bilotta @ 2002-01-18 11:23 UTC (permalink / raw)
  Cc: ntg-context

Friday, January 18, 2002 Marco Kuhlmann wrote:

MK> * Giuseppe Bilotta <bourbaki@bigfoot.com> (2002-01-18 00:05:17 +0100):

>> ConTeXt does this and more than this (i.e. not only hanging
>> punctuation but hanging everything. You need pdfTeX to run
>> this, though.)

MK> It does do left margins? Cool, I didn't know that. But I had
MK> trouble convincing it to put the German quotes ,, '' in the
MK> margin. Hans said that this was because they are defined as
MK> double commas in ConTeXt, rather than as single letters.

Indeed that's the reason: such combinations like ,, and '' can only
hang properly if (1) they map to a single glyph (either by font
ligs or by intervention of the macro package) and
(2) there are appropriate \lpcode, \rpcode associated with the
resulting glyph.

I wonder if something could be done by changing the left
protruding factor of the comma, since \lowerleftdoubleninequote
maps to ,, and not a single glyph, but I'm not sure about it.

Encoding/regime mappings are indeed one of the weak spots of
ConTeXt (it figures, considering how recent they are, and how
boring it is to build the relevant tables ...). I plan to dedicate
some time to this stuff soon (say, in two weeks' time).

--
Giuseppe "Oblomov" Bilotta


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Reimplementing xspace
  2002-01-17 22:03 ` Marco Kuhlmann
  2002-01-17 23:05   ` Re[2]: " Giuseppe Bilotta
@ 2002-01-20 19:50   ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2002-01-20 19:50 UTC (permalink / raw)
  Cc: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2085 bytes --]

At 07:03 AM 1/18/2002 +0000, Marco Kuhlmann wrote:
><file://f:\mail\eudora\attach\Re Reimplementing xspace.ems 
><0880.0002>>501f5.jpg<file://f:\mail\eudora\attach\Re Reimplementing 
>xspace.ems <0880.0002>> Re Reimplementing xspace.ems

^^^^ those pgp messages cannot be quoted, only painfully copied ^^^^

 >> so the problem is rather on how to integrate this with the rest of
 >> ConTeXt: there are some features of ConTeXt (e.g. logos,
 >> abbreviations) for which obeying spaces should be an option.
 >
 >I think this definitely needs consideration. It belongs to a
 >broader topic "programmable typography", to which I would add

programmable typo depends on extensive tagging; the outcome of minimal 
tagging as in the following items depends much on the availability of 
trigger points; complications arrise when content is hidden in capsules 
(macros, boxxes) since this breaks lookahead and lookback. As a result, 
having such features available will definitely lead to suboptimal output 
unless each instance is visually tested.

 >issues like
 >
 >  - dotted abbreviations (normally, you want a dot after them,
 >    but not at the end of a sentence),

can be a feature, but never be default; a user should turn it on thereby 
knowing that checking is needed; an important question to answer is: how 
does this relate to languages.

 >  - capitals (it would be great if ConTeXt could automatically
 >    detect sequences of capitals and optionally typeset them a
 >    little smaller than the rest of the text),

can only be done with active chars and fuzzy logic; can of worms; however, 
a macro based solution is already available in \Words; tricky point: there 
is no real watertight grabbing / mapping for arbitrary chars other than 
bytecoded ones.

 >  - hanging punctuation (does not work for all punctuation yet,
 >    and does not? work for left margins),

this is already there in protruding characters in pdftex, highy 
configurable for *all* characters, left and right

 >and some others.

[supp-box and syst-* and supp-fun already provide some trickery]

Hans

[-- Attachment #1.2: 501f5.jpg --]
[-- Type: image/jpeg, Size: 2443 bytes --]

[-- Attachment #2: Type: text/plain, Size: 523 bytes --]

-------------------------------------------------------------------------
                                   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
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Reimplementing xspace
  2002-01-17 23:12     ` Marco Kuhlmann
  2002-01-18 11:23       ` Re[2]: " Giuseppe Bilotta
@ 2002-01-20 20:09       ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2002-01-20 20:09 UTC (permalink / raw)
  Cc: ntg-context

At 08:12 AM 1/18/2002 +0000, Marco Kuhlmann wrote:

>* Giuseppe Bilotta <bourbaki@bigfoot.com> (2002-01-18 00:05:17 +0100):
>
> > ConTeXt does this and more than this (i.e. not only hanging
> > punctuation but hanging everything. You need pdfTeX to run
> > this, though.)
>
>It does do left margins? Cool, I didn't know that. But I had
>trouble convincing it to put the German quotes ,, '' in the
>margin. Hans said that this was because they are defined as
>double commas in ConTeXt, rather than as single letters.

it depends on how things are defined: if '' ligatures are used, you're 
save, if boxed material is used ... [see hand-def.tex for hanging vectors]

technically spoken also boxed material can be handled, but then we need 
fake characters (bounding char with no width or so) but that is taco's area 
(since we may need a dummy font or ask thanh).

Hans
-------------------------------------------------------------------------
                                   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
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re[2]: Reimplementing xspace
  2002-01-18 11:23       ` Re[2]: " Giuseppe Bilotta
@ 2002-01-20 20:12         ` Hans Hagen
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2002-01-20 20:12 UTC (permalink / raw)
  Cc: Marco Kuhlmann, ntg-context

At 09:23 PM 1/18/2002 +0100, Giuseppe Bilotta wrote:

>Indeed that's the reason: such combinations like ,, and '' can only
>hang properly if (1) they map to a single glyph (either by font

well, we can look into this boundary char thing, but i forgot the details 
of that (thanh explained quickly to me half a year ago that it should be 
possible)

>I wonder if something could be done by changing the left
>protruding factor of the comma, since \lowerleftdoubleninequote
>maps to ,, and not a single glyph, but I'm not sure about it.

no, more something like putting a fake char after it or so

>Encoding/regime mappings are indeed one of the weak spots of
>ConTeXt (it figures, considering how recent they are, and how
>boring it is to build the relevant tables ...). I plan to dedicate
>some time to this stuff soon (say, in two weeks' time).

this is actually the area where i largely depend on users ...

Hans
-------------------------------------------------------------------------
                                   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
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Reimplementing xspace
  2002-01-17 12:43 Reimplementing xspace Giuseppe Bilotta
  2002-01-17 22:03 ` Marco Kuhlmann
@ 2002-01-20 20:35 ` Hans Hagen
  2002-01-21 14:37   ` Re[2]: " Giuseppe Bilotta
  1 sibling, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2002-01-20 20:35 UTC (permalink / raw)
  Cc: ntg-context

At 10:43 PM 1/17/2002 +0100, Giuseppe Bilotta wrote:

>this is another request from it.comp.software.tex: reimplementing

on how many lists are you ?

>xspace. By itself the thing is pretty easy, you just need the
>code:
>
>\catcode`\@=11
>\protected\def\xspace{\futurelet\@let@token\@xspace}
>\def\@xspace{%

this should be configurable so i would opt for another solution; also, it 
should be nillable;

so, before i cook up the solution (using named glyphs btw) i want to know 
if this is the same for all languages, when it should be on / off etc

>so the problem is rather on how to integrate this with the rest of
>ConTeXt: there are some features of ConTeXt (e.g. logos,
>abbreviations) for which obeying spaces should be an option. Right
>now, you have to do something like:
>
>\logo[tempTEX]{\TeX}
>\def\TEX{\tempTEX\xspace}
>
>to achieve the same result.
>
>Any comments?

it should hook into processsynonym but in such a way that it does not break 
other code because synonyms are used (here) for more purposes then you want 
to know.

Hans
-------------------------------------------------------------------------
                                   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
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re[2]: Reimplementing xspace
  2002-01-20 20:35 ` Hans Hagen
@ 2002-01-21 14:37   ` Giuseppe Bilotta
  0 siblings, 0 replies; 10+ messages in thread
From: Giuseppe Bilotta @ 2002-01-21 14:37 UTC (permalink / raw)
  Cc: ntg-context

Sunday, January 20, 2002 Hans Hagen wrote:

HH> At 10:43 PM 1/17/2002 +0100, Giuseppe Bilotta wrote:

>>this is another request from it.comp.software.tex: reimplementing

HH> on how many lists are you ?

Ehm ... many ;-)

Ok, compt.text.tex (the international TeX newsgroup),
it.comp.software.tex (the Italian TeX newsgroup), this list, the
list of the ConTeXt documentation project, the list of the
informal Italian TeX group Gilda/Guilda, and so on and so forth
...

>>xspace. By itself the thing is pretty easy, you just need the
>>code:
>>
>>\catcode`\@=11
>>\protected\def\xspace{\futurelet\@let@token\@xspace}
>>\def\@xspace{%

HH> this should be configurable so i would opt for another solution; also, it 
HH> should be nillable;

HH> so, before i cook up the solution (using named glyphs btw) i want to know 
HH> if this is the same for all languages, when it should be on / off etc

Now this is something I had never though about. Well, I think the
list is the same for all languages, and that it should always be
on (can't think of an occasion when I would want it to be off ...)
OTOH the possibility to add more tokens to the list of tokens that
don't require a space is a good idea.

>>so the problem is rather on how to integrate this with the rest of
>>ConTeXt: there are some features of ConTeXt (e.g. logos,
>>abbreviations) for which obeying spaces should be an option. Right
>>now, you have to do something like:
>>
>>\logo[tempTEX]{\TeX}
>>\def\TEX{\tempTEX\xspace}
>>
>>to achieve the same result.
>>
>>Any comments?

HH> it should hook into processsynonym but in such a way that it does not break 
HH> other code because synonyms are used (here) for more purposes then you want 
HH> to know.

;-)

Well, using features for what they weren't originally intended for
is *baaaaaad* ;-)

But more seriously: can't you just set up those "other" uses so as
not to use xspace?

--
Giuseppe "Oblomov" Bilotta


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-01-21 14:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-17 12:43 Reimplementing xspace Giuseppe Bilotta
2002-01-17 22:03 ` Marco Kuhlmann
2002-01-17 23:05   ` Re[2]: " Giuseppe Bilotta
2002-01-17 23:12     ` Marco Kuhlmann
2002-01-18 11:23       ` Re[2]: " Giuseppe Bilotta
2002-01-20 20:12         ` Hans Hagen
2002-01-20 20:09       ` Hans Hagen
2002-01-20 19:50   ` Hans Hagen
2002-01-20 20:35 ` Hans Hagen
2002-01-21 14:37   ` Re[2]: " 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).