Go to the first, previous, next, last section, table of contents.

Support for the Scandinavian Languages

For some languages, it makes sense to remap the keyboard. This is true for languages that add a small set of regular letters compared to the English character set. The Scandinavian languages belong to this category. Danish, Norwegian, and Swedish each add three extra letters compared to English, all of which are equal to the other letters in the alphabet. They are not considered accented versions of the "regular" letters.

Since these letters have a well defined place on any Scandinavian keyboard, it makes sense to remap these keys to insert the equivalent TeX macros. This can also be done on an keyboard with international layout, just map the keys at the locations where the national letters normally are found.

In order to get the original binding of the keys, we can use a little trick. If you press one of the national keys twice, the national letter will first be inserted, and then replaced with the original binding of the key. This works since these national letters practically never occur twice in row in an Scandinavian word.

The keyboard mapping is implemented as a minor mode. To enter the minor mode the first time, type M-x keyboard-query-mapping. It will first prompt you for a what language to use. Currently only Danish, Swedish, and Russian are defined, so you have to chose one of those. Norway use the same character set as Denmark.

Next, it will prompt you for what encoding of the languages character set to use for the keyboard and screen. The same encodings are available for both the keyboard and screen, but they are not equally good. Choosing e.g. TeX for the keyboard encoding is not very useful. Below is a table of currently supported encodings.

`ISO 646 (DK or SE)'
If your terminal think {, |, and } are letters, this is the encoding for you. You can use it for either Keyboard or Screen encoding.
`Keyboard Layout'
If you have a international keyboard layout, use this for the keyboard encoding. If you do not have a international keyboard layout -- but wish you had -- you can use it for the Screen encoding instead.
`Digraphs'
Two letter combinations that form poor substitutes for the real national letters. It can be used as the Screen encoding, if you for example is sending electronic mail to someone on unknown machine.
`TeX'
This is what you want to use for the Screen encoding when writing a TeX document.
`ISO 8859 Latin 1'
Only useful if you have hacked Emacs to understand 8-bit characters.

Finally, it will ask you if you want to get the original binding by pressing a key twice. For the Scandinavian languages, you want this.

Command: keyboard-query-mapping

(M-x keyboard-query-mapping) Query the user for what mapping to use, and use it.

After you have entered keyboard-mode once, you can leave and enter it with M-x keyboard-mode. It will use the same mapping as last time you called keyboard-query-mapping.

Command: keyboard-query-mapping

(M-x keyboard-mode) Toggle keyboard-mode. With prefix arg, turn keyboard-mode on iff arg is positive.

This is still inconvenient, so you may want to define special function to turn your favorite mapping on and of, as shown in the following example.

(defun tex-dk-double-mode (arg)
  "DK TeX keys on international keyboard."
  (interactive "P")
  (require 'min-key)
  (if (or (and (null arg) keyboard-mode)
          (<= (prefix-numeric-value arg) 0))
      (keyboard-mode -1)
    (keyboard-set-mapping "Danish" "Keyboard Layout" "TeX" t)
    (keyboard-mode 1)))

To enter new character sets or new encodings, you must edit the variable language-encodings in the file `min-key.el'. Please send any new useful additions to me.

User Option: language-encodings

Language dependent mapping between different encodings.

This list determines how to map between different encodings of the character set of a various languages.

Each element in the list is itself a list.

The first element is the name of the language.

The second element is a short name of the language.

The third element is a list of short strings, each representing a possible encoding of the language's character set.

The fourth element is a list of long strings, each representing a the same encodings of the language's character set.

The remaining elements each represents the encodings of one character. The encodings must appear in the same sequence as they were found in the second element.


Go to the first, previous, next, last section, table of contents.