Blog
Below you find my 5 latest articles. For older articles, you can search the archives by title or by tag.How to type a square character in Mac OS X
The founders of the Paderborn Center for Parallel Computing, my current employer, have made the choice to use PC² instead of PCPC as the official acronym for the institute. While this choice bears the advantage of memorability, typing a square character (²) on a Mac is tedious because the standard keyboard layout does not provide a default key combination to directly type a square character. But as Mac OS X is highly customizable, it needless to say that there are solutions for this problem. In the following, I present three solutions to the problem, that are partly complementary.
1. System wide "Text and symbol substitution"
Since version 10.6 (Snow Leopard) Mac OS X provides support for system wide "Text and Symbol substitution" that can be configured in the "Language & Text" system preference pane. This method allows to setup the text input system to automatically replace PC2 with PC², whenever the text PC2 is typed.
To configure this text substitution open the "Language & Text" preference pane in system preferences and navigate to the "Text" tab. Using the plus button you can setup a new replacement rule that replaces "PC2" with "PC²" (see screenshot below). For typing the ² character, you can use the character viewer or copy and paste the string from this article.
This text replacement will become active only, after your applications have been restarted, hence I suggest to log out and log in again. A limitation of this approach is that it works only in applications that have been built using the OS X Cocoa libraries. While this will cover the vast majority of the applications you are likely to use, there is one notable exception: Microsoft Office 2008 for Mac still uses the outdated Carbon libraries, hence the text substitution will not be available. Fortunately there is an easy workaround, which I will describe in the next section.

2. Application-specific text substitution (Microsoft Office 2008)
Since Microsoft Office 2008 is still an application that uses the outdated Carbon libraries, it does not enjoy the system wide text substitution feature of Mac OS X 10.6. However, Word and PowerPoint allow for configuring text substitutions in the application using the "Auto correct" feature.
To setup the substitution select the Option "AutoCorrect" from the "Tools" menu and configure the substitution as shown in the screenshot below. For some reason Microsoft decided that its Office applications do not share the substitutions, hence the substitution has to be setup in every application separately.

3. Configure Cocoa Keybindings
The most flexible way to configure the keyboard layout on OS X is to setup custom key bindings. In fact, keybindings go much beyond simply assigning characters to specific key combinations, but allow to customize the Cocoa text system in a very powerful way. An excellent presentation by Jacob Rus on how to configure the Cocoa Text Input system can be found here.
For the use case of binding the ² character to a specific key combination, the required configuration is however not very difficult. Keybindings are configured using XML property lists. For binding the ² symbol to the key combination ⌃⌥2 (aka Ctrl+Alt+2) simply create a file at ~/Library/KeyBindings/DefaultKeyBinding.dict with the following contents.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>^~2</key>
<array>
<string>insertText:</string>
<string>²</string>
</array>
</dict>
</plist>
It may be necessary to create a KeyBindings directory in the Library sub-directory of your home folder first. In the case that you have already configured your default keybindings, simply merge the relevant parts of the property list above with your DefaultKeyBindings.dict.
As for the system wide text substitutions introduced above, this keybindings affect only Cocoa applications and also require a restart of the applicaitons to become active.
Written April 13th, 2010TextMate Command for Umlautification of LaTeX Sources
Before LaTeX gained solid support for UTF-8 encoded text, it was common practice in LaTeX sources to use a \"-prefix to turn regular letters into umlauts. For example, the letter 'ä' is written as \"a in this notation.
The prime advantage of this method is that it works with plain ASCII-encoded LaTeX source files; also it enables users to use umlauts even if their keyboard does not feature umlaut keys. However, the drawback of this notation is that texts with many umlauts become very difficult to read since the ubiquitous \" prefixes add a lot visual noise to the text.
In the last years, LaTeX's support for text in Unicode UTF-8 encoding has become very solid and can be easily activated using the inputenc package like this:
\usepackage[utf8]{inputenc}
The following Ruby script converts LaTeX source files from the old notation into UTF-8 encoded Umlauts, which is much more readable. The script is intended to be used as a command in the TextMate editor. To add the script to the LaTeX bundle, bring up the "Bundle Editor", select the LaTeX bundle and add a "New Command" using the plus symbol below the bundle list. Chose "Selected Text or Document" as Input, chose "Replace Selected Text" as output, and copy the script below to the "Command(s)" field. After reloading the bundle, the command will appear as command of the LaTeX bundle available through the "Gears"-menu in TextMate's status bar.
#!/usr/bin/env ruby
$KCODE = 'U'
text = STDIN.read
text.gsub!(/\\"a/,'ä')
text.gsub!(/\\"o/,'ö')
text.gsub!(/\\"u/,'ü')
text.gsub!(/\\"A/,'Ä')
text.gsub!(/\\"O/,'Ö')
text.gsub!(/\\"U/,'Ü')
text.gsub!(/\\"s/,'ß')
print text
Written April 11th, 2010
Essential Mac Software - 2010 Edition
It's time for the yearly update for my list of Mac software which I consider essential for my daily work. There are a couple of new entries, but also a couple of applications that have been retired.
The following list presents a choice of my favorite MAC applications (in alphabetical order):
- Aperture iPhoto's big brother - I love the new photo editing capabilities added in version 3, which go much beyond iPhoto. Also the user interface seems much more MAC-like than Adobe Lightroom.
- BibDesk The best BibTeX frontend ever.
- CSSEdit Beautifully designed CSS editor from the makers of Espresso.
- Flip4Mac Adds support for Microsoft video formats to QuickTime.
- LaunchBar 5 The ultimate application launcher.
- Macports Install command line Unix tools on OS X.
- NetNewsWire My favorite RSS reader.
- OmniGraffle In my opinion the best vector graphics drawing program for technical illustrations in computer science and engineering.
- OmniOutliner Although the outliner hype has faded in the last years, still a useful application for collecting hierarchically structured data.
- Perian QuickTime support for many popular video formats.
- RipIt Rips DVD movies to disk images that can be played with the standard DVDPlayer application.
- Skype VOIP and instant messaging.
- Skim PDF and DVI viewer, perfectly integrated with TextMate's LaTeX mode.
- SuperDuper Harddrive cloning tool, perfect complement to TimeMachine.
- TextMate My standard multi-purpose text editor for writing and programming. Provides good support for LaTeX.
- Things Elegant and simple task management application.
- Transmission BitTorrent client.
- TubeTV Rip YouTube and Flash videos to disk.
Plugins for Mail.app:
- Mail Act-On Control Mail.app with your keyboard.
- Mail Tags Adds Tagging to Mail.app. I love this plugin as it allows me to classify archived emails with tags rather than using different mail folders.
I don't longer use these applications, that were still on my last list:
- Cocoabooklet Booklet printing is now supported directly by Preview.app.
- GPGMail Plugin Still no SnowLeopard compatible version available. Also it seems that SMIME is much more popular for signing and encrypting email these days.
- MarsEdit Excellent Blog post editor, but I switched static website generator for blogging, which makes MarsEdit obsolete.
- OmniFocus In my opinion an over-hyped GTD-inspired TODO list manager, that is too clumsy and overloaded with features. I like Things much better.
- Quicksilver Obsoleted by LaunchBar.
- SSH Keychain In recent OS X versions, the SSH version shipped with OS X has gained basically the same functionality.
- VLC Videoplayer For years I haven't met a video file that QuickTime player X with the Perian plugins cannot play.
New website released
I'm writing this post to let you know, that I have redesigned the guts and the look-and-feel of plesslweb.ch. I have switched from Wordpress to nanoc, a versatile web publishing system. I was never happy with Wordpress. Editing posts through the web did not fit my work flow, also Wordpress needs constant maintenance to keep up with the frequent security updates.
I will discuss the benefits of nanoc and the process of converting from Wordpress to nanoc in a later article, once I have ironed out all wrinkles of the new website. Please let me know you notice any problems with the new site.
Written March 30th, 2010New wkpdf implementation released
I happy to announce wkpdf version 0.3.0 - a new implementation of wkpdf, on which I have been working over the last months.
This version does not provide any major, user-visible features but is mainly a re-implementation in the Ruby programming language. Since Mac OS X 10.5 Apple ships the operating system with a full Ruby installation and also includes the RubyCocoa bridge for interfacing Ruby code with Cocoa and the OS X Frameworks. wkpdf uses this bridge for accessing the WebKit framework for rendering HTML as PDF.
The new wkpdf version provides the same features as the previous Objective-C version of wkpdf, but provides a simpler installation procedure. Also, the source code of the project is now hosted on github.com and I hope that this will encourage other developers to contribute to wkpdf. The old wkpdf website wkpdf.plesslweb.ch and the Subversion repository http://svn.plesslweb.ch/wkpdf will be discontinued.
For the impatient among you, you can install wkpdf with the following command:
sudo gem install plessl-wkpdf --source http://gems.github.com
For more information about wkpdf and how to use it, please refer to the brand new wkpdf website at http://plessl.github.com/wkpdf. Developers can browse wkpdf's latest source code and clone or fork the wkpdf git repository at http://github.com/plessl/wkpdf/tree/master.
I hope you enjoy the new version and I'm looking forward to your feedback.
Written July 25th, 2009