14

I want to input:

  • Celsius degree symbol
  • Common Greek letter: Alpha, Theta, Omega
14

If you are familiar with TeX, you will find the TeX input method helpful. Just do

M-x set-input-method TeX

then type something like \alpha — it will be replaced with the corresponding Unicode character. You can switch the input method off by typing C-\.

You can find all the supported TeX commands with

M-x describe-input-method
  • Yes, I know some TeX. This method solved all the math symbol in a unified manner as well. Thank you! – Nick Dec 23 '14 at 0:28
16

The standard Emacs way to do this is C-x 8 RET followed by either the Unicode code point (a natural number) or the Unicode name of the character. Completion is available for the name.

If you use library Icicles then you can complete the name using parts of it, with multiple patterns matching different parts, if you want. And you can see the characters themselves, next to their candidate names, in buffer *Completions*.

For example, C-x 8 RET cels S-RET completes to DEGREE CELSIUS 2103 ℃ and inserts that character, .

5

In addition to C-x 8 RET, mentioned here that lets you insert any character by name, C-x 8 also has many shortcuts for inserting common characters. In this case, C-x 8 o inserts "°". See them all with C-x 8 C-h

The C-x 8 keymap is also a good place to define your own shortcuts to insert the characters you use most often. The Greek letters aren't bound to keys by default, but we can add them with lines like

(global-set-key (kbd "C-x 8 a") (lambda () (interactive) (insert "α")))

which will make C-x 8 a insert a GREEK SMALL LETTER ALPHA. I got the initial alpha in the global-set-key line by using C-x 8 RET and searching for "alpha"

2

I'm using this:

(defun helm-insert-char ()
  (interactive)
  (helm :sources
      `((name . "Unicode char name")
        (candidates . ,(ucs-names))
        (action . insert))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.