Saturday, October 23, 2010

Typing mathematical characters in X

Unicode provides many useful characters for mathematics. If you've studied the traditional notation, an expression like « Γ ⊢ Λt.λ(x:t).x : ∀t. t → t » is much more readable than an ASCII equivalent. However, most systems don't provide an easy way to enter these characters.

The compose key feature of X Windows provides a nice solution on Linux and other UNIX systems. Compose combinations are easy-to-remember mnemonics, like -> for →, and an enormous number of characters are available with just a few keystrokes.

Setting it up

I cooked up a config file with my most-used mathematical symbols. With recent Xorg, you can drop this file in ~/.XCompose, restart X, and you should be good to go.

The include line will pull in your system-wide configuration, e.g. /usr/share/X11/locale/en_US.UTF-8/Compose. This already contains many useful characters. I was going to add <3 for ♥ and CCCP for ☭, but I found that Debian already provides these.

GTK has its own input handling. To make it defer to X, I had to add an environment variable in ~/.xsession:

export GTK_IM_MODULE="xim"

The "Fn" key on recent ThinkPads makes a good compose key. It normally acts as a modifier key in hardware, but will send a keycode to X when pressed and released by itself. I used this xmodmap setting:

keycode 151=Multi_key

Tweaking the codes

Being boilerplate-averse, I specified the key combinations in a compact format which is processed by this Haskell script.

Obviously, not everyone will like my choice of key combinations. If you tweak the file and come up with something particularly nice, I'd like to see it. If you can't run Haskell code for whatever reason, it's not too hard to edit the generated XCompose file.

Though my use of Haskell here may seem gratuitous, I actually started writing this script in Python, but ran into trouble with Python 2's inconsistent treatment of Unicode text. Using Haskell's String type with GHC ≥ 6.12 will Just Work, at least until you care about performance.

Alternatives

If you don't like this solution, SCIM provides an input mode which uses LaTeX codes.

46 comments:

  1. When I want to write Unicode characters in text files, I'm very fond of emacs Tex input-method. It can be activated with `M-x set-input-method` or `C-x Enter C-\`, and then by selecting `TeX`.

    It allows to write UTF8 characters by using their TeX name : for example typing `\lambda` in an emacs buffer with the TeX input method will produce the `λ` character. Not all character are accessible (all UTF8 characters can be inserted by their unicode name with `M-x ucs-inert`), but the coherent TeX naming is very nice.

    I have used it to write simple text files about type systems that have near-LaTeX readability.

    ReplyDelete
  2. Another satisfied Compose-C-C-C-P customer. :D

    Great post. I've been meaning to write something like this up. I've also been meaning to look into better synchronizing Gtk+ and X's ideas of the compose table, but it's hairy and fraught with backwards-compatibility woes. I think it would also be neat to have a graphical compose sequence viewer, maybe integrated into the Gnome character map. (So, you hunt for a symbol, find it, and there's a hint saying “to type this character, press …” or an “add a shortcut for this character…” as appropriate.)

    ReplyDelete
  3. I suppose this isn't very useful to non-CJK speakers, but... on Windows, you can achieve the same thing using the IMEs (eg. the Japanese IME). FYI.

    ReplyDelete
  4. Jio Giga Tv
    ohh really your post is Amazing...
    I enjoyed your content

    ReplyDelete
  5. food ordering app india
    hello today i Reached ypur site and I find your site speed is so Amazing and posts are wow

    ReplyDelete
  6. Hey,
    Thanks for sharing this helpful & wonderful post. i really appreciate your hard work. this is very useful & informative for me.
    thanks for sharing with us. thanks a lot.
    Regards
    howgadgets

    ReplyDelete
  7. https://autocracking.com/easy-cut-studio-pro-crack-with-key/
    Easy Cut Studio Pro Crack is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents. Get all of these by easily just on a single click.

    ReplyDelete
  8. https://approvedcrack.com/vmix-cracked-with-torrent/
    vMix Crack is the vision mixer software that available in the window operating system. This software produced by StudioCoast PTY LTD. stable release of this software is 23.0.0.41.software Witten by VB.Net language. The operating system required by this software is window 7 and another later window. software launch in IA-32 and x86-64.vMix an available at least 9 languages German, English, Spanish, French, Japanese, Korean, Portuguese, Russian.software is like live streaming software. License use trialware. The website used to publish this software is vMix.

    ReplyDelete
  9. https://chsofts.com/one-click-root-torrent-full-crack/
    One Click Root Crack is the professional root program for android. It can run on Windows XP, Vista, server 2008, 7 and Windows 10. It is introduced by the team of authoritative android programs. One Click Root allows you to root your android devices within a click. The software can download on a computer with a USB cable, linked to mobile or automatically on android.

    ReplyDelete
  10. https://activatorskey.com/morphvox-pro/
    MorphVOX Pro Crack is a software helps to change the form of your voice. It is introduced by screaming bee Inc. MorphVOX Pro Produces multiple surprising results, as you say something in your microphone. It permits the program to distort your cry into something new. Morph VOX Pro is a voice changer software. The software can run on Windows 8.1, 10, 8, Windows XP, 7, and windows vista.

    ReplyDelete
  11. https://crackeypc.com/cinema-4d-r22-cracked-torrent/
    Cinema 4D Crack is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents. Get all of these by easily just on a single click.

    ReplyDelete
  12. https://rootcracks.org/morphvox-pro-crack-full-keygen-free-here/
    MorphVOX Pro Crack is the latest software that can help you to change the voice. On the other hand, it can also introduce it by your screaming in your bee Inc. While, on the other hand, the Morph VOX Pro crack can also help to produce the multiple surprising of all kinds of results. Furthermore, this thing is also permitting all the programs and the distort of the cry in something to the new one.

    ReplyDelete
  13. https://latestcracked.com/youtube-by-click-premium-free-download/
    YouTube By Click 2020 Crack it’s an all in one media provider and downloader software. Best known for downloading videos in one click. And also famous as the best online videos streaming sits. It supports millions of sites worldwide. It gives you every type of video that you want. All you have to do is to type the video name or hint that you want.

    ReplyDelete
  14. https://activatorpros.com/virtual-dj-pro-key-download-here/
    Virtual DJ Pro 2020 Crack is all good, for anybody to place a flaw. It has tabbed playback, which enables you to make and save samples special buttons and has several different sound editing purposes and permits one to edit just two monitors in real-time to earn a stay mixture. Virtual DJ Serial Number includes a lot of sound instruments, builtin effects on that I’ve written previously may produce your paths of these MP3 songs records from the player that is built-in.

    ReplyDelete
  15. https://fixedcrack.com/adobe-acrobat-pro-dc-with-crack/
    Adobe Acrobat Pro Dc Serial Key, comprises a completely free app that allows you to combine and ship PDF files.

    ReplyDelete
  16. gta 2 free downloads
    Grand Theft Auto II Pc Download: an famous action, adventure game. DMA Design developed Grand Theft Auto 2 Torrent. Rockstar Games published GTA 2 Torrent. It is the sequel to the earlier released game Grand Theft Auto 1997 in the GTA Games Series. GTA 2 Free Download Full Version Pc Game Highly Compressed features both single player as well as the multiplayer gameplay modes. The players can explore the game world by foot or by the use of vehicle.

    ReplyDelete
  17. bhai content tgda likhe ho …sabse acha apka yeh article lga mujhe ..i really like ur content bro
    The tech tushar

    ReplyDelete
  18. thanks for your post i have found the information that i want on your blog its such a nice theme .
    thanks for your infomative post .
    Free Full Pro Keys for Windows & Mac software

    Full Pro Keys

    ReplyDelete

  19. bhai content tgda likhe ho …sabse acha apka yeh article lga mujhe ..i really like ur content bro
    The tech tushar

    ReplyDelete

  20. post bahut acha hai ..i really like ur post bro
    The tech tushar

    ReplyDelete
  21. Online health & safety essay writing services are very difficult to complete and many students are always searching for Health & Safety Writing Services to help them complete their health & safety research paper writing services and health & safety coursework writing services.

    ReplyDelete
  22. People daily search for many Pc Games on web form different ages and from different parts of the world. Do they find the games of their interest?

    Many famous websites are available to download many games the old ones and the new games too. Pc Games Here is a place where you can find and Download Pc Games Full Version.

    On this site you can find all the games in different catogeries like GTA Games, NFS Games, Car Racing Games, Fighting Games, Cricket Games and Football Games. Some Of The Pc Games are described below.

    I love to play football and this is my favorite game which i play most. You can also visit here for
    The Crew Wild Run Download

    God Of War 3 Pc Game Highly Compressed Free Download

    ReplyDelete
  23. After watching so much tv and eating fast food as well as laying all the day also effect our health so much. So that make us feel tired as well as feeling not good. So you must use several medicines for the eradication of all these type of symptoms. You would love to have this if you want to know about
    actrapid

    ReplyDelete
  24. Before knowing about the process to connect the printer to the computer or other devices, we can see about the ij start canon. Technology Info

    ReplyDelete
  25. Windows 10 Activator Crack
    Windows 10 Activator Crack is a tool that can use to activate all editions of Windows 10 and ultimately explore the fantastic features you never thought of before. In normal mode, we use a disabled version of Windows and cannot use all features. Therefore, to use all tools and functions, we must first enable Windows.

    ReplyDelete
  26. Avast Cleacnup Crack
    Avast Cleanup Crack method after scanning the crap document to prepare the PC for removal with a variant will be here now. The application form has a wish to remove crap, temporary re-cycled files. It’s a high-level scanning option since it arranged and organized. There are similar kinds of files that last the HD format, but you needn’t delete them. After you download the HD arrangement of data, pictures there remain distance. Well, it’s about to earn mileage.

    ReplyDelete
  27. Malwarebytes Crack
    VSDC Video Editor can serve you to set the minor bugs. So you can work with it efficiently. You can easily avail of both reading and writing formats. You can create a video without any struggle with visual and audio effects. There are various video editors in the market, but it has excellent functionalities through which you can upload your videos to the online programs. You can also create many kinds of diagrams like Pyramid 3D Radar Spline, 3D sketches, Pyramid, and several more. From this application, you can download videos from various platforms. With the help of a multicolor Chroma key, you can produce high-quality videos in a brief time.

    ReplyDelete
  28. Camtasia Studio Crack
    Cracked Here is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents.
    Get all of these by easily just on a single click.

    ReplyDelete
  29. Mailbird Pro Crack
    Cracked Here is a useful place where you can easily find Activators, Patch, Full version software Free Download, License key, serial key, keygen, Activation Key and Torrents.

    ReplyDelete
  30. The students will be able to check their UP Board Result for Class 12 via SMS also. The UP Board 12th Result 2021 would comprise the student's roll UPMSP 12th Result 2021 Around 25 lakh students will be able to check their UP Board Result 2021 Class 12 for the UP 12th examination which will be conducted in April and May 2021.

    ReplyDelete
  31. Hey, I'm Santana Blackwell. I'm from Los Angeles. I'm a Software Engineer. Here's my web URL

    https://execracks.com/

    And I make Softwares like::

    https://execracks.com/microsoft-visio-pro-2021-crack/

    https://execracks.com/antares-autotune-pro-crack/

    https://execracks.com/utorrent-pro-crack/

    ReplyDelete

  32. طرق كشف تسريب المياه

    تتعدد طرق الكشف عن تسربات المياه ما هو يدوي، وحتى نتأكد من ذلك نقوم بإغلاق كافة المصادر التي تمد المنزل بالمياه من محابس وحنفيات مع إعطاء كافة أفراد المبنى بعدم استعمال المياه نهائياً في الفترة الزمنية التي تُغلق فيها المصادر في خطوة لتحديد قراءة العداد ورصدها ويُفضل أن يستمر الحال على هذا النحو مدّة تصل إلى خمس ساعات وبعد مضي الفترة يتم قراءة العداد مرة أخرى، ففي حال تطابق اقراءة الاولى والثانية يكون المنزل خالياً من التسريبات، وفي حال وجود فارق بينهما فإنّ ذلك يدل على مقدار المياه المتسربة ويستدعي الأمر الاستعانة بشركات كشف تسربات المياه لإصلاح المسألة بصورة سريعة كي لا تتفاقم المشكلة.
    شركة تنظيف مكيفات بجدة
    شركة تنظيف خزانات بمكة
    شركة كشف تسربات المياه بجدة

    ReplyDelete
  33. Working with this program is very simple and you just need to select which folder or video file you want to download and after separating it from the area to be edited, review the output results before final storage. This Site

    ReplyDelete
  34. Download the latest Cracks with CracCOol website patch, Serial Key, License Key and Keygen Full Free

    ReplyDelete
  35. Thanks for nice post and information... recentjobs

    ReplyDelete
  36. https://crackcool.com/babylon-pro-ng-crack/
    You can transfer any document from Microsoft’s workstation and translate it mechanically to its original format. No need to waste time duplicating and pasting or formatting your text. It is comfortable and easy to use.

    ReplyDelete