ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mode dependend character handling
@ 2006-01-02 13:36 Henning Hraban Ramm
  2006-01-06 14:39 ` Taco Hoekwater
  2006-01-06 15:08 ` Mojca Miklavec
  0 siblings, 2 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2006-01-02 13:36 UTC (permalink / raw)


(This mail was rejected as spam in my first try, and the reject  
message was catched by my spam filter...)

A happy new year!

I'd like to typeset a text in both German and Swiss German orthography,
i.e. I'd like to expand "s (or the like) to ß in German and ss in  
Swiss German mode,
or even better, automagically change ß to ss in Swiss mode.

This is what I have:
\startmode[swiss]
     \def\S#1{ss\relax}
\stopmode
\startnotmode[swiss]
     \def\S#1{\sz\relax}
\stopnotmode

That forces me to use \S{} in the middle of words, very ugly.
I know this is possible in a more sophisticated way! Please?
(My favorite solution would be to make ß expand to ss in Swiss mode.)

Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

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

* Re: mode dependend character handling
  2006-01-02 13:36 mode dependend character handling Henning Hraban Ramm
@ 2006-01-06 14:39 ` Taco Hoekwater
  2006-01-14 13:50   ` Henning Hraban Ramm
  2006-01-06 15:08 ` Mojca Miklavec
  1 sibling, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-01-06 14:39 UTC (permalink / raw)




Henning Hraban Ramm wrote:
> (This mail was rejected as spam in my first try, and the reject  message 
> was catched by my spam filter...)

No doubt that's why spam for medication is so popular: you need
the medication to cope with the rest of the spam.

> A happy new year!

Likewise!

> I'd like to typeset a text in both German and Swiss German orthography,
> i.e. I'd like to expand "s (or the like) to ß in German and ss in  Swiss 
> German mode,
> or even better, automagically change ß to ss in Swiss mode.

The correct way would be to define swiss as a language, because
then you can put a suitable redefinition inside the language
specifics, but the following hack will work as well and is a lot
faster to implement (please don't tell anyone I proposed this):

   \enableregime[il1]
   \let\normalssharp\ssharp
   \def\ssharp{\doifmodeelse{swiss}{ss}{\normalssharp}}
   \starttext
   {\enablemode[swiss] Grüßlis} Grüßlis
   \stoptext

Cheers, Taco

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

* Re: mode dependend character handling
  2006-01-02 13:36 mode dependend character handling Henning Hraban Ramm
  2006-01-06 14:39 ` Taco Hoekwater
@ 2006-01-06 15:08 ` Mojca Miklavec
  1 sibling, 0 replies; 10+ messages in thread
From: Mojca Miklavec @ 2006-01-06 15:08 UTC (permalink / raw)


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

Henning Hraban Ramm wrote:
> I'd like to typeset a text in both German and Swiss German orthography,
> i.e. I'd like to expand "s (or the like) to ß in German and ss in
> Swiss German mode,

If everything is set OK in the regime you're using, this should work:

\startmode[swiss]
\definecharacter ssharp {ss}
\stopmode

Mojca

[-- Attachment #2: 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] 10+ messages in thread

* Re: mode dependend character handling
  2006-01-06 14:39 ` Taco Hoekwater
@ 2006-01-14 13:50   ` Henning Hraban Ramm
  2006-01-14 19:35     ` Mojca Miklavec
  2006-01-15 18:16     ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2006-01-14 13:50 UTC (permalink / raw)


Sorry for answering that late.

> The correct way would be to define swiss as a language, because
> then you can put a suitable redefinition inside the language
> specifics, but the following hack will work as well and is a lot
> faster to implement (please don't tell anyone I proposed this):
>
>   \enableregime[il1]
>   \let\normalssharp\ssharp
>   \def\ssharp{\doifmodeelse{swiss}{ss}{\normalssharp}}

Thank you, that works and is just the right solution for my problem.

Mojca's proposal:

> \startmode[swiss]
> \definecharacter ssharp {ss}
> \stopmode

unfortunately doesn't work, at least not with utf regime and ec  
encoding.




Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

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

* Re: mode dependend character handling
  2006-01-14 13:50   ` Henning Hraban Ramm
@ 2006-01-14 19:35     ` Mojca Miklavec
  2006-01-14 21:10       ` Henning Hraban Ramm
  2006-01-15 18:16     ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2006-01-14 19:35 UTC (permalink / raw)


Henning Hraban Ramm wrote:

> Mojca's proposal:
>
> > \startmode[swiss]
> > \definecharacter ssharp {ss}
> > \stopmode
>
> unfortunately doesn't work, at least not with utf regime and ec
> encoding.

Since Taco's proposal is OK, you don't need this, but I'll reply
anyway. The problem is caused by "wrong order" of commands. If you
load ec encoding AFTER this command, your new definition of ssharp
will be overridden by the encoding definition again.

Compare:

\enableregime[utf] % may be whatever, no influence

\startmode[swiss]
    \definecharacter ssharp {ss}
\stopmode
\usetypescript[modern][ec] % or texnansi
\setupbodyfont[modern]
\starttext
Maß Bier! % fails (prints ß)
\stoptext

with:

\usetypescript[modern][ec] % or texnansi
\setupbodyfont[modern]
\startmode[swiss]
    \definecharacter ssharp {ss}
\stopmode
\starttext
Maß Bier! % prints ss
\stoptext

(Since ec encoding is the default one on my system, I had to use
texnansi in order to make the example fail.)

If you use a slightly longer variant

\startencoding[ec]
    \startmode[swiss]
        \definecharacter ssharp {ss}
    \stopmode
\stopencoding

than the order of commands doesn't matter any more (but then the
automatic conversion will only work for the ec encoding).

But now my question for Taco: why does your example work in both
cases? Does \def have a higher priority than \definecharacter?

Thanks,
    Mojca

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

* Re: mode dependend character handling
  2006-01-14 19:35     ` Mojca Miklavec
@ 2006-01-14 21:10       ` Henning Hraban Ramm
  2006-01-14 22:44         ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2006-01-14 21:10 UTC (permalink / raw)


Am 2006-01-14 um 20:35 schrieb Mojca Miklavec:
> Since Taco's proposal is OK, you don't need this, but I'll reply
> anyway. The problem is caused by "wrong order" of commands. If you
> load ec encoding AFTER this command, your new definition of ssharp
> will be overridden by the encoding definition again.
> ...
> (Since ec encoding is the default one on my system, I had to use
> texnansi in order to make the example fail.)

ec is my default encoding, too, so I didn't use any changing commands.

> \startencoding[ec]
>     \startmode[swiss]
>         \definecharacter ssharp {ss}
>     \stopmode
> \stopencoding
> than the order of commands doesn't matter any more (but then the
> automatic conversion will only work for the ec encoding).

No, it doesn't.
And I don't find any errors in the log.


Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

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

* Re: mode dependend character handling
  2006-01-14 21:10       ` Henning Hraban Ramm
@ 2006-01-14 22:44         ` Taco Hoekwater
  2006-01-14 23:02           ` Mojca Miklavec
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-01-14 22:44 UTC (permalink / raw)


Henning Hraban Ramm wrote:
>> \startencoding[ec]
>>     \startmode[swiss]
>>         \definecharacter ssharp {ss}
>>     \stopmode
>> \stopencoding
>> than the order of commands doesn't matter any more (but then the
>> automatic conversion will only work for the ec encoding).

mode processing is based on modes that are in effect
at the execution time of the \startmode macro, not
the typeset time. This would work:

   \enablemode[swiss]
   \startencoding[ec]
      \startmode[swiss]
          \definecharacter ssharp {ss}
      \stopmode
   \stopencoding

but then it would be on always, since it effectively becomes

   \startencoding[ec]
      \definecharacter ssharp {ss}
   \stopencoding

whereas without the \enablemode it becomes only:

   \startencoding[ec]
   \stopencoding

which does nothing.

HTH,

Taco

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

* Re: mode dependend character handling
  2006-01-14 22:44         ` Taco Hoekwater
@ 2006-01-14 23:02           ` Mojca Miklavec
  2006-01-14 23:31             ` Henning Hraban Ramm
  0 siblings, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2006-01-14 23:02 UTC (permalink / raw)


Taco Hoekwater wrote:
> Henning Hraban Ramm wrote:
> >> \startencoding[ec]
> >>     \startmode[swiss]
> >>         \definecharacter ssharp {ss}
> >>     \stopmode
> >> \stopencoding
> >> than the order of commands doesn't matter any more (but then the
> >> automatic conversion will only work for the ec encoding).
>
> mode processing is based on modes that are in effect
> at the execution time of the \startmode macro, not
> the typeset time. This would work:
>
>    \enablemode[swiss]
>    \startencoding[ec]
>       \startmode[swiss]
>           \definecharacter ssharp {ss}
>       \stopmode
>    \stopencoding
>
> but then it would be on always, since it effectively becomes
>
>    \startencoding[ec]
>       \definecharacter ssharp {ss}
>    \stopencoding
>
> whereas without the \enablemode it becomes only:
>
>    \startencoding[ec]
>    \stopencoding
>
> which does nothing.

OK, thanks Taco. Now I understand the problem. I always compiled with or without
    texexec --mode=swiss
which worked fine. If mixing modes within the same document is
required (\enablemode/\disablemode[swiss]), it fails of course (I
didn't think about it).

Mojca

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

* Re: mode dependend character handling
  2006-01-14 23:02           ` Mojca Miklavec
@ 2006-01-14 23:31             ` Henning Hraban Ramm
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2006-01-14 23:31 UTC (permalink / raw)


> OK, thanks Taco. Now I understand the problem. I always compiled  
> with or without
>     texexec --mode=swiss
> which worked fine. If mixing modes within the same document is
> required (\enablemode/\disablemode[swiss]), it fails of course (I
> didn't think about it).

Ah, ok, I didn't test with --mode, even if that will be my normal use  
case.

Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

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

* Re: mode dependend character handling
  2006-01-14 13:50   ` Henning Hraban Ramm
  2006-01-14 19:35     ` Mojca Miklavec
@ 2006-01-15 18:16     ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-01-15 18:16 UTC (permalink / raw)


Henning Hraban Ramm wrote:

> Sorry for answering that late.
>
>> The correct way would be to define swiss as a language, because
>> then you can put a suitable redefinition inside the language
>> specifics, but the following hack will work as well and is a lot
>> faster to implement (please don't tell anyone I proposed this):
>>
>>   \enableregime[il1]
>>   \let\normalssharp\ssharp
>>   \def\ssharp{\doifmodeelse{swiss}{ss}{\normalssharp}}
>
>
> Thank you, that works and is just the right solution for my problem.
>
> Mojca's proposal:
>
>> \startmode[swiss]
>> \definecharacter ssharp {ss}
>> \stopmode
>
>
> unfortunately doesn't work, at least not with utf regime and ec  
> encoding.

\startmode[*de]
  ...

languages have system modes (star prefix in order to prevent clashes 
with user modes)

Hans

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

end of thread, other threads:[~2006-01-15 18:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-02 13:36 mode dependend character handling Henning Hraban Ramm
2006-01-06 14:39 ` Taco Hoekwater
2006-01-14 13:50   ` Henning Hraban Ramm
2006-01-14 19:35     ` Mojca Miklavec
2006-01-14 21:10       ` Henning Hraban Ramm
2006-01-14 22:44         ` Taco Hoekwater
2006-01-14 23:02           ` Mojca Miklavec
2006-01-14 23:31             ` Henning Hraban Ramm
2006-01-15 18:16     ` Hans Hagen
2006-01-06 15:08 ` Mojca Miklavec

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