ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* uppercasing accented characters, mappings and \WORD
@ 2005-08-04  9:52 Mojca Miklavec
  2005-08-04 11:02 ` Taco Hoekwater
       [not found] ` <42F1FC71.6000707@wxs.nl>
  0 siblings, 2 replies; 5+ messages in thread
From: Mojca Miklavec @ 2005-08-04  9:52 UTC (permalink / raw)


Hello,

If I use the latin2 encoding (il2), \WORD works OK if I simply type 
accented characters. Under UTF-8, uppercasing \zcaron also works OK, but 
fails if I simply type 'ž'. I saw the \definemapping[il2] and I can 
write a mapping for windows-1250 regime as well, but how exactly is this 
done for unicode, where the character codes exceed 255?

Could perhaps alternatively \WORD, \defineactivetoken or any other part 
of code be extended, so that \WORD would be happy with the typed 
accented characters as well? \Zcaron is already defined somewhere to be 
the uppercased \zcaron, so defining the same for every single 
regime/encoding manually seems redundant and error-prone.

Thank you,
	Mojca

(I don't have any editor to support latin2 under windows (except 
Mozilla), even for unicode vim and Windows are fighting against each 
other, so windows-1250 is the only reasonable thing that I can use 
comfortably.)

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

* Re: uppercasing accented characters, mappings and \WORD
  2005-08-04  9:52 uppercasing accented characters, mappings and \WORD Mojca Miklavec
@ 2005-08-04 11:02 ` Taco Hoekwater
  2005-08-04 11:25   ` Hans Hagen
       [not found] ` <42F1FC71.6000707@wxs.nl>
  1 sibling, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2005-08-04 11:02 UTC (permalink / raw)




Mojca Miklavec wrote:
> Hello,
> 
> If I use the latin2 encoding (il2), \WORD works OK if I simply type 
> accented characters. Under UTF-8, uppercasing \zcaron also works OK, but 

It fails because \zcaron expands prematurely. Perhaps this is an option:

   \def\definecharacter#1 #2 %
     {\ifundefined{#1}\unexpanded\setvalue{#1}...

instead of

   \def\definecharacter#1 #2 %
     {\ifundefined{#1}\setvalue{#1}...


(not sure if that would break stuff, but it seems sensible to me).

Cheers,
Taco

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

* Re: uppercasing accented characters, mappings and \WORD
  2005-08-04 11:02 ` Taco Hoekwater
@ 2005-08-04 11:25   ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2005-08-04 11:25 UTC (permalink / raw)


Taco Hoekwater wrote:

>
>
> Mojca Miklavec wrote:
>
>> Hello,
>>
>> If I use the latin2 encoding (il2), \WORD works OK if I simply type 
>> accented characters. Under UTF-8, uppercasing \zcaron also works OK, but 
>
>
> It fails because \zcaron expands prematurely. Perhaps this is an option:
>
>   \def\definecharacter#1 #2 %
>     {\ifundefined{#1}\unexpanded\setvalue{#1}...
>
> instead of
>
>   \def\definecharacter#1 #2 %
>     {\ifundefined{#1}\setvalue{#1}...
>
>
> (not sure if that would break stuff, but it seems sensible to me).

that will break other stuff (where we want/need expansion) 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: uppercasing accented characters, mappings and \WORD
       [not found]     ` <42F20D03.5030106@elvenkind.com>
@ 2005-08-04 14:44       ` Mojca Miklavec
  2005-08-04 16:54         ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Mojca Miklavec @ 2005-08-04 14:44 UTC (permalink / raw)


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

Taco Hoekwater wrote:
> 
> This works (but it is a bit ugly)
> 
> \def\WORD#1{%
>    \bgroup
>    \the \everyuppercase
>    \let \smallcapped \firstofoneargument
>    \let \WORD \firstofoneargument
>    \pushmacro \dohandleaccent
>    \pushmacro \dohandlecommand
>    \pushmacro \dohandlecharacter
>    \keepencodedtokens
>    \edef\tempa{#1}%
>    \popmacro \dohandleaccent
>    \popmacro \dohandlecommand
>    \popmacro \dohandlecharacter
>    \expandafter \uppercase \expandafter {\tempa}%
>    \egroup }

Thank you, Taco!

I cannot judge about the elegance of the solution as I have never seen
any elegant TeX macro definitions :), but it works (at least on my
examples) which is the most important part. Also the cp1250 regime
(where no mappings were defined) is now happy with it :)

Just for fun, I also tried it on greek (just copy-pasted some letters
from http://www.unics.uni-hannover.de/nhtcapri/multilingual1.html). It
doesn't work there, but I didn't even expect it to work as I should
probably provide the proper fonts and encodings first anyway. I've
seen some strange Greek stuff a while ago, which could have been
definitions of capitals, but as I neither understand Greek nor "TeX",
I can't judge about it.

> do you have a zipped example?

Is this still relevant? Well, as it was only 11kb, I attached it anyway.

Thank you,
    Mojca

[-- Attachment #2: word.zip --]
[-- Type: application/zip, Size: 10592 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: uppercasing accented characters, mappings and \WORD
  2005-08-04 14:44       ` Mojca Miklavec
@ 2005-08-04 16:54         ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2005-08-04 16:54 UTC (permalink / raw)


Mojca Miklavec wrote:

>Taco Hoekwater wrote:
>  
>
>>This works (but it is a bit ugly)
>>
>>\def\WORD#1{%
>>   \bgroup
>>   \the \everyuppercase
>>   \let \smallcapped \firstofoneargument
>>   \let \WORD \firstofoneargument
>>   \pushmacro \dohandleaccent
>>   \pushmacro \dohandlecommand
>>   \pushmacro \dohandlecharacter
>>   \keepencodedtokens
>>   \edef\tempa{#1}%
>>   \popmacro \dohandleaccent
>>   \popmacro \dohandlecommand
>>   \popmacro \dohandlecharacter
>>   \expandafter \uppercase \expandafter {\tempa}%
>>   \egroup }
>>    
>>
>
>Thank you, Taco!
>
>I cannot judge about the elegance of the solution as I have never seen
>any elegant TeX macro definitions :), but it works (at least on my
>examples) which is the most important part. Also the cp1250 regime
>(where no mappings were defined) is now happy with it :)
>  
>
i'll add a sightly shorter variant to the kernel; i'll also fix teh case 
map tables since they have holes and wrong entries (nobody ever checked 
those chars i never use-)

>Is this still relevant? Well, as it was only 11kb, I attached it anyway.
>  
>
i googled a bit -)

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

end of thread, other threads:[~2005-08-04 16:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04  9:52 uppercasing accented characters, mappings and \WORD Mojca Miklavec
2005-08-04 11:02 ` Taco Hoekwater
2005-08-04 11:25   ` Hans Hagen
     [not found] ` <42F1FC71.6000707@wxs.nl>
     [not found]   ` <42F20010.8000107@elvenkind.com>
     [not found]     ` <42F20D03.5030106@elvenkind.com>
2005-08-04 14:44       ` Mojca Miklavec
2005-08-04 16:54         ` Hans Hagen

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).