(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)
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
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)
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
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)
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
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
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)
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
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
participants (4)
-
Hans Hagen
-
Henning Hraban Ramm
-
Mojca Miklavec
-
Taco Hoekwater