Visually replace one character by another one automatically
Hi again everyone! I have a weird question. I sort of want to use ConTeXt to solve some of my typing laziness. :-) I explain. When typing a document, I use the normal single-quote style apostrophe ' (UTF U+0027) - the "straight" apostrophe. When typesetting the document, I want the apostrophe to appear like a comma instead. The character is the single comma quotation mark (UTF U+2019). (As both characters exist with different UTF definition , this is not a font issue.) On my computer (it's a laptop), with my keyboard language settings and all (under Ubuntu), the only apostrophe I can manage to type is the first one. From what I can understand, my French Canadian keyboard layout actually replaces the single quote key with something else more important to us -- the acute accent (no, we don't use the French azerty layout). So right now all I can do is copy-paste the right character from the Character Map... it's a bit impractical and unwieldy in the long run, so this is not a good solution. Furthermore, typing an apostrophe is second nature anyway when you've been typing since childhood -- changing such typing habit is very offputting AND it can create many mistakes. I don't want to think about it. :-) Therefore, I was wondering if there was a way to automatically replace one character with another through some TeX magic! Changing all my apostrophes in the input for single comma quotation mark when the document is compiled. Is this possible? Thanks! Jeff
Jeff Smith wrote:
When typesetting the document, I want the apostrophe to appear like a comma instead. The character is the single comma quotation mark (UTF U+2019). (As both characters exist with different UTF definition , this is not a font issue.)
This should happen automatically already. Context (well, TeX, really) is even smarter than that: If you type 'hello', it will automatically visualise that as ‘hello’. If this does not happen, something is not right with your input, and you'd better post a small example. Best wishes, Taco
Taco Hoekwater wrote:
Jeff Smith wrote:
When typesetting the document, I want the apostrophe to appear like a comma instead. The character is the single comma quotation mark (UTF U+2019). (As both characters exist with different UTF definition , this is not a font issue.)
This should happen automatically already. Context (well, TeX, really) is even smarter than that: If you type 'hello', it will automatically
It seems I was still half sleeping when I wrote that. The example should be `hello', not 'hello'.
On Nov 27, 2007 3:18 AM, Taco Hoekwater
This should happen automatically already. Context (well, TeX, really) is even smarter than that: If you type 'hello', it will automatically visualise that as 'hello'. If this does not happen, something is not right with your input, and you'd better post a small example.
Indeed, your answer made me check back old documents I had printed. The comma apostrophe was there! When you don't think about those things, you never realize them... So I checked back a bit, and what is wrong then is not my input per se, but my current document setup, which I don't know how to solve. Two weeks ago, I asked about OpenType features. Mojca and Wolfgang thus gave examples of \definefontfeature. So, since I wanted to try out the historical ligatures in my font (dlig) alongside oldstyle nombers, I used the following, based on what I was told: \definefontfeature [myfeatures] [method=node,script=latn,language=dflt,liga=yes,onum=yes,kern=yes,dlig=yes] It turns out this is the culprit. When I comment that out, the comma apostrophes are back. :-) This makes me very happy because after all I won't use the historical ligatures. Therefore, I can use the oldstyle feature set and everything works well. That is not to say that wouldn't like to know how to solve what happened though. For the sake of it (and some eventual document's where this will be crucial), I would like to know what do I need to add to \definefontfeature for the apostrophe magic to work? Thanks! Jeff
Jeff Smith wrote:
On Nov 27, 2007 3:18 AM, Taco Hoekwater
wrote: This should happen automatically already. Context (well, TeX, really) is even smarter than that: If you type 'hello', it will automatically visualise that as 'hello'. If this does not happen, something is not right with your input, and you'd better post a small example.
Indeed, your answer made me check back old documents I had printed. The comma apostrophe was there! When you don't think about those things, you never realize them...
So I checked back a bit, and what is wrong then is not my input per se, but my current document setup, which I don't know how to solve.
Two weeks ago, I asked about OpenType features. Mojca and Wolfgang thus gave examples of \definefontfeature. So, since I wanted to try out the historical ligatures in my font (dlig) alongside oldstyle nombers, I used the following, based on what I was told:
\definefontfeature [myfeatures] [method=node,script=latn,language=dflt,liga=yes,onum=yes,kern=yes,dlig=yes]
It turns out this is the culprit. When I comment that out, the comma apostrophes are back. :-)
This makes me very happy because after all I won't use the historical ligatures. Therefore, I can use the oldstyle feature set and everything works well.
That is not to say that wouldn't like to know how to solve what happened though. For the sake of it (and some eventual document's where this will be crucial), I would like to know what do I need to add to \definefontfeature for the apostrophe magic to work?
tlig=yes trep=yes ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Am 2007-11-27 um 17:15 schrieb Jeff Smith:
tlig=yes trep=yes
On Nov 27, 2007 10:23 AM, Hans Hagen
wrote: trep! Works perfecly.
It it's only about quotes, you should consider using \quote{} and \quotation{} instead of typing more or less correct quotation marks. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
On Nov 28, 2007 1:26 PM, Henning Hraban Ramm
It it's only about quotes, you should consider using \quote{} and \quotation{} instead of typing more or less correct quotation marks.
Indeed. Anyway I already use \quote. :-) My question was rather about the apostrophe alone, like in "it's", or "don't", or "l'orange", "l'homme", which typographically should be like the comma (i.e. the single quotation mark). Therefore, you really have to use the symbol itself in the input. All's well than ends well! Jeff
Am 2007-11-28 um 20:07 schrieb Jeff Smith:
On Nov 28, 2007 1:26 PM, Henning Hraban Ramm
wrote: It it's only about quotes, you should consider using \quote{} and \quotation{} instead of typing more or less correct quotation marks.
Indeed. Anyway I already use \quote. :-) My question was rather about the apostrophe alone, like in "it's", or "don't", or "l'orange", "l'homme", which typographically should be like the comma (i.e. the single quotation mark). Therefore, you really have to use the symbol itself in the input.
Just write your own keyboard mapping – at least for MacOSX or Linux it’s rather easy. E.g. my usual keymap gives access to all accented Latin plus Greek and lots of other characters - I only keep forgetting what’s where, though, and it still contains some bugs ;-) Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
participants (4)
-
Hans Hagen
-
Henning Hraban Ramm
-
Jeff Smith
-
Taco Hoekwater