(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!
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.
Thank you, that works and is just the right solution for my problem. Mojca's proposal:
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:
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:
ec is my default encoding, too, so I didn't use any changing commands.
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:
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:
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
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)
participants (4)
-
Hans Hagen
-
Henning Hraban Ramm
-
Mojca Miklavec
-
Taco Hoekwater