An international mathematical keyboard layout

Most mathematicians typeset their equations using LaTeX—even this website uses MathJax to allow me to use LaTeX commands to type things like the following formula without needing to type any special characters.

$$\forall \varepsilon > 0, ~ \exists \delta>0, ~ \forall x, ~ |x-a| < \delta \Rightarrow |f(x)-f(a)| < \varepsilon$$

However, this isn’t always possible, as anyone who has tried to communicate mathematics in an email will know. Instead, we must resort to some combination of the following:

  • Spell everything out in words (“for all epsilon > 0, there exists delta > 0, such that for all x, if |x-a| < delta then |f(x)-f(a)| < epsilon”);
  • Substitute a standard character for the special characters (“A e > 0, E d > 0, A x, |x-a| < d => |f(x)-f(a)| < e”);
  • Type out the LaTeX code and hope the reader understands LaTeX commands (“\forall \varepsilon > 0, \exists \delta>0, \forall x, |x-a| < \delta \Rightarrow |f(x)-f(a)| < \varepsilon”);
  • Use a character map or search engine to find, copy and paste each new symbol individually.

Frustrated by this, I decided to make my own keyboard layout containing most of the mathematical symbols I use on a day-to-day basis. Lo and behold, I am now able to type the above formula with no stress!

∀ε > 0, ∃δ > 0, ∀x, |x-a| < δ ⇒ |f(x)-f(a)| < ε

The layout

This keyboard layout modifies the standard US keyboard layout to add symbols accessible by pressing the [Alt R] key. It looks like this:

Each white square represents a key, and the four symbols are obtained by either pressing the key on its own (lower-left), pressing the key together with [Shift] (upper-left), pressing the key together with [Alt R] (lower-right) or pressing the key together with both [Shift] and [Alt R] (upper-right). For example:

  • Pressing [Alt R]+[C] types the symbol ∈ (element of)
  • Pressing [Shift]+[Alt R]+[C] types the symbol ∉ (not an element of)

The ten symbols in red represent dead keys, which gives a way of typing the same diacritic over different letters without necessitating different keys for each letter. In this case, you press the key combination for the desired diacritic, then release all keys and press the key for the desired letter. For example:

  • Pressing [Alt R]+[,] followed by [Shift]+[C] types the letter Ç (upper-case C with cedilla)
  • Pressing [Shift]+[Alt R]+[\] followed by [S] types the letter š (lower-case S with caron)
  • Pressing [Alt R]+[] followed by [Alt R]+[A] types the letter ǽ (lower-case AE ligature with acute accent)

The rationale

Some thought went into designing the keyboard layout, particularly which symbols should be included or excluded, where the symbols should be placed, and so on. Hopefully my reasoning behind most of the decisions I made is self-explanatory, but I feel that a few things deserve some justification.

First, there are some commonly used mathematical symbols that cannot be typed using this layout, most conspicuously ≤ (less than or equal to) and ≥ (greater than or equal to). I decided to prioritise other symbols because it is a well enough understood compromise to write <= and >= instead.

Second, I chose to prioritise diacritics over more mathematical symbols: mathematics is a very international subject and simply typing authors’ names can be challenging sometimes. Unfortunately I wasn’t able to cover all the bases, so a few letters remain untypable, including the Czech letter Ů (U with ring above) and the Polish letter Ł (L with bar).

Third, there is a certain bias towards symbols used in mathematical logic, which is why you see ⊢ (right tack) and ⊣ (left tack), for example. This is because, despite making the layout public, I made the keyboard layout for my own use.

Fourth (and finally), I made no changes to the standard US keyboard layout other than to add keys accessible with [Alt R]. This was to provide minimal disruption to the standard layout.

Installing the layout

The following instructions should work on most flavours of Linux, though I should admit that I use Linux Mint (with Cinnamon) and have not tried it on any other distributions. I have not yet made a version for Windows or Mac—that will have to wait for now, or if anyone reading this would like to volunteer to port it, I’d be glad to update this post to reflect your efforts.

Step 1. Download this file and move it to the directory /usr/lib/X11/xkb/symbols — make sure that the filename is mdc and not mdc.txt or anything else.

Step 2. Open /usr/share/X11/xkb/rules/evdev.xml and insert the following code immediately after the line containing the tag.

    <description>Math Dot Coffee</description>

Step 3. Download this image and move it to the directory /usr/share/iso-flag-png/ — make sure that the filename is mdc.png

Step 4. Navigate to the keyboard layout settings; the ‘language’ of the new layout will be listed as Math Dot Coffee. If it isn’t there, you might need to log out and log in again, or even restart your computer, before it will appear.

List of symbols

What follows is a comprehensive list of symbols together with their official Unicode names.

Each key is listed on its own row as it appears on the keyboard, with rows ordered from top to bottom and keys within each row ordered from left to right. This is done according to the keyboard set up as above—in particular, the [\] key is to the right of the []] key, and not to the left of the [Z] key or anywhere else.

For each key [Key], the symbols are listed in the following order: first [Key], then [Shift]+[Key], then [Alt R]+[Key], and finally [Shift]+[Alt R]+[Key].

Row 1:

  • ` (grave accent); ~ (tilde); (right tack); (left tack).
  • 1 (digit one); ! (exclamation mark); ¹ (superscript one); ¡ (inverted exclamation mark).
  • 2 (digit two); @ (commercial at); ² (superscript two); ½ (vulgar fraction one half).
  • 3 (digit three); # (number sign); ³ (superscript three); £ (pound sign).
  • 4 (digit four); $ (dollar sign); (superscript four); (euro sign).
  • 5 (digit five); % (percent sign); (superscript five); · (middle dot).
  • 6 (digit six); ^ (circumflex accent); (superscript six); (square root).
  • 7 (digit seven); & (ampersand); (superscript seven); § (section sign).
  • 8 (digit eight); * (asterisk); (superscript eight); (infinity).
  • 9 (digit nine); ( (left parenthesis); (superscript nine);  (superscript minus).
  • 0 (digit zero); ) (right parenthesis); (superscript zero); ° (degree sign).
  • (hyphen-minus); _ (low line); (en dash); (em dash).
  • = (equals sign); + (plus sign); × (multiplication sign); ÷ (division sign).

Row 2:

  • q (Latin small letter Q); Q (Latin capital letter Q); (for all); (there exists).
  • w (Latin small letter W); W (Latin capital letter W); ω (Greek small letter Omega); Ω (Greek capital letter Omega).
  • e (Latin small letter E); E (Latin capital letter E); (identical to); (almost equal to).
  • r (Latin small letter R); R (Latin capital letter R); ρ (Greek small letter Rho); ε (Greek small letter Epsilon).
  • t (Latin small letter T); T (Latin capital letter T); þ (Latin small letter Thorn); Þ (Latin capital letter Thorn).
  • y (Latin small letter Y); Y (Latin capital letter Y); (leftwards arrow); (leftwards double arrow).
  • u (Latin small letter U); U (Latin capital letter U); (left right arrow); (left right double arrow).
  • i (Latin small letter I); I (Latin capital letter I); (rightwards arrow); (rightwards double arrow).
  • o (Latin small letter O); O (Latin capital letter O); œ (Latin small ligature OE); Œ (Latin capital ligature OE).
  • p (Latin small letter P); P (Latin capital letter P); π (Greek small letter Pi); Π (Greek capital letter Pi).
  • [ (left square bracket); { (left curly bracket); (mathematical left angle bracket); « (left-pointing double angle quotation mark).
  • ] (right square bracket); } (right curly bracket); (mathematical right angle bracket); » (right-pointing double angle quotation mark).
  • \ (reverse solidus); | (vertical line); ê (circumflex accent dead key); ě (caron dead key).

Row 3:

  • a (Latin small letter A); A (Latin capital letter A); æ (Latin small letter AE); Æ (Latin capital letter AE).
  • s (Latin small letter S); S (Latin capital letter S); σ (Greek small letter Sigma); Σ (Greek capital letter Sigma).
  • d (Latin small letter D); D (Latin capital letter D); ð (Latin small letter Eth); Ð (Latin capital letter Eth).
  • f (Latin small letter F); F (Latin capital letter F); δ (Greek small letter Delta); Δ (Greek capital letter Delta).
  • g (Latin small letter G); G (Latin capital letter G); (partial differential); (nabla).
  • h (Latin small letter H); H (Latin capital letter H); θ (Greek small letter Theta); Θ (Greek capital letter Theta).
  • j (Latin small letter J); J (Latin capital letter J); (integral); ı (Latin small letter dotless I).
  • k (Latin small letter K); K (Latin capital letter K); ø (Latin small letter O with stroke); Ø (Latin capital letter O with stroke).
  • l (Latin small letter L); L (Latin capital letter L); λ (Greek small letter Lambda); Λ (Greek capital letter Lambda).
  • ; (semicolon); : (colon); ë (diaeresis dead key); (tilde dead key).
  • (apostrophe); (quotation mark); á (acute accent dead key); à (grave accent dead key).

Row 4:

  • z (Latin small letter Z); Z (Latin capital letter Z); (intersection); (logical and).
  • x (Latin small letter X); X (Latin capital letter X); (union); (logical or).
  • c (Latin small letter C); C (Latin capital letter C); (element of); (not an element of).
  • v (Latin small letter V); V (Latin capital letter V); (subset of or equal to); (neither a subset of nor equal to).
  • b (Latin small letter B); B (Latin capital letter B); (asymptotically equal to); (approximately equal to).
  • n (Latin small letter N); N (Latin capital letter N); (not equal to); (empty set).
  • m (Latin small letter M); M (Latin capital letter M); μ (Greek small letter Mu); µ (micro sign).
  • , (comma); < (less-than sign); ȩ (cedilla dead key); ę (ogonek dead key).
  • . (full stop); > (greater-than sign); ė (dot above dead key); ē (macron dead key).
  • / (solidus); ? (question mark); ¬ (not sign); ¿ (inverted question mark).