Add any symbol without leaving the keyboard

Writing about science often involves using symbols. Unfortunately, few of the symbols we need can be found on the keyboard, which presents a problem. It is not difficult to copy and paste symbols needed, but it is tedious and annoying. Here I present a solution that lets you input any symbol by simply typing its name (prepended with a slash).

The solution described below works for Windows (using AutoHotKey) or Linux (using AutoKey). These tools, among other things, can convert sequences of keystrokes to different, desired outputs. For example, if I were to type “/delta” or “/Delta” in any application, it would replace that text with δ or Δ, respectively.

animation2

In the example above, I’ve taken a LaTeX-like approach, but with a forward slash in place of the backslash (therefore not obstructing standard LaTeX commands). You don’t need to know a thing about LaTeX, however, to make use of this solution, and extending the delta example to any unicode character (i.e. any character ever) is easy.

Windows

If you are unfamilar with AutoHotKey, don’t worry, the instructions below are all you need.

1) Download AutoHotkey.
2) Download my AHK script here (it’s just a plain text file, with an .ahk extension).
3) Save the script in your startup folder so that it will run all the time. (To find your startup folder, simply type “startup” in Windows Explorer’s address bar and press enter.)

Add your own symbols

To add a new symbol is simple: Right-click on the .ahk file, choose “Edit Script”, and scroll to the bottom. By that stage you will see that it is self explanatory and you simply need to copy and paste and adjust to your liking. I recommend Unicode Lookup to search for symbols.

ahk_example2

AutoHotKey, Inkscape, and unicode

Writing macros is often easy with AutoHotKey. However, I initially ran into trouble with Inkscape not accepting unicode characters sent by the script. To solve this problem, my script employs a method that sends the unicode character via the clipboard (equivalent to using copy and paste). Credit for this solution goes to Evgeni.

Linux

AutoKey, a Linux utility, is in many ways similar to AutoHotKey (not surprising, given the name).

1) Download the Python 3 version of AutoKey. (The original AutoKey used Python 2, which does not integrate as well with unicode characters.)

For Linux Mint, Ubuntu, and possibly others, AutoKey-py3 can be installed as follows:

# Install the original autokey
sudo apt-get install autokey-gtk
# Update autokey to python 3 using pip3
pip3 install --user autokey-py3

To run the application

~/.local/bin/autokey-gtk

2) Open AutoKey and choose “New” from the toolbar, then “Phrase” from the dropdown menu

autokey_steps1
The numerous folders seen in my AutoKey screenshot are a testament to its potential to make computing easier

3) Give your phrase a name (e.g., the name of the character).
4) Paste the desired unicode character in the large, blank text box on the right.
5) For best results, select “Clipboard (Ctrl + V)” under the “Paste using” option.
6) At the bottom of the screen, you will see an option to “Set” an “Abbreviation”.

autokey_steps2
Steps 3–6

7) Choose Add, then type in your chosen abbreviation, e.g., /Delta for Δ.
8) Choose the appropriate options. The only required option is “Removed typed abbreviation”. I often check two additional boxes.

autokey_step3
Steps 7–8
Advertisements

Author: hugke729

PhD student in physical oceanography

2 thoughts on “Add any symbol without leaving the keyboard”

    1. My first guess as to why it doesn’t work would be that the font is missing all the characters in your phrase. I’m basing this on the fact that it prints out a subset of your phrase

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s