Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I love Sabon, and want to keep using it. However I'm running into a few problems when trying to use it with XeTeX.

Problem is that Sabon LT does not contain the full greek alphabet, it is in a separate Sabon Greek font. So when I have defined Sabon LT as standard font in my XeTeX document, no greek characters are rendered when I use them in my unicode document, logically.

I want to use the greek alphabet by typing directly in my unicode document, without using mathmode or anything else. Now I could merge Sabon LT with the Sabon Greek fontset using for example fontforge; creating a font that contains all missing characters. But I'm reluctant to do this as I don't have any experience with this and I'm afraid I might do something wrong

So is there a convenient way to do automatically do this in XeTeX?: Swith to the separate Sabon Greek font, in case it meets any of the greek characters? In LaTeX I would just define a new command, but I want to be able to use the greek font by typing in the appropiate character in Unicode directly.

All help is appreciated!

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Short answer, No. Long answer, you have to markup your Greek text and use appropriate fonts, simplest way is using polyglossia:

\documentclass{article}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{greek}
\setmainfont{Sabon LT}
\newfontfamily\greekfont[Script=Greek]{Sabon Greek}

\begin{document}
Some english text, \textgreek{καλημέρα}.

\begin{greek}
'Ολοι οι άνθρωποι γεννιούνται ελεύθεροι και ίσοι στην αξιοπρέπεια και τα δικαιώματα.
Είναι προικισμένοι με λογική και συνείδηση,
και οφείλουν να συμπεριφέρονται μεταξύ τους με πνεύμα αδελφοσύνης.
\end{greek}
\end{document}
share|improve this answer
    
Indeed, that's a solution but I only need a few greek symbols now and then and not large parts of text... I just want to prevent using mathmode and stay in Unicode. Perhaps it's best in this case to stick to mathmode and define Sabon greek as math language. Or perhaps, copy the greek characters I need from Sabon Greek to Sabon Roman using a font editor. –  Timtico Dec 2 '10 at 2:22
    
You can use \textgreek for single letters too (eg \textgreek{α}. –  Caramdir Dec 2 '10 at 3:33
    
Indeed, you can use \textgreek for single or few letters, or even define some shorthand for it, e.g. \def\<#1>{\textgreek{#1}} if it is too much typing. –  Khaled Hosny Dec 2 '10 at 14:39
add comment

I have updated my answer.

Yes it can be done by using low-level XeTeX, but the implementation is different, according to the packages used (polyglossia or xgreek). The technique is explained in xetex-reference page 14 and in A. Syropoylos book Ψηφιακή τυπογραφία με το XeLaTeX (in greek).

For the short answer, just look at the Answer section.

The downside with the approach used here is that you can't use more than one greek variant in your text (monogreek, polygreek, ancientgreek). You have to choose one. If you care just for the hyphenation rules then I don't think it really matters.

First of all, create a file named greektokens.tex with the following contents. It contains characters from the greek and coptic and greek extended unicode blocks.

\XeTeXinterchartokenstate=1

\newXeTeXintercharclass \greekLetter

% greek and coptic glyphs
\XeTeXcharclass `\Ͱ \greekLetter
\XeTeXcharclass `\ͱ \greekLetter
\XeTeXcharclass `\Ͳ \greekLetter
\XeTeXcharclass `\ͳ \greekLetter
\XeTeXcharclass `\ʹ \greekLetter
\XeTeXcharclass `\͵ \greekLetter
\XeTeXcharclass `\Ͷ \greekLetter
\XeTeXcharclass `\ͷ \greekLetter
\XeTeXcharclass `\ͺ \greekLetter
\XeTeXcharclass `\ͻ \greekLetter
\XeTeXcharclass `\ͼ \greekLetter
\XeTeXcharclass `\ͽ \greekLetter
\XeTeXcharclass `\; \greekLetter
\XeTeXcharclass `\΄ \greekLetter
\XeTeXcharclass `\΅ \greekLetter
\XeTeXcharclass `\Ά \greekLetter
\XeTeXcharclass `\· \greekLetter
\XeTeXcharclass `\Έ \greekLetter
\XeTeXcharclass `\Ή \greekLetter
\XeTeXcharclass `\Ί \greekLetter
\XeTeXcharclass `\Ό \greekLetter
\XeTeXcharclass `\Ύ \greekLetter
\XeTeXcharclass `\Ώ \greekLetter
\XeTeXcharclass `\ΐ \greekLetter
\XeTeXcharclass `\Α \greekLetter
\XeTeXcharclass `\Β \greekLetter
\XeTeXcharclass `\Γ \greekLetter
\XeTeXcharclass `\Δ \greekLetter
\XeTeXcharclass `\Ε \greekLetter
\XeTeXcharclass `\Ζ \greekLetter
\XeTeXcharclass `\Η \greekLetter
\XeTeXcharclass `\Θ \greekLetter
\XeTeXcharclass `\Ι \greekLetter
\XeTeXcharclass `\Κ \greekLetter
\XeTeXcharclass `\Λ \greekLetter
\XeTeXcharclass `\Μ \greekLetter
\XeTeXcharclass `\Ν \greekLetter
\XeTeXcharclass `\Ξ \greekLetter
\XeTeXcharclass `\Ο \greekLetter
\XeTeXcharclass `\Π \greekLetter
\XeTeXcharclass `\Ρ \greekLetter
\XeTeXcharclass `\Σ \greekLetter
\XeTeXcharclass `\Τ \greekLetter
\XeTeXcharclass `\Υ \greekLetter
\XeTeXcharclass `\Φ \greekLetter
\XeTeXcharclass `\Χ \greekLetter
\XeTeXcharclass `\Ψ \greekLetter
\XeTeXcharclass `\Ω \greekLetter
\XeTeXcharclass `\Ϊ \greekLetter
\XeTeXcharclass `\Ϋ \greekLetter
\XeTeXcharclass `\ά \greekLetter
\XeTeXcharclass `\έ \greekLetter
\XeTeXcharclass `\ή \greekLetter
\XeTeXcharclass `\ί \greekLetter
\XeTeXcharclass `\ΰ \greekLetter
\XeTeXcharclass `\α \greekLetter
\XeTeXcharclass `\β \greekLetter
\XeTeXcharclass `\γ \greekLetter
\XeTeXcharclass `\δ \greekLetter
\XeTeXcharclass `\ε \greekLetter
\XeTeXcharclass `\ζ \greekLetter
\XeTeXcharclass `\η \greekLetter
\XeTeXcharclass `\θ \greekLetter
\XeTeXcharclass `\ι \greekLetter
\XeTeXcharclass `\κ \greekLetter
\XeTeXcharclass `\λ \greekLetter
\XeTeXcharclass `\μ \greekLetter
\XeTeXcharclass `\ν \greekLetter
\XeTeXcharclass `\ξ \greekLetter
\XeTeXcharclass `\ο \greekLetter
\XeTeXcharclass `\π \greekLetter
\XeTeXcharclass `\ρ \greekLetter
\XeTeXcharclass `\ς \greekLetter
\XeTeXcharclass `\σ \greekLetter
\XeTeXcharclass `\τ \greekLetter
\XeTeXcharclass `\υ \greekLetter
\XeTeXcharclass `\φ \greekLetter
\XeTeXcharclass `\χ \greekLetter
\XeTeXcharclass `\ψ \greekLetter
\XeTeXcharclass `\ω \greekLetter
\XeTeXcharclass `\ϊ \greekLetter
\XeTeXcharclass `\ϋ \greekLetter
\XeTeXcharclass `\ό \greekLetter
\XeTeXcharclass `\ύ \greekLetter
\XeTeXcharclass `\ώ \greekLetter
\XeTeXcharclass `\Ϗ \greekLetter
\XeTeXcharclass `\ϐ \greekLetter
\XeTeXcharclass `\ϑ \greekLetter
\XeTeXcharclass `\ϒ \greekLetter
\XeTeXcharclass `\ϓ \greekLetter
\XeTeXcharclass `\ϔ \greekLetter
\XeTeXcharclass `\ϕ \greekLetter
\XeTeXcharclass `\ϖ \greekLetter
\XeTeXcharclass `\ϗ \greekLetter
\XeTeXcharclass `\Ϙ \greekLetter
\XeTeXcharclass `\ϙ \greekLetter
\XeTeXcharclass `\Ϛ \greekLetter
\XeTeXcharclass `\ϛ \greekLetter
\XeTeXcharclass `\Ϝ \greekLetter
\XeTeXcharclass `\ϝ \greekLetter
\XeTeXcharclass `\Ϟ \greekLetter
\XeTeXcharclass `\ϟ \greekLetter
\XeTeXcharclass `\Ϡ \greekLetter
\XeTeXcharclass `\ϡ \greekLetter
\XeTeXcharclass `\Ϣ \greekLetter
\XeTeXcharclass `\ϣ \greekLetter
\XeTeXcharclass `\Ϥ \greekLetter
\XeTeXcharclass `\ϥ \greekLetter
\XeTeXcharclass `\Ϧ \greekLetter
\XeTeXcharclass `\ϧ \greekLetter
\XeTeXcharclass `\Ϩ \greekLetter
\XeTeXcharclass `\ϩ \greekLetter
\XeTeXcharclass `\Ϫ \greekLetter
\XeTeXcharclass `\ϫ \greekLetter
\XeTeXcharclass `\Ϭ \greekLetter
\XeTeXcharclass `\ϭ \greekLetter
\XeTeXcharclass `\Ϯ \greekLetter
\XeTeXcharclass `\ϯ \greekLetter
\XeTeXcharclass `\ϰ \greekLetter
\XeTeXcharclass `\ϱ \greekLetter
\XeTeXcharclass `\ϲ \greekLetter
\XeTeXcharclass `\ϳ \greekLetter
\XeTeXcharclass `\ϴ \greekLetter
\XeTeXcharclass `\ϵ \greekLetter
\XeTeXcharclass `\϶ \greekLetter
\XeTeXcharclass `\Ϸ \greekLetter
\XeTeXcharclass `\ϸ \greekLetter
\XeTeXcharclass `\Ϲ \greekLetter
\XeTeXcharclass `\Ϻ \greekLetter
\XeTeXcharclass `\ϻ \greekLetter
\XeTeXcharclass `\ϼ \greekLetter
\XeTeXcharclass `\Ͻ \greekLetter
\XeTeXcharclass `\Ͼ \greekLetter
\XeTeXcharclass `\Ͽ \greekLetter

% greek extended glyphs
\XeTeXcharclass `\ἀ \greekLetter
\XeTeXcharclass `\ἁ \greekLetter
\XeTeXcharclass `\ἂ \greekLetter
\XeTeXcharclass `\ἃ \greekLetter
\XeTeXcharclass `\ἄ \greekLetter
\XeTeXcharclass `\ἅ \greekLetter
\XeTeXcharclass `\ἆ \greekLetter
\XeTeXcharclass `\ἇ \greekLetter
\XeTeXcharclass `\Ἀ \greekLetter
\XeTeXcharclass `\Ἁ \greekLetter
\XeTeXcharclass `\Ἂ \greekLetter
\XeTeXcharclass `\Ἃ \greekLetter
\XeTeXcharclass `\Ἄ \greekLetter
\XeTeXcharclass `\Ἅ \greekLetter
\XeTeXcharclass `\Ἆ \greekLetter
\XeTeXcharclass `\Ἇ \greekLetter
\XeTeXcharclass `\ἐ \greekLetter
\XeTeXcharclass `\ἑ \greekLetter
\XeTeXcharclass `\ἒ \greekLetter
\XeTeXcharclass `\ἓ \greekLetter
\XeTeXcharclass `\ἔ \greekLetter
\XeTeXcharclass `\ἕ \greekLetter
\XeTeXcharclass `\Ἐ \greekLetter
\XeTeXcharclass `\Ἑ \greekLetter
\XeTeXcharclass `\Ἒ \greekLetter
\XeTeXcharclass `\Ἓ \greekLetter
\XeTeXcharclass `\Ἔ \greekLetter
\XeTeXcharclass `\Ἕ \greekLetter
\XeTeXcharclass `\ἠ \greekLetter
\XeTeXcharclass `\ἡ \greekLetter
\XeTeXcharclass `\ἢ \greekLetter
\XeTeXcharclass `\ἣ \greekLetter
\XeTeXcharclass `\ἤ \greekLetter
\XeTeXcharclass `\ἥ \greekLetter
\XeTeXcharclass `\ἦ \greekLetter
\XeTeXcharclass `\ἧ \greekLetter
\XeTeXcharclass `\Ἠ \greekLetter
\XeTeXcharclass `\Ἡ \greekLetter
\XeTeXcharclass `\Ἢ \greekLetter
\XeTeXcharclass `\Ἣ \greekLetter
\XeTeXcharclass `\Ἤ \greekLetter
\XeTeXcharclass `\Ἥ \greekLetter
\XeTeXcharclass `\Ἦ \greekLetter
\XeTeXcharclass `\Ἧ \greekLetter
\XeTeXcharclass `\ἰ \greekLetter
\XeTeXcharclass `\ἱ \greekLetter
\XeTeXcharclass `\ἲ \greekLetter
\XeTeXcharclass `\ἳ \greekLetter
\XeTeXcharclass `\ἴ \greekLetter
\XeTeXcharclass `\ἵ \greekLetter
\XeTeXcharclass `\ἶ \greekLetter
\XeTeXcharclass `\ἷ \greekLetter
\XeTeXcharclass `\Ἰ \greekLetter
\XeTeXcharclass `\Ἱ \greekLetter
\XeTeXcharclass `\Ἲ \greekLetter
\XeTeXcharclass `\Ἳ \greekLetter
\XeTeXcharclass `\Ἴ \greekLetter
\XeTeXcharclass `\Ἵ \greekLetter
\XeTeXcharclass `\Ἶ \greekLetter
\XeTeXcharclass `\Ἷ \greekLetter
\XeTeXcharclass `\ὀ \greekLetter
\XeTeXcharclass `\ὁ \greekLetter
\XeTeXcharclass `\ὂ \greekLetter
\XeTeXcharclass `\ὃ \greekLetter
\XeTeXcharclass `\ὄ \greekLetter
\XeTeXcharclass `\ὅ \greekLetter
\XeTeXcharclass `\Ὀ \greekLetter
\XeTeXcharclass `\Ὁ \greekLetter
\XeTeXcharclass `\Ὂ \greekLetter
\XeTeXcharclass `\Ὃ \greekLetter
\XeTeXcharclass `\Ὄ \greekLetter
\XeTeXcharclass `\Ὅ \greekLetter
\XeTeXcharclass `\ὐ \greekLetter
\XeTeXcharclass `\ὑ \greekLetter
\XeTeXcharclass `\ὒ \greekLetter
\XeTeXcharclass `\ὓ \greekLetter
\XeTeXcharclass `\ὔ \greekLetter
\XeTeXcharclass `\ὕ \greekLetter
\XeTeXcharclass `\ὖ \greekLetter
\XeTeXcharclass `\ὗ \greekLetter
\XeTeXcharclass `\Ὑ \greekLetter
\XeTeXcharclass `\Ὓ \greekLetter
\XeTeXcharclass `\Ὕ \greekLetter
\XeTeXcharclass `\Ὗ \greekLetter
\XeTeXcharclass `\ὠ \greekLetter
\XeTeXcharclass `\ὡ \greekLetter
\XeTeXcharclass `\ὢ \greekLetter
\XeTeXcharclass `\ὣ \greekLetter
\XeTeXcharclass `\ὤ \greekLetter
\XeTeXcharclass `\ὥ \greekLetter
\XeTeXcharclass `\ὦ \greekLetter
\XeTeXcharclass `\ὧ \greekLetter
\XeTeXcharclass `\Ὠ \greekLetter
\XeTeXcharclass `\Ὡ \greekLetter
\XeTeXcharclass `\Ὢ \greekLetter
\XeTeXcharclass `\Ὣ \greekLetter
\XeTeXcharclass `\Ὤ \greekLetter
\XeTeXcharclass `\Ὥ \greekLetter
\XeTeXcharclass `\Ὦ \greekLetter
\XeTeXcharclass `\Ὧ \greekLetter
\XeTeXcharclass `\ὰ \greekLetter
\XeTeXcharclass `\ά \greekLetter
\XeTeXcharclass `\ὲ \greekLetter
\XeTeXcharclass `\έ \greekLetter
\XeTeXcharclass `\ὴ \greekLetter
\XeTeXcharclass `\ή \greekLetter
\XeTeXcharclass `\ὶ \greekLetter
\XeTeXcharclass `\ί \greekLetter
\XeTeXcharclass `\ὸ \greekLetter
\XeTeXcharclass `\ό \greekLetter
\XeTeXcharclass `\ὺ \greekLetter
\XeTeXcharclass `\ύ \greekLetter
\XeTeXcharclass `\ὼ \greekLetter
\XeTeXcharclass `\ώ \greekLetter
\XeTeXcharclass `\ᾀ \greekLetter
\XeTeXcharclass `\ᾁ \greekLetter
\XeTeXcharclass `\ᾂ \greekLetter
\XeTeXcharclass `\ᾃ \greekLetter
\XeTeXcharclass `\ᾄ \greekLetter
\XeTeXcharclass `\ᾅ \greekLetter
\XeTeXcharclass `\ᾆ \greekLetter
\XeTeXcharclass `\ᾇ \greekLetter
\XeTeXcharclass `\ᾈ \greekLetter
\XeTeXcharclass `\ᾉ \greekLetter
\XeTeXcharclass `\ᾊ \greekLetter
\XeTeXcharclass `\ᾋ \greekLetter
\XeTeXcharclass `\ᾌ \greekLetter
\XeTeXcharclass `\ᾍ \greekLetter
\XeTeXcharclass `\ᾎ \greekLetter
\XeTeXcharclass `\ᾏ \greekLetter
\XeTeXcharclass `\ᾐ \greekLetter
\XeTeXcharclass `\ᾑ \greekLetter
\XeTeXcharclass `\ᾒ \greekLetter
\XeTeXcharclass `\ᾓ \greekLetter
\XeTeXcharclass `\ᾔ \greekLetter
\XeTeXcharclass `\ᾕ \greekLetter
\XeTeXcharclass `\ᾖ \greekLetter
\XeTeXcharclass `\ᾗ \greekLetter
\XeTeXcharclass `\ᾘ \greekLetter
\XeTeXcharclass `\ᾙ \greekLetter
\XeTeXcharclass `\ᾚ \greekLetter
\XeTeXcharclass `\ᾛ \greekLetter
\XeTeXcharclass `\ᾜ \greekLetter
\XeTeXcharclass `\ᾝ \greekLetter
\XeTeXcharclass `\ᾞ \greekLetter
\XeTeXcharclass `\ᾟ \greekLetter
\XeTeXcharclass `\ᾠ \greekLetter
\XeTeXcharclass `\ᾡ \greekLetter
\XeTeXcharclass `\ᾢ \greekLetter
\XeTeXcharclass `\ᾣ \greekLetter
\XeTeXcharclass `\ᾤ \greekLetter
\XeTeXcharclass `\ᾥ \greekLetter
\XeTeXcharclass `\ᾦ \greekLetter
\XeTeXcharclass `\ᾧ \greekLetter
\XeTeXcharclass `\ᾨ \greekLetter
\XeTeXcharclass `\ᾩ \greekLetter
\XeTeXcharclass `\ᾪ \greekLetter
\XeTeXcharclass `\ᾫ \greekLetter
\XeTeXcharclass `\ᾬ \greekLetter
\XeTeXcharclass `\ᾭ \greekLetter
\XeTeXcharclass `\ᾮ \greekLetter
\XeTeXcharclass `\ᾯ \greekLetter
\XeTeXcharclass `\ᾰ \greekLetter
\XeTeXcharclass `\ᾱ \greekLetter
\XeTeXcharclass `\ᾲ \greekLetter
\XeTeXcharclass `\ᾳ \greekLetter
\XeTeXcharclass `\ᾴ \greekLetter
\XeTeXcharclass `\ᾶ \greekLetter
\XeTeXcharclass `\ᾷ \greekLetter
\XeTeXcharclass `\Ᾰ \greekLetter
\XeTeXcharclass `\Ᾱ \greekLetter
\XeTeXcharclass `\Ὰ \greekLetter
\XeTeXcharclass `\Ά \greekLetter
\XeTeXcharclass `\ᾼ \greekLetter
\XeTeXcharclass `\᾽ \greekLetter
\XeTeXcharclass `\ι \greekLetter
\XeTeXcharclass `\᾿ \greekLetter
\XeTeXcharclass `\῀ \greekLetter
\XeTeXcharclass `\῁ \greekLetter
\XeTeXcharclass `\ῂ \greekLetter
\XeTeXcharclass `\ῃ \greekLetter
\XeTeXcharclass `\ῄ \greekLetter
\XeTeXcharclass `\ῆ \greekLetter
\XeTeXcharclass `\ῇ \greekLetter
\XeTeXcharclass `\Ὲ \greekLetter
\XeTeXcharclass `\Έ \greekLetter
\XeTeXcharclass `\Ὴ \greekLetter
\XeTeXcharclass `\Ή \greekLetter
\XeTeXcharclass `\ῌ \greekLetter
\XeTeXcharclass `\῍ \greekLetter
\XeTeXcharclass `\῎ \greekLetter
\XeTeXcharclass `\῏ \greekLetter
\XeTeXcharclass `\ῐ \greekLetter
\XeTeXcharclass `\ῑ \greekLetter
\XeTeXcharclass `\ῒ \greekLetter
\XeTeXcharclass `\ΐ \greekLetter
\XeTeXcharclass `\ῖ \greekLetter
\XeTeXcharclass `\ῗ \greekLetter
\XeTeXcharclass `\Ῐ \greekLetter
\XeTeXcharclass `\Ῑ \greekLetter
\XeTeXcharclass `\Ὶ \greekLetter
\XeTeXcharclass `\Ί \greekLetter
\XeTeXcharclass `\῝ \greekLetter
\XeTeXcharclass `\῞ \greekLetter
\XeTeXcharclass `\῟ \greekLetter
\XeTeXcharclass `\ῠ \greekLetter
\XeTeXcharclass `\ῡ \greekLetter
\XeTeXcharclass `\ῢ \greekLetter
\XeTeXcharclass `\ΰ \greekLetter
\XeTeXcharclass `\ῤ \greekLetter
\XeTeXcharclass `\ῥ \greekLetter
\XeTeXcharclass `\ῦ \greekLetter
\XeTeXcharclass `\ῧ \greekLetter
\XeTeXcharclass `\Ῠ \greekLetter
\XeTeXcharclass `\Ῡ \greekLetter
\XeTeXcharclass `\Ὺ \greekLetter
\XeTeXcharclass `\Ύ \greekLetter
\XeTeXcharclass `\Ῥ \greekLetter
\XeTeXcharclass `\῭ \greekLetter
\XeTeXcharclass `\΅ \greekLetter
\XeTeXcharclass `\` \greekLetter
\XeTeXcharclass `\ῲ \greekLetter
\XeTeXcharclass `\ῳ \greekLetter
\XeTeXcharclass `\ῴ \greekLetter
\XeTeXcharclass `\ῶ \greekLetter
\XeTeXcharclass `\ῷ \greekLetter
\XeTeXcharclass `\Ὸ \greekLetter
\XeTeXcharclass `\Ό \greekLetter
\XeTeXcharclass `\Ὼ \greekLetter
\XeTeXcharclass `\Ώ \greekLetter
\XeTeXcharclass `\ῼ \greekLetter
\XeTeXcharclass `\´ \greekLetter
\XeTeXcharclass `\῾ \greekLetter

There are 3 major cases.

  1. Polyglossia with greek as a secondary language (it will interest mostly non-greeks).
  2. Polyglossia with greek as a main language (it is propably better just to use xgreek).
  3. Xgreek (to be used for greek texts).

Polyglossia and greek as secondary language

Just put in your preamble the following code and everything should work out of the box.

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguages{basque,greek}

\input{greektokens.tex}

\XeTeXinterchartoks 0 \greekLetter = {\begin{otherlanguage*}{greek}}
\XeTeXinterchartoks \greekLetter 0 = {\end{otherlanguage*}}
\XeTeXinterchartoks 255 \greekLetter = {\begin{otherlanguage*}{greek}}
\XeTeXinterchartoks \greekLetter 255 = {\end{otherlanguage*}}

Polyglossia and greek as Main Language

In this case, only one language that uses the latin script can be typeset. I'll use basque for the following example.

I prefer to use xgreek rather than polyglossia as it seems to be more complete and mature. I haven't thorougly tested this option, so there might be problems. Polyglossia is known to have some slight bugs with the greek language (June 2011).

\newcommand{\secondarylanguage}{basque}

\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguages{\secondarylanguage}

\input{greektokens.tex}

\XeTeXinterchartoks 0 \greekLetter = {\selectlanguage{greek}}
\XeTeXinterchartoks 255 \greekLetter = {\selectlanguage{greek}}
\XeTeXinterchartoks 255 0 = {\selectlanguage{\secondarylanguage}}

Xgreek

The third options uses xgreek which is a package used for typesetting greek texts. In this case, as in the previous one, only one language using the latin script can be used. I will use again basque.

\newcommand{\greekvariant}{monogreek} % or polygreek or ancientgreek
\newcommand{\secondlanguage}{basque}

\usepackage[\greekvariant]{xgreek}

\input{greektokens.tex}

\XeTeXinterchartoks 0 \greekLetter = {\setlanguage{\greekvariant}}
\XeTeXinterchartoks \greekLetter 0 = {\setlanguage{\secondlanguage}}
\XeTeXinterchartoks 255 \greekLetter = {\setlanguage{\greekvariant}}
\XeTeXinterchartoks \greekLetter 255 = {\setlanguage{\secondlanguage}}

Answer

the following mwe is the actual answer to your question :)

\documentclass[12pt,draft]{article}

\usepackage{fontspec}
\setmainfont{Minion Pro}
\newfontfamily\greekfont{Kerkis}

\input{greektokens.tex}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{greek}

\XeTeXinterchartoks 0 \greekLetter = {\begin{otherlanguage*}{greek}}
\XeTeXinterchartoks \greekLetter 0 = {\end{otherlanguage*}}
\XeTeXinterchartoks 255 \greekLetter = {\begin{otherlanguage*}{greek}}
\XeTeXinterchartoks \greekLetter 255 = {\end{otherlanguage*}}

\begin{document}
Just some english text. And now some inline greek. Χωρίς ενοχλητικές δηλώσεις γλώσσας!!!
And again some english text. Continuing to show the hyphenation.
\end{document}

Request

In case you try any of the three approaches and you run into problems please report them as comments. If everything works ok, perhaps a package could be made out of it.

share|improve this answer
1  
I would use \begin{otherlanguage*}{greek} and \end{otherlanguage*} instead of \selectlanguage{greek} and \selectlanguage{english} respectively, so this works without needing to change anything for languages different from English. –  egreg Jun 18 '11 at 18:01
    
@egreg: Thank you! I've never used babel, and polyglossia's documentation doesn't mention otherlanguage* environment. I will update my answer. –  pmav99 Jun 18 '11 at 20:29
    
If Greek is the main language, you have to specify the other language in the code. I think that the approach with the \text… macros or the explicit environments is better. –  egreg Jun 18 '11 at 21:54
    
I get with xelatex the message fontspec warning: Font 'Kerkis' does not contain script 'Greek'. –  Herbert Jun 20 '11 at 14:32
    
@Herbert, I think it is safe to ignore it. Anyway I removed it from my example. Now it should be ok. –  pmav99 Jun 20 '11 at 14:57
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.