If you use a computer to take notes a lot (I do), and those notes often involve math expressions (mine do), you become quickly aware that word processing apps are really not designed for this. Inserting any symbol that isn’t on a standard qwerty keyboard requires extended mouse acrobatics and searches through long lists of obscure symbols (MS Office — pages and pages of variants of Arabic script? Seriously? Who uses this stuff?).

symbols

Today’s post, though, is about a different “pain point”: subscripts and superscripts, which are used constantly with math symbols, and require ridiculous contortions to type.  In MS Office products, you have to first select the affected character(s) (requiring either mouse highlighting or shift + arrow keys), then press control and = simultaneously to make it a subscript, or control and shift and = simultaneously for superscript. And at least half the time (I admit I may be unusually uncoordinated), shortly thereafter I will discover that I was still stuck in subscript or superscript mode when I continued typing, so I have to go back and correct whatever I typed before I noticed that it did that.

One useful weapon against these annoyances is: Autohotkey. This is a wonderful free open source program that lets you write instructions into a text file, which then causes the computer to respond to particular keys in whatever way you specify. These instructions can be made general, so that they apply all the time, or they can be made to apply only within a specific application (i.e. only in MS OneNote, as with the one reproduced below). Autohotkey provides a very easy solution for assigning key combinations to commonly used symbols like Greek letters (see here for details). The downside is, if you want to do anything more complicated than that, there is somewhat of a learning curve involved. (It’s a very versatile program, and in principle you can write macros to control just about anything in any other application, in any way that you can conceive of.)

This isn’t a tutorial on Autohotkey scripting — that could easily take an entire book (e.g. this one, or see this lifehacker post for a somewhat dated gentle introduction) — this is about trying to find a rational way to type subscripts and superscripts. You’re probably wondering, is any of this really worth all the time it takes to install Autohotkey and write and debug a script? How many subscripts and superscripts could I have entered via the standard brain-dead Microsoft default, in the time that it took to set up an Autohotkey macro?

Lots, actually, since it turned out that MS OneNote in particular had some built-in weirdnesses that took me a while to figure out how to get around. But here’s why I still think this sort of thing is worth doing: the issue isn’t how much time it takes to go through an expression like ψ(x, t) = ∑nC1e-iωtψn(x), highlight (separately) each of the subscripts and superscripts, press the right control / shift / = combination, correct the ensuing errors, etc. The issue is how distracting it is to do that while you’re concentrating on (say) what a lecturer is saying about some math concept that you’re already struggling to grasp. It breaks flow. This is one reason why many note-takers, me included, find that note-taking on a computer is considerably harder and more stressful than using old-fashioned pencil and paper. I do it anyway, because the advantages of computerized searching, image handling, organizing, archiving, backup, etc. outweigh the disadvantages. But to me, at least, it’s worth some effort to try to hone the tools to the point that they aren’t constantly getting in the way and interrupting one’s concentration.

Anyway, here is my current solution (it’s a work in progress, any suggestions welcome), implemented via an Autohotkey script (see below): Type the whole expression without regard to subscripts and superscripts. Then position the cursor at the beginning of the expression. Holding the control key down, press up arrow if the next character is superscript, down arrow if subscript, and right arrow if neither. The cursor advances one character with each arrow key press, regardless of which one. This way, you only have to go through the expression once, with one arrow key press per character, and it gets all the subscripts and superscripts.

Here is the AHK script (this limits the effect to OneNote only, that’s what the #IfWinActive line does):

#IfWinActive ahk_class Framework::CFrame
<^Up::
{
SendInput {Shift down}{Right}{Shift up}
SendInput ^+=
SendInput {Right}
}
return</code>

<^Down::
{
SendInput {Shift down}{Right}{Shift up}
Send {Control down}={Control up}
SendInput {Right}
}
return
<^Right:: SendInput {Right}
#ifWinActive

See also: http://lifehacker.com/5598693/the-best-time-saving-autohotkey-tricks-you-should-be-using

Leave a Reply

Your email address will not be published. Required fields are marked *