# Why can't my build produce certain Greek symbols?

I'm trying to use the β character in a LaTeX document, but the output PDF never shows it. I am building with xelatex. From the following code:

\documentclass{article}
\usepackage{fontspec,xltxtra,xunicode}
\usepackage{textgreek}

\title{Beta Test}
\begin{document}
\maketitle

% UTF-8 beta and \textbeta don't show in the output.
β
\textbeta

% However, UTF-8 delta and \textDelta work fine.
Δ
\textDelta

\end{document}


My output will only show the two Δ characters. So UTF-8 and textgreek seem to be fine, except for beta?

• The Latin Modern font does not support Greek symbols. See tex.stackexchange.com/q/76250 Would you be willing to use an other font? Do you really need this beta as text or could you use $\beta$? – LaRiFaRi Sep 16 '14 at 6:22
• That's a reasonable solution, but actually the β is coming from the title of a reference (in my .bib file). I really want to have my .bib file in UTF-8 as much as possible so that it remains easily portable. For example if I want to import to another ref manager I don't have to rely on that program understanding LaTeX. – drgibbon Sep 16 '14 at 17:10

The best solution is using a font that supports Greek. However, something can be done also in the case you don't have this support.

If the parts in Greek are very small and questions about hyphenation don't bother you, then no markup is necessary, which would be if longer parts are necessary; in this case using the features provided by polyglossia and defining \greekfont is sufficient, together with defining a font for Greek.

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{greek}

\newfontfamily\greekfont{GFS Artemisia}[
Scale=MatchUppercase
]

\title{Beta Test}
\begin{document}
\maketitle

Here is a \textgreek{β} beta.

\end{document}


If you just occasionally use Greek letters, a solution with ucharclasses is simpler:

\documentclass{article}
\usepackage{fontspec}
\usepackage[Latin,Greek]{ucharclasses}

\newfontfamily\greekfont{GFS Artemisia}[
Scale=MatchUppercase
]
\setTransitionsForGreek{\begingroup\greekfont}{\endgroup}

\title{Beta Test}
\begin{document}
\maketitle

Here is a β beta.

\end{document}


• Brilliant, thanks! I am using them only occasionally, so the second solution is perfect. – drgibbon Sep 16 '14 at 17:12

As the Latin Modern font does not contain Greek symbols, you will have to add them manually from another font. In my example I am taking symbols from the Linux Libertine font.

textgreek does not work, as the package fontspec redefines some things here (e.g. \textbeta).

% arara: xelatex

\documentclass{article}
\usepackage{textgreek}
\usepackage{fontspec}
\usepackage{newunicodechar}
\newfontfamily{\greekfont}{Linux Libertine O}
\newunicodechar{β}{{\greekfont β}}

\begin{document}
β

Δ
\textDelta
\end{document}


I have left out the command \textgreek. You could redefine it in order to use it with the new symbol, but as I am not sure, what fontspec is doing with this command, I would rather not touch that.

You need very little for Greek typesetting. One of the issues you have is noted above. That of needing a font with the appropriate characters in it. The SBL Cardo font has extensive Greek support, including polytonic and text critical.

You can set up your document so different fonts can be used to typeset various languages. This means you can use your favourite Roman font for English and a specialist font for Greek. See the example below.

The two key elements are \newfontfamily\greekfont{FreeSans}, which tells XeTeX to use the FreeSans font to typeset any Greek. Then in the body, \textgreek{} indicates what characters are Greek. I used a sans font for the Greek to make the distinction clear.

\documentclass{article}
\usepackage{fontspec}

\usepackage{polyglossia}

\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\greekfont{FreeSans}

\setdefaultlanguage[variant=australian]{english}
\setotherlanguage{greek}

\begin{document}
afd AFD

\textgreek{αφδ ΑΦΔ}
\end{document}


• Thanks, ended up using the ucharclasses solution above. After trying a few fonts I'm using Palatino as it seems to be produce nice looking Greek characters. – drgibbon Sep 16 '14 at 17:18