29

How can I input Greek symbols using the TeX descriptions (like \beta, \alpha, \lambda, etc) in emacs?

9 Answers 9

36

Use

C-x RET C-\ TeX RET

to get TeX entry mode. Then you can use many of the standard sequences from TeX to enter things.

\alpha       α
\Gamma       Γ

as well as the whole gamut of mathematical symbols

\rightarrow  →
\Leftarrow   ⇐
\oplus       ⊕
\int         ∫
x_3          x₃
M^-^1        M⁻¹
v^x          vˣ
5
  • Fantastic! I was looking for something like this very recently too. Jun 8, 2011 at 3:18
  • alternatively use M-x set-input-method if you can't remember the keybinding
    – altschuler
    Dec 13, 2012 at 11:26
  • After I have used "C-x RET C-\ TeX RET", which works a treat, thank you, how do I return to the previous coding system, please? Everything I try from various sources in place of TeX gives "no match" Jan 20, 2013 at 19:22
  • I have found the (obvious) answer to my question "how do I return...", C-\ switches nicely between modes for both TeX and rfc1345. Jan 21, 2013 at 11:59
  • doesn't seem to get you e.g. :: Mar 9, 2015 at 12:17
17

I tend to use the RFC 1345 input mode for this.

C-x RET C-\ "rfc1345" RET

You can then turn the input mode on and off with C-\.

According to RFC 1345, Greek characters are accessed by appending the * character. Special symbols in general start with &. So you can type &a* and get α, &l* gets λ. I use RFC 1345 because it also gives me access to all sorts of other symbols, like &TE for "there exists" or &FA for "for all".

You could also use the Greek input mode, which is easier to use but doesn't give you extra symbols.

C-x RET C-\ "greek" RET

One of the advantages of these methods is that they work the same way across all platforms — as long as you're using Emacs.

1
  • If you get a helm binding conflict trying to enable rfc1345, instead use: C-u C-\ rfc1345 RET to toggle the input method. Dec 13, 2016 at 22:20
7

i always input `λ' by the following punch:

C-x 8 RET 3bb

3

You can also learn some unicode and use M-x ucs-insert, e.g. M-x ucs-insert 3BB gives you a beautiful lambda.

3

There is also the greek-babel input method which is selected (similarly to other input methods) with C-x RET C-\ greek-babel.

In this mode, the regular alphabet keys are mapped to greek characters as shown in this little table:

Αα Ββ Γγ Δδ Εε Ζζ Ηη Θθ Ιι Κκ Λλ Μμ Νν Ξξ Οο Ππ Ρρ Σσς Ττ Υυ Φφ Χχ Ψψ Ωω
Aa Bb Gg Dd Ee Zz Hh Jj Ii Kk Ll Mm Nn Xx Oo Pp Rr Ssc Tt Uu Ff Qq Yy Ww

plus some for entering sampi, digamma, stigma, koppa and various diacriticals. For a full list of the mappings done by greek-babel use C-h I greek-babel.

In ordinary usage the only somewhat weird mappings to watch out for are Θ/θ, ς, Υ/υ, Ψ/ψ and Ω/ω.

It is named so because the LaTeX package babel when loaded with the greek option enables one to type greek text with regular latin latters using the above mapping.

This input mapping is especially useful if you're writing the occasional Greek word in a (La)TeX document that you want to keep fully in UTF-8 without any ugly hacks like writing bibloc in your source instead of actual Greek βιβλος.

<Rant>
As a side note, things like C-\ are really annoying with a Danish keyboard because \ = AltGr + <, so to enter C-\ you need to hold down both Ctrl keys plus AltGr. If you hold just one Ctrl key plus AltGr plus < you just get a backslash.
</Rant>

2

I have Ubuntu set up so that I can type in Greek after pressing Shift+CapsLock — λικε τηισ — and then press Shift+CapsLock again to get back to Latin letters. Are you using Windows, MacOS, what?

Edit: You're using Ubuntu too, so: go to Start menu → System → Preferences → Keyboard → Layouts. [Add...] a layout for Greece. Select a key combination you like under [Options...] → Key(s) to switch between layouts. Personally I don't have "Separate layout for each window" set, but YMMV. Finally, I clicked [Apply System-Wide...].

(I'm using Ubuntu lucid 10.04 LTS — if you're using a newer version, the steps might be slightly different.)

0
1

Depending on your goal, e.g. which programming language you want to edit, you might want to consider using the input mode available in agda2-mode; it provides a more programming oriented alternative to TeX (but very similar);

I'm personally using it with my Haskell buffers instead of the TeX input method or the automagic but limited Haskell unicode input method.

Examples:

  • typing \:: yields
  • typing \-> yields
  • typing \br yields

Installing agda2-mode means using your package manager or Cabal to install Agda (e.g. brew install agda on OS X), then $ agda-mode compile and then:

(load-file (let ((coding-system-for-read 'utf-8))
                (shell-command-to-string "agda-mode locate")))

Optionally, to auto-enable the agda input mode for e.g. Haskell buffers:

(require 'agda-input)
(add-hook 'haskell-mode-hook
          (lambda () (set-input-method "Agda")))
1
0

You can copy paste them from the character map to the editor.

0

if you have an Apple, there is a very easy way to access all of the characters available to the "Character Viewer". In Sys Prefs -> keyboard -> input sources, select show input menu in menu bar. Bring up the character viewer and then make favorites of the N characters you need to access. Then, hit the small box to the right of char viewers search bar. The char viewer disappears, and what's left is a small window with your chosen char set. Position your cursor in your editor, click on the desired char in the favs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.