1 \input texinfo @c -*-texinfo-*-
2 @setfilename ../info/kbd-trans
3 @settitle Keyboard translation
7 @center @titlefont{Keyboard translation}
11 @center Naoto TAKAHASHI
12 @center ntakahas@@etl.go.jp
18 @section Keyboard translation
20 Some quail packages, for example, Russian, Greek, Hebrew, etc.,
21 completely re-map the key layout. In these cases, it is desirable to
22 provide the same key layout no matter what keyboard is actually used.
23 For this purpose, a variable *quail-keyboard-translate-table* is
24 introduced. It is used to absorb the differences between the various
25 real keyboards and the 'ideal' standard keyboard. Currently, 12
26 predefined constants are provided. See the following carefully and
27 set the apropriate constant to @code{quail-keyboard-translate-table} in
28 your @file{.emacs} file. For example, if you are using SUN type4 keyboard,
31 (setq *quail-keyboard-translate-table*
32 *quail-keyboard-translate-table-sun-type4*)
38 * Keyboard translate tables::
39 * Writing new keyboard translate table::
42 @node Keyboard translate tables, Writing new keyboard translate table, , Top
43 @section Predefined keyboard translate tables
45 Here's a list of predefined keyboard translate tables.
47 If you don't find your keyboard in the following list, make yours by
48 yourself @xref{Writing new keyboard translate table}.
51 @item @code{quail-keyboard-standard-table}
57 Esc 1 2 3 4 5 6 7 8 9 0 - = `
58 q w e r t y u i o p [ ]
59 a s d f g h j k l ; ' \
65 Esc ! @ # $ % ^ & * ( ) _ + ~
66 Q W E R T Y U I O P { }
67 A S D F G H J K L : " |
72 @item @code{quail-keyboard-translate-table-sun-type3}
74 machines: SUN type3 keyboard
76 TAKAOKA XMiNT (AX keyboard)
77 JCC Xstation / GloabalX (AX keyboard)
81 Esc 1 2 3 4 5 6 7 8 9 0 - = \ `
82 q w e r t y u i o p [ ]
89 Esc ! @ # $ % ^ & * ( ) _ + | ~
90 Q W E R T Y U I O P { }
96 @item @code{quail-keyboard-translate-table-sun-type4}
98 machines: SUN type4 keyboard
103 Esc 1 2 3 4 5 6 7 8 9 0 - =
104 q w e r t y u i o p [ ]
105 a s d f g h j k l ; ' `
112 Esc ! @ # $ % ^ & * ( ) _ +
113 Q W E R T Y U I O P { }
114 A S D F G H J K L : " ~
119 @item @code{quail-keyboard-translate-table-sony-nwp-411a}
125 Esc 1 2 3 4 5 6 7 8 9 0 - = \
126 q w e r t y u i o p [ ]
127 a s d f g h j k l ; ' `
133 Esc ! @ # $ % ^ & * ( ) _ + |
134 Q W E R T Y U I O P { }
135 A S D F G H J K L : " ~
140 @item @code{quail-keyboard-translate-table-ibm-at}
142 machines: IBM AT keyboard
146 ` 1 2 3 4 5 6 7 8 9 0 - = \
147 q w e r t y u i o p [ ]
148 a s d f g h j k l ; '
154 ~ ! @ # $ % ^ & * ( ) _ + |
155 Q W E R T Y U I O P { }
156 A S D F G H J K L : "
161 @item @code{quail-keyboard-translate-table-ibm-rt/pc}
163 machines: IBM RT/PC 5085 keyboard
164 RS6000 (English keyboard)
165 Apple Macintosh MO115 keyboard / Power Book
170 ` 1 2 3 4 5 6 7 8 9 0 - =
171 q w e r t y u i o p [ ] \
172 a s d f g h j k l ; '
178 ~ ! @ # $ % ^ & * ( ) _ +
179 Q W E R T Y U I O P { } |
180 A S D F G H J K L : "
185 @item @code{quail-keyboard-translate-table-decstation}
187 machines: DEC DECstation3100 LK201 keyboard (vt100 mode)
188 DEC DECstation3100 LK401-AJ keyboard (vt100 mode)
192 1 2 3 4 5 6 7 8 9 0 - =
193 q w e r t y u i o p [ ]
194 a s d f g h j k l ; ' \
195 ` z x c v b n m , . /
200 ! @ # $ % ^ & * ( ) _ +
201 Q W E R T Y U I O P { }
202 A S D F G H J K L : " |
203 ~ Z X C V B N M < > ?
207 @item @code{quail-keyboard-translate-table-dynabook}
209 machines: TOSHIBA Dynabook386/20 keyboard
213 1 2 3 4 5 6 7 8 9 0 - =
214 q w e r t y u i o p [ ]
215 a s d f g h j k l ; '
221 ! @ # $ % ^ & * ( ) _ +
222 Q W E R T Y U I O P { }
223 A S D F G H J K L : "
228 @item @code{quail-keyboard-translate-table-mac-mo110}
230 machines: Apple Macintosh MO110 keyboard
234 ` 1 2 3 4 5 6 7 8 9 0 - =
235 q w e r t y u i o p [ ]
236 a s d f g h j k l ; '
242 ~ ! @ # $ % ^ & * ( ) _ +
243 Q W E R T Y U I O P { }
244 A S D F G H J K L : "
249 @item @code{quail-keyboard-translate-table-mac-mo116}
251 machines: Apple Macintosh MO116 keyboard
255 Esc 1 2 3 4 5 6 7 8 9 0 - =
256 q w e r t y u i o p [ ]
257 a s d f g h j k l ; '
263 Esc ! @ # $ % ^ & * ( ) _ +
264 Q W E R T Y U I O P { }
265 A S D F G H J K L : "
270 @item @code{quail-keyboard-translate-table-jis}
272 machines: NEC PC-9801 keyboard
273 NEC EWS4800/220, /260
274 EPSON PC-286 keyboard
278 Esc 1 2 3 4 5 6 7 8 9 0 - ^ \
279 q w e r t y u i o p @ [
280 a s d f g h j k l ; : ]
286 Esc ! " # $ % & ' ( ) 0 = ` |
287 Q W E R T Y U I O P ~ {
288 A S D F G H J K L + * }
289 Z X C V B N M < > ? _
293 @item @code{quail-keyboard-translate-table-fujitsu-sigma-230}
295 machines: Fujitsu Sigma 230
299 Esc 1 2 3 4 5 6 7 8 9 0 - ^ \
300 q w e r t y u i o p @ [
301 a s d f g h j k l ; : ]
307 Esc ! " # $ % & ' ( ) 0 = ~ |
308 Q W E R T Y U I O P ` {
309 A S D F G H J K L + * }
310 Z X C V B N M < > ? _
315 @node Writing new keyboard translate table, , Keyboard translate tables, Top
316 @section Writing new keyboard translate table
318 @code{quail-keyboard-translate-table} consists of two parts. One is a
319 string and the other is an a-list. The string part, which is the
320 @code{car} (or @code{nth 0}) of this variable, describes the
321 `normalised' layout of your keyboard. (The meaning of 'normalised'
322 will soon be given.) The a-list part, which is the 'cadr' (or 'nth 1')
323 of the variable describes the 'unusually' located keys and their
326 Let's take IBM AT keyboard as an example. It looks like this:
331 ` 1 2 3 4 5 6 7 8 9 0 - = \
332 q w e r t y u i o p [ ]
333 a s d f g h j k l ; '
339 ~ ! @ # $ % ^ & * ( ) _ + |
340 Q W E R T Y U I O P { }
341 A S D F G H J K L : "
346 First, normalise the layout of the keyboard. 'To normalise' means 'to
347 move some keys so that the number of columns and the number of rows
348 will match those of @code{quail-keyboard-standard-table}.
350 @code{quail-keyboard-standard-table} looks like this:
355 1 2 3 4 5 6 7 8 9 0 - = `
356 q w e r t y u i o p [ ]
357 a s d f g h j k l ; ' \
363 ! @ # $ % ^ & * ( ) _ + ~
364 Q W E R T Y U I O P { }
365 A S D F G H J K L : " |
370 Note that @code{quail-keyboard-standard-table} has no keys left to the 1!
374 13 keys at the top row, and
376 12 keys at the 2nd row, and
378 12 keys at the 3rd row, and
380 10 keys at the 4th row, and
382 1 space bar at the bottom.
385 To normalise the AT keyboard, it is necessary to move the `~ key to
386 the right end of the 3rd row.
389 [AT normalised unshifted]
391 1 2 3 4 5 6 7 8 9 0 - = \
392 q w e r t y u i o p [ ]
393 a s d f g h j k l ; ' `
397 [AT normalised shifted]
399 ! @ # $ % ^ & * ( ) _ + |
400 Q W E R T Y U I O P { }
401 A S D F G H J K L : " ~
406 Now describe this layout by a string from left to right, up to down,
407 unshifted to shifted. Unshifted space should be appended at the end
408 of the string. There's no shifted space. The resulting string looks
412 "1234567890-=\\qwertyuiop[]asdfghjkl;'`zxcvbnm,./!@@#$%^&*()_+|QWERTYUIOP@{@}ASDFGHJKL:\"~ZXCVBNM<>? "
415 Note that '"' (double quote) and '\' (backslash) must be escaped by a
416 '\'. This string will be the 'car' of *quail-keyboard-translate-table*.
418 Next, specify the real location of the moved characters. In our
419 example only one KEY (`~) is moved, but this causes two CHARACTERs to
422 The location should be given by a vector of the form:
424 @code{[ x-position y-position shift-or-not ]}
427 For the keys in the first row, x-position means the offset from the 1!
428 key. For example, the x-position of '2' is 1, that of '3' is 2, and
429 that of '=' is 11. That of '1' itself is 0. In IBM AT keyboard, '`'
430 and '~' locate to the left of the 1! key, so their x-position will
433 For the keys in the 2nd, the 3rd, and the bottom row, their x-position
434 will be the offset from 'q', 'a', and 'z', respectively.
436 The y-position is the offset from the top row (i.e. the row which
437 contains 1234...). So the y-position of '5' is 0, 't' is 1, 'g' is 2,
438 and 'b' is 3. Keys above the top row will have a negative y-position.
440 The third element shift-or-not is 0 if not shifted, and 1 if shifted.
442 So, the real location of '`' in the AT keyboard will be [-1 0 0] and
443 that of '~' will be [-1 0 1]. These two locations will be coded into
444 an a-list together with the characters they are presenting:
446 '((?` [-1 0 0]) (?~ [-1 0 1]))
448 Now we have both the string part and the a-list part. So the
449 *quail-keyboard-translate-table* for IBM AT keyboard will be as
452 '("1234567890-=\\qwertyuiop[]asdfghjkl;'`zxcvbnm,./!@@#$%^&*()_+|QWERTYUIOP@{@}ASDFGHJKL:\"~ZXCVBNM<>?" ((?` [-1 0 0]) (?~ [-1 0 1])))}
454 When you put these beasts in your .emacs, it would be better to divide
455 the string part according to the rows so that you can check easily.
458 (setq *quail-keyboard-translate-table* '("\
468 ((?` [-1 0 0]) (?~ [-1 0 1]))))