Author: Timo Kozlowski
Imagine you’re an academic writing a book about Vietnam. The Vietnamese writing system is based upon the Latin script, but it’s enhanced with a load of diacritic marks on top of or beneath the characters. OpenOffice.org would require you to use two different keyboards — an English one and a Vietnamese one. Another possibility would be to memorize the all the keys from the two keyboard settings and regularly switch the keyboard character map depending upon the language you are about to write.
Switching frequently between two languages gets annoying quickly. Microsoft Word has a handy feature to make working like this much smoother. In Word you can customize the command keystrokes to your needs, and you can make Word enter a special character by pressing a combination of keys.
OpenOffice.org also lets you customize key commands to your needs, but at first sight, it appears to lack the capacity to link special characters to specific keystrokes. But there’s a handy workaround to this problem: You can link macros to a combination of keys. And by using OpenOffice.org’s built-in macro recorder, you don’t even need to know anything about how to design macros using OpenOffice Basic, the macro language shipped with OpenOffice.org.
OpenOffice.org uses the same principle as the Russian matrioshka dolls. When you open one, you find a smaller doll inside, and so on until there is a only one tiny doll left. Similarly, an OpenOffice.org macro is stored within a module, the module (along with others) is stored within a library, and libraries are stored within a container. The container may be the program OpenOffice.org itself (in which case you can use the macro every time you start Openoffice.org) or a document (in which case you can use the macro only when the document that contains it is open for editing).
Create your library
To beginning creating these macros, set up a new library to store them all. Don’t save them in the standard library lest you get confused when you open a document that has a macro of the same name stored inside the document’s standard library.
Select Tools > Macro > Macro… to see all the macros registered within the program. Click on Organize to set up a new library to store the macros you are about to create. Depending on your requirements you can decide to set up the library within OpenOffice.org (in which case, set it up within “soffice”) or within just one document.
Record the macros
Now start the macro recorder. You should see now a small dialog pop up that lets you stop recording. Choose Insert > Special Character from the menu, look for a special character you need to use frequently, and insert it into the document, then stop recording.
Instantly, a dialog to organize macros pops open. Select the library you created in the earlier step and create within it a new module. Give it a name that you will let you distinguish which character the macro within will create. OpenOffice.org will store the macro as “main” in this module.
As a test, try running the macro. It should insert the special character you want.
Link the macro to a key
Now let’s make the macro easy to access to run. Open Tools > Customize… and choose the Keyboard tab. Browse the list of keyboard commands for one that suits you. Then connect this keystroke with your macro. You find all the registered macros at the bottom of the category list at the bottom of the dialog.
Once you’ve gone through the process for one special character, you can record a macro for the others you use and find appropriate keystrokes for them.
There is one thing to watch out for when using this technique. Inserting special characters this way uses a specified font. For mathematical symbols like π you might use a specific Greek font anyway, but when it comes to diacritic marks within Latin script, you need to make sure that your macros use the same font you use in your document, or your work might end up with hodgepodge of different fonts. I recommend using one font that features all of the desired special characters and diacritics in your document, such as Gentium. Although this font by itself is not open source, you can use it for free.