Initial Commit
[packages] / mule-packages / mule-base / texi / kbd-trans.texi
1 \input texinfo  @c -*-texinfo-*-
2 @setfilename ../info/kbd-trans
3 @settitle Keyboard translation
4
5 @titlepage
6 @sp 6
7 @center @titlefont{Keyboard translation}
8 @sp 4
9 @center Version 2.0
10 @sp 5
11 @center Naoto TAKAHASHI
12 @center ntakahas@@etl.go.jp
13 @page
14
15 @end titlepage
16
17 @node Top, , , (mule)
18 @section Keyboard translation
19
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,
29 put
30 @example
31 (setq *quail-keyboard-translate-table*
32       *quail-keyboard-translate-table-sun-type4*)
33 @end example
34
35 in your .emacs.
36
37 @menu
38 * Keyboard translate tables::
39 * Writing new keyboard translate table::
40 @end menu
41
42 @node Keyboard translate tables, Writing new keyboard translate table, , Top
43 @section Predefined keyboard translate tables
44
45 Here's a list of predefined keyboard translate tables.
46
47 If you don't find your keyboard in the following list, make yours by
48 yourself @xref{Writing new keyboard translate table}.
49
50 @itemize
51 @item @code{quail-keyboard-standard-table}
52 @example
53 machines: vt100, etc.
54
55 [unshifted]
56
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  ;  '  \
60        z  x  c  v  b  n  m  ,  .  /
61                  SPACE
62
63 [shifted]
64
65 Esc !  @  #  $  %  ^  &  *  (  )  _  +  ~
66      Q  W  E  R  T  Y  U  I  O  P  {  }
67       A  S  D  F  G  H  J  K  L  :  "  |
68        Z  X  C  V  B  N  M  <  >  ?
69                  SPACE
70 @end example
71
72 @item @code{quail-keyboard-translate-table-sun-type3}
73 @example
74 machines: SUN type3 keyboard
75           SUN type5 keyboard
76           TAKAOKA XMiNT (AX keyboard)
77           JCC Xstation / GloabalX (AX keyboard)
78
79 [unshifted]
80
81 Esc 1  2  3  4  5  6  7  8  9  0  -  =  \  `
82      q  w  e  r  t  y  u  i  o  p  [  ]
83       a  s  d  f  g  h  j  k  l  ;  '
84        z  x  c  v  b  n  m  ,  .  /
85                  SPACE
86
87 [shifted]
88
89 Esc !  @  #  $  %  ^  &  *  (  )  _  +  |  ~
90      Q  W  E  R  T  Y  U  I  O  P  {  }
91       A  S  D  F  G  H  J  K  L  :  "
92        Z  X  C  V  B  N  M  <  >  ?
93                  SPACE
94 @end example
95
96 @item @code{quail-keyboard-translate-table-sun-type4}
97 @example
98 machines: SUN type4 keyboard
99
100 [unshifted]
101
102                                   \
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  ;  '  `
106        z  x  c  v  b  n  m  ,  .  /
107                  SPACE
108
109 [shifted]
110
111                                   |
112 Esc !  @  #  $  %  ^  &  *  (  )  _  +
113      Q  W  E  R  T  Y  U  I  O  P  {  }
114       A  S  D  F  G  H  J  K  L  :  "  ~
115        Z  X  C  V  B  N  M  <  >  ?
116                  SPACE
117 @end example
118
119 @item @code{quail-keyboard-translate-table-sony-nwp-411a}
120 @example
121 machines: NEWS-3470
122
123 [unshifted]
124
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  ;  '  `
128        z  x  c  v  b  n  m  ,  .  /
129                  SPACE
130
131 [shifted]
132
133 Esc !  @  #  $  %  ^  &  *  (  )  _  +  |
134      Q  W  E  R  T  Y  U  I  O  P  {  }
135       A  S  D  F  G  H  J  K  L  :  "  ~
136        Z  X  C  V  B  N  M  <  >  ?
137                  SPACE
138 @end example
139
140 @item @code{quail-keyboard-translate-table-ibm-at}
141 @example
142 machines: IBM AT keyboard
143
144 [unshifted]
145
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  ;  '
149        z  x  c  v  b  n  m  ,  .  /
150                  SPACE
151
152 [shifted]
153
154  ~  !  @  #  $  %  ^  &  *  (  )  _  +  |
155      Q  W  E  R  T  Y  U  I  O  P  {  }
156       A  S  D  F  G  H  J  K  L  :  "
157        Z  X  C  V  B  N  M  <  >  ?
158                  SPACE
159 @end example
160
161 @item @code{quail-keyboard-translate-table-ibm-rt/pc}
162 @example
163 machines: IBM RT/PC 5085 keyboard
164           RS6000 (English keyboard)
165           Apple Macintosh MO115 keyboard / Power Book
166           SGI Iris Indigo
167
168 [unshifted]
169
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  ;  '
173        z  x  c  v  b  n  m  ,  .  /
174                  SPACE
175
176 [shifted]
177
178  ~  !  @  #  $  %  ^  &  *  (  )  _  +
179      Q  W  E  R  T  Y  U  I  O  P  {  }  |
180       A  S  D  F  G  H  J  K  L  :  "
181        Z  X  C  V  B  N  M  <  >  ?
182                  SPACE
183 @end example
184
185 @item @code{quail-keyboard-translate-table-decstation}
186 @example
187 machines: DEC DECstation3100 LK201 keyboard (vt100 mode)
188           DEC DECstation3100 LK401-AJ keyboard (vt100 mode)
189
190 [unshifted]
191
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  ,  .  /
196                  SPACE
197
198 [shifted]
199
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  <  >  ?
204                  SPACE
205 @end example
206
207 @item @code{quail-keyboard-translate-table-dynabook}
208 @example
209 machines: TOSHIBA Dynabook386/20 keyboard
210
211 [unshifted]
212
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  ;  '
216        z  x  c  v  b  n  m  ,  .  /
217            \     SPACE       `
218
219 [shifted]
220
221     !  @  #  $  %  ^  &  *  (  )  _  +
222      Q  W  E  R  T  Y  U  I  O  P  {  }
223       A  S  D  F  G  H  J  K  L  :  "
224        Z  X  C  V  B  N  M  <  >  ?
225            |     SPACE       ~
226 @end example
227
228 @item @code{quail-keyboard-translate-table-mac-mo110}
229 @example
230 machines: Apple Macintosh MO110 keyboard
231
232 [unshifted]
233
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  ;  '
237        z  x  c  v  b  n  m  ,  .  /
238                  SPACE          \
239
240 [shifted]
241
242  ~  !  @  #  $  %  ^  &  *  (  )  _  +
243      Q  W  E  R  T  Y  U  I  O  P  {  }
244       A  S  D  F  G  H  J  K  L  :  "
245        Z  X  C  V  B  N  M  <  >  ?
246                  SPACE          |
247 @end example
248
249 @item @code{quail-keyboard-translate-table-mac-mo116}
250 @example
251 machines: Apple Macintosh MO116 keyboard
252
253 [unshifted]
254
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  ;  '
258        z  x  c  v  b  n  m  ,  .  /
259            `     SPACE       \
260
261 [shifted]
262
263 Esc !  @  #  $  %  ^  &  *  (  )  _  +
264      Q  W  E  R  T  Y  U  I  O  P  {  }
265       A  S  D  F  G  H  J  K  L  :  "
266        Z  X  C  V  B  N  M  <  >  ?
267            ~     SPACE       |
268 @end example
269
270 @item @code{quail-keyboard-translate-table-jis}
271 @example
272 machines: NEC PC-9801 keyboard
273           NEC EWS4800/220, /260
274           EPSON PC-286 keyboard
275
276 [unshifted]
277
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  ;  :  ]
281        z  x  c  v  b  n  m  ,  .  /
282                  SPACE
283
284 [shifted]
285
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  <  >  ?  _
290                  SPACE
291 @end example
292
293 @item @code{quail-keyboard-translate-table-fujitsu-sigma-230}
294 @example
295 machines: Fujitsu Sigma 230
296
297 [unshifted]
298
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  ;  :  ]
302        z  x  c  v  b  n  m  ,  .  /
303                  SPACE
304
305 [shifted]
306
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  <  >  ?  _
311                  SPACE
312 @end example
313 @end itemize
314
315 @node Writing new keyboard translate table, , Keyboard translate tables, Top
316 @section Writing new keyboard translate table
317
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
324 position.
325
326 Let's take IBM AT keyboard as an example.  It looks like this:
327
328 @example
329 [AT unshifted]
330
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  ;  '
334        z  x  c  v  b  n  m  ,  .  /
335                  SPACE
336
337 [AT shifted]
338
339  ~  !  @  #  $  %  ^  &  *  (  )  _  +  |
340      Q  W  E  R  T  Y  U  I  O  P  {  }
341       A  S  D  F  G  H  J  K  L  :  "
342        Z  X  C  V  B  N  M  <  >  ?
343                  SPACE
344 @end example
345
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}.
349
350 @code{quail-keyboard-standard-table} looks like this:
351
352 @example
353 [STANDARD unshifted]
354
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  ;  '  \
358        z  x  c  v  b  n  m  ,  .  /
359                  SPACE
360
361 [STANDARD shifted]
362
363     !  @  #  $  %  ^  &  *  (  )  _  +  ~
364      Q  W  E  R  T  Y  U  I  O  P  {  }
365       A  S  D  F  G  H  J  K  L  :  "  |
366        Z  X  C  V  B  N  M  <  >  ?
367                  SPACE
368 @end example
369
370 Note that @code{quail-keyboard-standard-table} has no keys left to the 1!
371 key.  It has;
372 @enumerate
373 @item
374 13 keys at the top row, and
375 @item
376 12 keys at the 2nd row, and
377 @item
378 12 keys at the 3rd row, and
379 @item
380 10 keys at the 4th row, and
381 @item
382 1 space bar at the bottom.
383 @end enumerate
384
385 To normalise the AT keyboard, it is necessary to move the `~ key to
386 the right end of the 3rd row.
387
388 @example
389 [AT normalised unshifted]
390
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  ;  '  `
394        z  x  c  v  b  n  m  ,  .  /
395                  SPACE
396
397 [AT normalised shifted]
398
399     !  @  #  $  %  ^  &  *  (  )  _  +  |
400      Q  W  E  R  T  Y  U  I  O  P  {  }
401       A  S  D  F  G  H  J  K  L  :  "  ~
402        Z  X  C  V  B  N  M  <  >  ?
403                  SPACE
404 @end example
405
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
409 like this:
410
411 @example
412 "1234567890-=\\qwertyuiop[]asdfghjkl;'`zxcvbnm,./!@@#$%^&*()_+|QWERTYUIOP@{@}ASDFGHJKL:\"~ZXCVBNM<>? "
413 @end example
414
415 Note that '"' (double quote) and '\' (backslash) must be escaped by a
416 '\'.  This string will be the 'car' of *quail-keyboard-translate-table*.
417
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
420 be moved.
421
422 The location should be given by a vector of the form:
423 @quotation
424 @code{[ x-position  y-position  shift-or-not ]}
425 @end quotation
426
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
431 be -1.
432
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.
435
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.
439
440 The third element shift-or-not is 0 if not shifted, and 1 if shifted.
441
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:
445
446   '((?` [-1 0 0]) (?~ [-1 0 1]))
447
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
450 follows.  
451 @example
452 '("1234567890-=\\qwertyuiop[]asdfghjkl;'`zxcvbnm,./!@@#$%^&*()_+|QWERTYUIOP@{@}ASDFGHJKL:\"~ZXCVBNM<>?" ((?` [-1 0 0]) (?~ [-1 0 1])))}
453 @end example
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.
456
457 @example
458 (setq *quail-keyboard-translate-table* '("\
459 1234567890-=\\\
460 qwertyuiop[]\
461 asdfghjkl;'`\
462 zxcvbnm,./\
463 !@@#$%^&*()_+|\
464 QWERTYUIOP@{@}\
465 ASDFGHJKL:\"~\
466 ZXCVBNM<>?\
467  "
468   ((?` [-1 0 0]) (?~ [-1 0 1]))))
469 }
470 @end example
471
472
473 @contents
474 @bye