Re: [NTG-context] mode dependend character handling

2006-01-14 Thread Henning Hraban Ramm

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)

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


Re: [NTG-context] mode dependend character handling

2006-01-14 Thread Mojca Miklavec
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] mode dependend character handling

2006-01-14 Thread Henning Hraban Ramm

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)

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


Re: [NTG-context] mode dependend character handling

2006-01-14 Thread Taco Hoekwater

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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] mode dependend character handling

2006-01-14 Thread Mojca Miklavec
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] mode dependend character handling

2006-01-06 Thread Taco Hoekwater



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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] mode dependend character handling

2006-01-06 Thread Mojca Miklavec
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context