I would like my LaTeX files to contain Unicode characters. For instance, I want to see

∃x.x ⟶ β

in my text editor, rather than

\exists x\ldotp x\longrightarrow\beta

Also, I would like to type these characters directly from my keyboard. For instance, I want

  • to get "∃" by typing altE,
  • to get "β" by typing altb, and
  • to get "⟶" by typing alt-->.

I'm running Mac OS X, and my keyboard has a British layout.


1 Answer 1


There are two separate tasks here: making your keyboard produce the various Unicode symbols, and making those symbols meaningful to LaTeX.

1. Producing Unicode symbols from your keyboard

If you're on a Mac, make a .keylayout file, put it in the ~/Library/Keyboard Layouts directory, then log out and back in again. Your new keyboard layout should now appear in System Preferences > Language & Text > Input Sources.

But how does one create this keylayout? I used an editor (such as Ukelele) but also ended up doing quite a bit of tweaking by hand. Keylayouts are written in XML, following Apple's specification. My keylayout is called MathUnicode.keylayout, and can be downloaded here. It is based on the British keylayout. I have given my keylayout a custom icon by saving MathUnicode.icns(which can be downloaded here) in the same directory.

I list below all of the key bindings in my layout. Note that, for instance, alt--> (which produces ) means "type --> while holding down the alt key". Note also that I have generally avoided notating the shift key (preferring P over shiftp, and so on) except where it makes the mnemonic more memorable.

α (alpha) alta

β (beta) altb

γ (gamma) altg

Γ (Gamma) altG

δ (delta) altd

Δ (Delta) altD

ε (epsilon) alte

ζ (zeta) altz

η (eta) alth

θ (theta) alto

Θ (Theta) altO

ι (iota) alti

κ (kappa) altk

λ (lambda) altl

Λ (Lambda) altL

μ (mu) altm

ν (nu) altn

ξ (xi) altx

Ξ (Xi) altX

π (pi) altp

Π (Pi) altP

ρ (rho) altr

σ (sigma) alts

Σ (Sigma) altS

τ (tau) altt

υ (upsilon) altu

φ (phi) (altf

Φ (Phi) altF

χ (chi) altc

ψ (psi) alty

Ψ (Psi) altY

ω (omega) altw

Ω (Omega) altW

ℂ (complex numbers) altC

ℕ (naturals) altN

ℚ (rationals) altQ

ℝ (reals) altR

ℤ (integers) altZ

” (closing double quotes) alt'

“ (opening double quotes) alt`

¶ (paragraph) alt§

° (degrees) alt±

… (ellipsis) alt;

⌊ (lower left bracket) alt[

⌋ (lower right bracket) alt]

⌈ (upper left bracket) altshift[

⌉ (upper right bracket) altshift]

〈 (left angled bracket) alt<

〉(right angled bracket) alt>

⟦ (double left bracket) alt|[

⟧ (double right bracket) alt|]

↑ (up arrow) alt6

↓ (down arrow) alt7

⇑ (double up arrow) altshift6

⇓ (double down arrow) altshift7

← (left arrow) alt<-

→ (right arrow) alt->

↔ (left right arrow) alt<->

⇐ (double left arrow) alt<=

⇒ (double right arrow) alt=>

⇔ (double left right arrow) alt<=>

⟵ (long left arrow) alt<--

⟶ (long right arrow) alt-->

⟷ (long left right arrow) alt<-->

⟸ (long double left arrow) alt<==

⟹ (long double right arrow) alt==>

⟺ (long double left right arrow) alt<==>

↦ (maps-to) alt|->

⤇ (double maps-to) alt|=>

⟼ (long maps-to) alt|-->

⟾ (long double maps-to) alt|==>

⇀ (right harpoon) alt--`

⇝ (squiggly right arrow) alt~>

¬ (logical not) alt~

∨ (logical disjunction) alt\

∧ (logical conjunction) alt/\

∀ (for all) altA

∃ (exists) altE

∄ (does not exist) alt/E

.(ldotp, the dot in ∃x. p) alt,

⊦ (turnstile) alt|-

⊩ (double turnstile) alt||-

⊧ (models) alt|=

⟂ (bottom) alt _ | or alt| _

∅ (empty set) alt/0

∈ (member of) alt:

∉ (not member of) alt/:

∪ (union) altU

∩ (intersection) altI

⫛ (does not intersect) alt/I

⊂ (strict subset) alt(

⊃ (strict superset) alt)

⊆ (subset or equal) alt _ (

⊇ (superset or equal) alt _ )

∗ (centred asterisk) alt*

÷ (division) altshift/

× (times) alt8

| (bar) alt|

‖ (double bar) alt||

∤ (not bar) alt/|

◁ (left triangle) alt<|

▷ (right triangle) alt|>

◇ (diamond) alt<>

∘ (circle) alt0

· (centred dot) alt.

⊗ (circled times) alt08

⊛ (circled asterisk) alt0*

⊖ (circled minus) alt0-

⊕ (circled plus) alt0+

⊘ (circled slash) alt0/

⊙ (circled dot) alt0.

≝ (defined equal) altshift=

≠ (not equal) alt/= or alt=/

≡ (equivalent) alt==

≈ (approx) alt~~

≤ (less than or equal) alt _ < or alt< _

≥ (greater than or equal) alt _ >

∴ (therefore) altT

∵ (because) altB

∞ (infinity) alt9

∇ (nabla) altV

² (squared) altshift2

³ (cubed) altshift3

√ (root) altv

I have used this set-up for several years now, and am very happy with it. It is particularly useful when composing mathematical emails, where LaTeX is not available. The only snag I have found is that in some programs, some keyboard shortcuts that use alt no longer work. To tackle this, I configured the keyboard shortcut cmdspace so that I can switch back to my default British layout whenever necessary.

2. Getting LaTeX to understand Unicode symbols

Note: you're probably better off using XeTeX if you want Unicode in your LaTeX source files. But let's suppose you want to stick with vanilla LaTeX for the time being.

I save the following in the file MathUnicode.sty and include the MathUnicode package in all my LaTeX files (that is, by putting \usepackage{MathUnicode} in the preamble).

% Created by John Wickerson, 07 Jan 2010.
% Updated 28 Mar 2010.
% For use with the MathUnicode keyboard layout.


\newcommand{\eqdef}{\stackrel{{\scriptsize\rm def}}{=}}
\DeclareUnicodeCharacter{10214}{\llbracket} % needs stmaryrd
\DeclareUnicodeCharacter{10215}{\rrbracket} % needs stmaryrd
\DeclareUnicodeCharacter{10238}{\Longmapsto} % needs stmaryrd
\DeclareUnicodeCharacter{10503}{\Mapsto}    % needs stmaryrd
  • 3
    You could also use the newunicodechar-package, then instead of \DeclareUnicodeCharacter{951}{\ensuremath{\eta}} you can write \newunicodechar{η}{\ensuremath{\eta}}. Commented Apr 22, 2013 at 15:52
  • 1
    @ralfix Yes, that's a sensible suggestion. I tried it, though, and it seems that the newunicodechar package doesn't play well with the utf8x encoding, and my package doesn't play well without it. So I have to leave it as-is for the time being, unless somebody is able to clarify the situation... Commented May 29, 2013 at 9:46
  • @JohnWickerson, you say, I save the following in the file MathUnicode.sty and include the MathUnicode package in all my LaTeX files.. Can you please fully explain what this setup achieves. What does it do? Commented Feb 8, 2015 at 18:24
  • 1
    Thanks for the hint to use Ukelele. It makes the process surprisingly fast. It took me just about an hour to get a similar keyboard to yours based on my region specific keyboard layout. It's also a lot of fun to tweak it form time to time.
    – Lenar Hoyt
    Commented Dec 6, 2015 at 1:00
  • 1
    @mcb My vague recollection is that Ukelele had a few bugs that meant some complicated dead-key sequences came out wrongly, and needed hand-editing. Commented Dec 6, 2015 at 12:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .