[Tex/LaTex] Greek Letters in Text (not math mode)

greek

I need to include a single Greek word in my document and the preferred font has, as they say, no Greek. Package {textgreek} to the rescue? Maybe not.
Here's a MWE:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt]{article}
\usepackage{geometry}                
\geometry{letterpaper}                  
\usepackage[euler]{textgreek}

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}

\begin{document}

Here is some text. 
There should be a greek word \texttau\textrho\textepsilon\textiota\textvarsigma here. 

Let’s see if unicode compiles:

τρείς



\end{document}   

Does anyone have any idea what I'm doing wrong? The textgreek package is supposed to have its own fonts. The documentation says that if you're using anything other than CM or LM you "may" (!!) have to modify font tables, but doesn't say how.

(I'm guessing the Unicode Greek word won't display properly since Hoefler Text has no Greek support.

Best Answer

Load neither xunicode nor xltxtra.

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{greek}

\setmainfont{Hoefler Text}
\setsansfont{Gill Sans}[
  Scale=MatchLowercase,
]
\setmonofont{Andale Mono}[
  Scale=MatchLowercase,
]

\newfontfamily{\greekfont}{GFSDidot}[
  Extension=.otf,
  UprightFont=*,
  ItalicFont=*Italic,
  BoldFont=*Bold,
  BoldItalicFont=*BoldItalic,
  Scale=MatchLowercase,
]

\begin{document}

Here is some text.
There should be a greek word \textgreek{τρείς}

\end{document}

Instead of GFS Didot, you can use whatever font supporting Greek you prefer.

enter image description here

If you have just a few Greek words, it makes sense to use ucharclasses.

\documentclass{article}

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

\setmainfont{Hoefler Text}
\setsansfont{Gill Sans}[
  Scale=MatchLowercase,
]
\setmonofont{Andale Mono}[
  Scale=MatchLowercase,
]

\newfontfamily{\greekfont}{GFSDidot}[
  Extension=.otf,
  UprightFont=*,
  ItalicFont=*Italic,
  BoldFont=*Bold,
  BoldItalicFont=*BoldItalic,
  Scale=MatchLowercase,
]

\setTransitionsForGreek{\begingroup\greekfont}{\endgroup}

\begin{document}

Here is some text.
There should be a greek word τρείς

\end{document}