XML technologies / DocBook / Inline elements / Keyboard-specific elements

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Many programs offer functions through keyboard shortcuts. DocBook can mark up these hotkeys using the following keyboard-related elements:

accel

A shortcut key in a GUI:

<para>Sichern Sie Ihre Daten mittels <guimenu><accel>S</accel>peichern</guimenu>.</para>

Ergebnis: Sichern Sie Ihre Daten mittels Speichern als....

keycap

A key (explained below).

keycode, keysym

An internal identifier (keycode) for a key, often numeric, and a symbolic name (keysym):

<para><keycap>F1</keycap> entspricht <keycode>0x3B</keycode> und hat den symbolischen Namen <keysym>KEY_F1</keysym> ...</para>

Examples of keycap:

<keycombo>
  <keycap>Strg</keycap>
  <keycap>C</keycap>
</keycombo>

For common keys such as Strg, Alt and others, use the attribute function (available from DocBook 4.3):

<keycombo>
  <keycap function="ctrl">Strg</keycap>
  <keycap>C</keycap>
</keycombo>

This improves consistency and reduces translation work. The result is: Strg + C. Between Strg and C an additional character is inserted, varying by convention. Control it with the attribute action in keycap or keycombo. The following values are allowed:

click

indicates a single mouse click, possibly combined with another key.

double-click

like the option click, but requiring two quick mouse clicks, a double-click.

press

A mouse click or key press.

seq

A sequence: keys are pressed one after another rather than together.

simul

Simultaneous key presses or mouse clicks.

other

Another nonstandard action identified more precisely by the attribute otheraction.

To mark up Emacs key combinations, write:

<para>Die Tastenkombination zum Speichern in Emacs lautet:
 <keycombo action="seq">
  <keycombo action="press">
    <keycap>C</keycap><keycap>x</keycap>
  </keycombo>
  <keycombo action="press">
    <keycap>C</keycap><keycap>s</keycap>
  </keycombo>
...</para>

The result is: Strg-x Strg-s.

shortcut

A key combination also available through a menu item (see GUI-specific elements).

  

back to top