10

I am trying to get Unicode characters to compile into a PDF file using XeLaTeX. My MWE looks like this:

\documentclass[11pt]{article}
\begin{document}

Here is α, β, and finally γ.

\end{document}

When I compile to PDF I get

Here is , , and finally .

My Unicode characters do not show up. Could anyone point out my problem?

Andrey Vihrov
  • 22,325
dr.bunsen
  • 1,781
  • See https://tex.stackexchange.com/a/377729/250119 for more information on the "missing character in font" problem. – user202729 Sep 13 '21 at 15:47

1 Answers1

14

The default font, Computer Modern Roman, just does not have the glyphs for these Unicode characters. There are several possibilities to point out:

Math symbols

If the intended use of the characters is as shortcuts for \alpha, \beta, etc., then use the newunicodechar package:

\usepackage{newunicodechar}

\newunicodechar{α}{\alpha}
...

Internationalised typesetting

If you're looking to typeset a document (or part of a document) in the Greek language, use the polyglossia package:

\usepackage{polyglossia}

\setotherlanguage{greek}
\newfontfamily\greekfont[Script=Greek,Ligatures=TeX]{Times New Roman} % Has Greek characters

...

\begin{greek} ελληνικά \end{greek}

Random usage

If you need these characters for occasional use in the normal text, you can also use the fontspec package without polyglossia to load a font that has the glyphs. You can do it either globally (change the font altogether) or just for these characters:

\usepackage{fontspec}

\newfontfamily\timesfont[Ligatures=TeX]{Times New Roman}

...

The Greek letter alpha follows: {\timesfont α}
Andrey Vihrov
  • 22,325
  • 1
    Concerning newunicodechar, is there a package that collects a large list of existing shortcuts, especially for mathematics and the occasional foreign symbol? – Greg Graviton Apr 22 '12 at 12:53
  • 2
    @GregGraviton: I had the same question. I made a package for that available on github: https://github.com/olivierverdier/Unixode – Olivier Jun 15 '12 at 08:35