OpenOffice
Character Translation Macro
What it is
The code for a macro that allows you to insert your own accented and special characters is attached below. It works in OpenOffice Writer so is usable for all text documents. It's indispensable if you write in more than one language, and invaluable even if you work only in English (as long as you would like to be able to write resumé or Götterdämmerung or Łódź or use «» or ± in your work without struggling to insert the non-English characters).
What it does
Say you want to write the word café . Normally, to insert the character é (e acute) you can either enter Alt+0223 on the numeric pad (remembering to keep NumLock on) or open the menu, select on the sub-menu, then search through the table and click on the letter . All very time-consuming and error prone.
With this macro installed, you would type , position the cursor after the apostrophe, then press a shortcut key combination such as (or some other shortcut of your choosing - I've reassigned F7 and it works beautifully) and the two characters would be removed and replaced by the single letter é.
This is nice and easy to remember and almost impossible to get wrong, but best of all, there are many more letter pairs available – about 130 at the moment. These are just a few of them:
- u: becomes ü (German)
- L/ becomes Ł (Polish)
- S, becomes Ş (Romanian
- c@ becomes © (international copyright symbol)
In fact, most European languages using a latin alphabet are covered, including such oddities as the Turkish dotless ı and the Spanish upside down question mark ¿ and the German double-s ß and the Icelandic thorn Þ and so on and so on. Look in this paragraph for more information: character combinations. The definitive list is in the macro itself, found here.
Even better is that you can edit the table in the macro yourself to remove characters you'll never use and add new ones that are particularly useful to you. At the moment for instance there are no mathematical symbols, but if you wanted to add some, or maybe some Greek letters, that would be easy – just decide which memorable pair of characters you want to use then add them and the output character to the table. For example the Greek character µ is already in there, using the letters mu, but to add say pi would be just a matter of inserting pi and its symbol ∏ in the table, and voilà it's there whenever you need it.
Note that this functionality cannot be provided by the OpenOffice autocorrect function. This only operates on whole words, and does a conversion every time it finds the matched characters, even when you don't want it to. The macro operates only when you tell it to, and can operate anywhere in a text document even in the middle of words.
The combinations available
At the moment, the following conventions are observed:
- the diacritical mark follows the character to be modified eg e' (not 'e as in MS Word)
- ' (apostrophe) = acute accent
- ` (grave accent) = grave accent
- : (colon) = diaeresis or umlaut
- ^ (circumflex) = circumflex
- ~ (tilde) = tilde
- , (comma) = cedilla or ogonek
- @ (at sign) = ring or circle
- - (dash or hyphen) = caron
- / (forward slash) = bar or stroke
- " (quotation mark) = double grave
- ! (exclamation mark) = negator or invertor eg to remove the dot from an i or invert a question mark
If you make changes I would recommend trying to stick with this scheme or invent a good consistent one of your own - there's no point in having something that's so difficult to remember you have to use the normal lookup table anyway.
How to install it
I am not an expert in macros or OpenOffice so can't say if this is the best way of installing it, but it worked for me. These instructions are for my version of OpenOffice, which is 2.0.2 – I can't answer for other versions, but hopefully it shouldn't be too different.
The first step is to download the macro from here: macro text. Right click on the link, select (Firefox) or (Explorer) and save it on your hard disk somewhere. Then open the file you've just saved, select all the text in it and copy it to the clipboard (under Windows for example, move the cursor to just before the first character of the text, press to select to the end of the text, and press to copy the selected text to the clipboard).
Now, open a new OpenOffice text document using the default template. Go to In the resulting dialogue box, in the window called expand the entry then select then . Type in the box for the name of the macro, and press the button.
A Basic editor screen will open, with two lines of text. Delete them both and paste in the contents of the clipboard. (In Windows, press to select all then to replace it with the new text). Select on the menus or by pressing the anachronistic floppy disc icon on the toolbar, or, in Windows, pressing . Close the edit box – the macro is installed.
Making a shortcut key
The macro needs to be bound to a particular keypress combination so you can invoke it when you need it. I use but you may prefer something else – there's plenty of choice available. Open and select the tab.
In the window find at the bottom of the list, then click on its little then the against and and select . Your new macro should be highlighted in the window.
Now go back to the top window and scroll down to find the shortcut key combination you want to use to invoke the macro. OpenOffice is unhelpful here and will allow you to reassign keys such as (which is a Windows standard to print a document) without warning. I would strongly advise not using a simple + single character unless you're certain about what it does and are happy to change it. I use because it's convenient and is only used in one or two other programs for the 'redo' function. Press and your key combination should appear in the bottom right box. Press and you're done.
You could also add a button to one of the toolbars if you preferred. This is done in much the same way – using then via the tab. Choose your toolbar eg Tools, then press and, as above, point to the macro via the window. I leave the rest as an exercise for the reader.
Testing and changing the macro
Testing is easy – just type in a known pair, press the shortcut key, and if it changes, it works. If you've made significant changes to the table it's probably wise to do a fuller test eg make sure that the first and last pairs both still work and that all your changes work, but it's a very simple piece of code and it shouldn't take more than a few minutes to confirm everything's OK.
Making changes is done through the menu series then selecting this macro and pressing . Most changes will just be to add another character pair, remove some redundant ones, or change the mapping to something you find more convenient.
- To remove a redundant pair, just delete the entire line that it's in from the table.
- To change the input pair of characters, replace the two characters in the left entry of the table by those you prefer.
- To add an entry, the safest way is to copy an existing line, paste it in below itself, then edit the new line to contain the characters you need. That way you're guaranteed to get the commas and quotation marks etc correct. If you want to use quotation marks as one of your character pair (eg to make another double acute accented character) use two for every one you need or Basic will get confused (see my double acute accented U for an example).
Don't put comments in the table – oo Basic doesn't like it.
Don't forget to save the file when you've finished making changes!
If you want to change the code that's fine, but you're on your own and don't need help from me. If you do anything interesting, let me know.
Updates
The provided set is intended to cover all the languages of the European Union that use a latin alphabet, and Turkish. I believe there may be gaps in Estonian, Latvian, and Lithuanian, which I'm unable to check. The various digraphs such as the Czech 'ch' are not included either as I'm not sure how they are used – in all text, or only in typeset text (like the English ae). Some of the input pairs may not be optimal for native speakers, for example I simply had to guess a combination for the Icelandic letters eth and thorn.
I'd be pleased to receive corrections, but please make sure they're correct – I don't want to waste time trying to sort out abstruse linguistic issues myself. Evidence supporting a suggested change would be a good idea.
Gaps in the table are less urgent, but rational suggestions would also be appreciated.
Last update of this site 20050507