The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   System (http://hintsforums.macworld.com/forumdisplay.php?f=4)
-   -   shortcuts for inserting greek characters (http://hintsforums.macworld.com/showthread.php?t=63306)

spydr 11-13-2006 05:55 PM

shortcuts for inserting greek characters
 
Hi,
I have to insert a few greek characters in my text documents in a regular basis - alpha, beta, gamma and mu. I know and "option+m" types 'µ' but I have not found any such easy key combinations to type the other characters that I need. Currently I am either toggling to greek keyboard for the character or pulling it from character palette. Both these options are not as elegant as simple key combinations to get what I need and keep moving. If someone know how I can 'remap' "option+a" for alpha, "option+b" for beta and "option+g" for gamma, I would greatly appreciate it.
Thanks

NovaScotian 11-14-2006 10:52 AM

Quote:

Originally Posted by spydr (Post 334388)
Hi,
I have to insert a few greek characters in my text documents in a regular basis - alpha, beta, gamma and mu. I know and "option+m" types 'µ' but I have not found any such easy key combinations to type the other characters that I need. Currently I am either toggling to greek keyboard for the character or pulling it from character palette. Both these options are not as elegant as simple key combinations to get what I need and keep moving. If someone know how I can 'remap' "option+a" for alpha, "option+b" for beta and "option+g" for gamma, I would greatly appreciate it.
Thanks

I run this little AppleScript, which places the chosen character in the clipboard

Code:

set alph to (run script "«data utxt03B1»") as Unicode text
set bet to (run script "«data utxt03B2»") as Unicode text
set gam to (run script "«data utxt03B3»") as Unicode text
set mu to (run script "«data utxt03BC»") as Unicode text

set the clipboard to item 1 of (choose from list {alph, bet, gam, mu})

If you want others, get them from the Character Palette

spydr 11-14-2006 12:16 PM

Quote:

Originally Posted by NovaScotian (Post 334533)
I run this little AppleScript, which places the chosen character in the clipboard

Code:

set alph to (run script "«data utxt03B1»") as Unicode text
set bet to (run script "«data utxt03B2»") as Unicode text
set gam to (run script "«data utxt03B3»") as Unicode text
set mu to (run script "«data utxt03BC»") as Unicode text

set the clipboard to item 1 of (choose from list {alph, bet, gam, mu})

If you want others, get them from the Character Palette

Thanks for the reply.
I am not entirely sure how I would implement this script. Do I have to run the script everytime I need to place the character? Or if I run the script before writing all the relevant characters would be available in the clipboard so whenver I type 'alph' it would 'autocorrect' itself to 'alpha symbol'?

Ideally I am looking to change the keybindings from so I can type option+character to type the corresponding greek character. So this way I can keep typing without interrupting my flow.

Thanks for the inputs anyway.

NovaScotian 11-14-2006 12:33 PM

Bad idea to change key bindings (and I'm not sure how you would do it except by fooling around with the font).

There are a number of ways to do accomplish what you want to do, though. If the word processor you use has a script menu, put it there.

If you own and use CopyPaste, it enables the creation of clip sets in one of which you'd put the four symbols and then they'd be used by holding command-v and then typing 1, 2, 3, 4 to paste one of them at the insertion point in your document (the way I do it).

If you own and use FastScripts, then you can assign a hot key for the script (or make it four scripts) and then get it with hot-key followed by command-v.

There are probably other options, but these are the ones I use.

JDV 11-14-2006 12:39 PM

Out of curiosity, what text editor do you use? It might be easier to do it using the features of the editor, unless you need it more broadly than that.

Joe VanZandt

spydr 11-14-2006 01:02 PM

Quote:

Originally Posted by JDV (Post 334567)
Out of curiosity, what text editor do you use? It might be easier to do it using the features of the editor, unless you need it more broadly than that.

Joe VanZandt

I use word for writing my manuscripts but I do see routine use in other apps that use cocoa text system(textedit, Notebook, devonthink etc). That is why I am looking for a system wide shortcut.

spydr 11-14-2006 01:16 PM

Quote:

Originally Posted by NovaScotian (Post 334563)
Bad idea to change key bindings (and I'm not sure how you would do it except by fooling around with the font).

I do share that concern - but it seemed to me as a way to get it to work broadly in many apps. I wonder if someone has used KBE to accomplish something like that.

Copypaste appears to be a promising second option. But I am not sure if I want to spend $30 for it.

JDV 11-14-2006 01:19 PM

Here's a program that might do what you want for not too much money: http://www.macility.com/products/popcharx/

Joe VanZandt

spydr 11-14-2006 02:13 PM

Quote:

Originally Posted by JDV (Post 334580)
Here's a program that might do what you want for not too much money: http://www.macility.com/products/popcharx/

Joe VanZandt

Thanks. I will give it a spin — I am still hopeful that it has got to be possible without having to run an entire application just for it!

JDV 11-14-2006 02:38 PM

You know, in DOS/Windows it is possible to produce higher ascii characters from the contol key (alt key? I don't remember!) and the correspoding ascii number on the numeric keypad. Does anyone know if there is any corresponding function in OS X?

Joe VanZandt

biovizier 11-14-2006 02:55 PM

The "Unicode Hex Input" input method ("System Preferences" > "International" > "Input Menu") might be the sort of thing you are referring to. The unmodified or shifted keystrokes are pretty much the same as the Canadian or US English layout, plus by holding down the "option" key and typing in the unicode value (eg 03b1, o3b3, etc.), arbitrary characters can be inserted. However, the downside is that that layout doesn't include the standard "option"-key characters, such as "option"-s for beta, option-8 for a bullet, etc. that you may have come to rely on. However, the "Unicode Hex Input.keylayout" file is one that is plain-text XML so it might be easy to customize to get the best of both...

Edit: Some customization of the file does seem to work, by adding in your choice of "option"-key mappings under the index="3" section. I didn't bother to test it, but since the "option" key is used for hex input, I would imagine that assigning custom characters to any "option" combination involving [0-9,a-f] would be a bad idea. Edit a copy of the "/System/Library/Keyboard Layouts/Unicode.bundle/Contents/Resources/Unicode Hex Input.keylayout" file, rename it, put it in the "~/Library/Keyboard Layouts" folder, log out and back in, then enable it from the pref pane.

JDV 11-14-2006 03:24 PM

That certainly sounds like the same sort of thing; the ascii codes were decimal values, because they didn't use unicode (at that time). It may be that the OP can find some way to make use of that information to create an action that would invoke that in some way. It doesn't seem on the surface that it ought to be difficult.

Joe VanZandt

spydr 11-14-2006 09:55 PM

1 Attachment(s)
Thanks everyone for their inputs.

The most elegant solution I have come across so far is the one from Jacob Rus on customizing cocoa text system. This involves making a simple 'DefaultKeyBinding.dict' file at ~/Library/KeyBindings/
Here is one such .dict file I made with his code.

1. Drop the .dict file at above path (make the KeyBindings folder if necessary—I had to)
2. As it is set right now, the letter typed after hitting ^b will be typed as a greek alphabet. It automatically inserts the correct font variant as per the body of the text. After one greek character, it reverts back automatically so you can resume typing as usual. As you might imagine, this works for any and all cocoa application.
Great for greek symbol insertions while typing, without having to mouse around to the character palette or having an extra software to accomplish it.

PS: Here is the code is you want to look at it.


All times are GMT -5. The time now is 03:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.