Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I input Greek symbols like \beta, \lambda in emacs?

Tags:

emacs

People also ask

How do I type Greek letters in Emacs?

It can be toggled on and off with toggle-input-method , bound to C-\ and C-< .

How do you type Greek letters?

First, select the “Greek (abc -> Ελληνικά)” keyboard from the Gboard menu on your Android device. icon in order to select the “Greek (abc -> Ελληνικά)” keyboard. Once the model downloads, you'll be ready to start using the new keyboard! You can either tap or glide type.

How do you type a lambda symbol?

Lambda uppercase and lowercase symbol codes Use the Alt + X shortcut in Word for Windows, for example type 039B then Alt + X to enter Λ.


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ˣ

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.


i always input `λ' by the following punch:

C-x 8 RET 3bb


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


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>


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.)


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);

  • Use Agda's input method in other emacs mode?
  • http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Docs.UnicodeInput

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")))