Author: Urs Holzer <urs@andonyar.com>

Input Methods for Mathematics

Mathematicians need to input many different characters (arrows, equal signs, operators, latin letters, greek letters). Unfortunately, a keyboard is too small to have a key for every mathematical character. LaTeX uses names for every non-ASCII character, for example \alpha for α. The input methods you find here try to generalize this idea. They allow you to use such names to input Unicode characters in all applications.

Download all my methods and tools as tarball.

Required Software

Most of the following input methods are written for the m17n library. Any application using this library should thus be able to use these methods. I actually use the software iBus under Linux. iBus has an input engine that uses the m17n library. With iBus, you should be able to use these input methods with nearly any X11 application. Furthermore, there is also SCIM which can also make use of m17n is is available for Linux. Unfortunately, I do not know whether iBus, SCIM or m17n also work on other operating systems than Linux (using X11). However, I am sure that for windows and for the mac, there are similar ways to reach the same goal. Please inform me if you know more. If you have a question that is not answered here, feel free to contact me.

Installation howto for Debian Etch

Here I tell you how I installed SCIM and my input methods on a Debian Linux Etch system. For other Linux distribution it might be different. Most important, not all distributions use im-switch, I guess.

First, install the packages im-switch, scim, scim-m17n and their dependencies. (Perhaps you are also interested in scim-modules-table and scim-tables-additional which hides a small table for a LaTeX-like input method.) Under debian etch, one uses im-switch to change the input method to scim. This can be done as a normal user, if you want to make the change only for this user. You can also call it as root, this changes the default for all users. Call im-switch -s scim. If you have problems and want to make this change undone, you can call im-switch -a to revert to default. Now, start a new X session. This creates a file ~/.scim/global. Open this file in an editor, and look out for the line beginning with /SupportedUnicodeLocales. If it does not exist, create it. Here you have to list all the Locales you use. In my example, the line is /SupportedUnicodeLocales = de_CH.UTF-8. (By the way, it is recommended to use an UTF8 locale.) Now close the X session and start a new one. SCIM should be working now, i.e. there should turn up SCIMs symbol in you task list, or at least, hitting CTRL+Space in an application should show scims control panel. Now, open SCIMs configuration dialog and remove all input methods you do not want to use.

The last step is to install my input methods. m17n looks in the directory /usr/share/m17n for its database. There I simply have put a symbolic link to the mim-file for my input method which I keep in my home directory. This of course does not work for other users that do not have access to my home directory. I do it this way, because like this, it is easy for me to modify the input method. You can also put the mim-file directly into /usr/share/m17n. (Perhaps you do not like this and rather want to put it under /usr/local/share/m17n. I do not know whether this works automatically, but I think that you have to modify /usr/share/m17n/mdb.dir, i.e. add something like (input-method * "/usr/local/share/m17n/*.mim") or similar. However, I do not know whether this works since I have not tested it.) Now, after starting a new X-session, the new input methods should be available in SCIM.

Are you trying to use my Swiss-German Math method and it does not work? In this case you probably have the same problem as I had. I encountered this problem on my amd64 system but not on my x86 laptop. Somehow it seemed that SCIM did not correctly hand over keyboard events to m17n. xev is a good tool to find out which key events are generated. According to a post on the m17n mailinglist, one can do the following in order to inspect what happens between SCIM and m17n: Start an X session and do killall scim-launcher. Be aware that this probably kills running X applications. Now restart SCIM like this: MDEBUG_OUTPUT_FILE=/tmp/m17n-log MDEBUG_INPUT=1 GTK_IM_MODULE=scim gvim Of course, you can use another application instead of gvim, another editor for example. Now hit the keys you are interested in a few times. The file /tmp/m17n-log then reveales the symbol names that are handed to m17n by SCIM. The fun thing is, that after doing that and restarting the X session, it worked.

Installation howto for Debian Lenny

The installation on lenny works mainly the same way as for etch. However, you will have to create the file ~/.scim/global yourself. The Swiss-German Math method should work right away as long as you set the Keyboardlayout in the SCIM configuration dialog to "unknown".

Methods

Here follow different flavours of input methods for mathematics. However, they are badly synchronized. It is very possible that in one method you can't find a character that is present in another. Also, they are in an early stage. You will surely miss many characters but, of course, you can add additional characters yourself.

At first, I had the idea that one should be able to automatically create a personalized input method. For example, one prefers the names from LaTeX, others rather want names similar to the ones from the unicode database. I like to use directions for arrows like in the editor vi, others probably hate vi. Some might want to call the characters by their meaning, others by their visual appearance. However, this requires more detailed data about characters than is available in the unicode database. It is at the moment not possible for me to start a project that collects this data, but who knows what the future brings.

It is not trivial to use these input methods. Please look at the files (they are all text files) to learn how to use them and how the characters are called.

If you want to contribute, please send me your modifications.

Swiss-German Math (SwissGermanMath.mim)

This input method is specially crafted for the swiss german keyboard layout. This layout contains keys for ö, ä, ü. Hitting those keys while holding shift results in é, à, è respectively. Since these characters are nearly useless when you write german, one can use them to access mathematical characters instead. If you do not have a swiss german keyboard, this method is useless for you. However, since I use it all the time, it is the most mature.

é is used for accessing various mathematical characters and the greek alphabet. à is used for arrows. Arrows have very short names such as àdl for ⇒, àdd for ⇔, àsh for ←. (Mostly, the second letter is the style of the arrow and the third one the direction. For the direction, the vi-like h,j,k,l are used.) è is used for accessing script, double-struck and fractur letters and digits. The key with the diaeresis (the one with the !) is used for accessing combining marks.

State Math (StateMath.mim)

This input method has two states. One is for normal input, the other is for inputting mathematical signs. One can switch from one state to the other by hitting a special key.

Full Math (FullMath.mim)

This is as simplification of State Math. It has only one state which equals (more or less) the mathematical state of State Math. This is a better choice for you, if you can change the actual input method quickly with the keyboard. This also allows you to use the math input method together with another input method for normal text.

This input method can, since it uses no states, also be implemented using SCIM's table engine. Unfortunately, I have not done this up to now.

Entities (Entities.txt)

If you like XML entities, then this input method may be of interest. When you type in an entity, for example &gt;, then its value will be inserted, > in our example. The entities have been taken from the w3c working draft "XML Entity definitions for Characters". Unfortunately, numeric entities such as &#x003e; are not available.

This method is not an m17n input method. It uses SCIM's table module instead. In order to use it, you can simply install the file Entities.txt as a table in the configuration dialog of SCIM. (You do not need to care about entities.pl unless you want to regenerate the table yourself.) You need to have installed SCIM and it's table module as described above. As far as I know, this table should also work with iBus, but I have not tested it.

Others

There are some other methods I am considering. For example one for writing normal text and mathematics mixed without changing method or state. I still have to find out whether this is possible at all in a usable way.

Tools

For generating the entries for the mathematical alphabets (script, double-struck, fractur, etc.) I wrote a small perl script called MathAlphanum.pl which parses the NamesList.txt from the unicode database

Usage examples

I am working on a usage example with LaTeX. If you write LaTeX documents using a text editor, you perhaps want to use Unicode characters. Like this, you perhaps have a better overview, since the characters are schown directly and only the other commands are shown by name.