![XeTeX,遇到希腊字符时更改字体使用(Sabon Linotype / Sabon Greek)](https://linux22.com/image/233252/XeTeX%EF%BC%8C%E9%81%87%E5%88%B0%E5%B8%8C%E8%85%8A%E5%AD%97%E7%AC%A6%E6%97%B6%E6%9B%B4%E6%94%B9%E5%AD%97%E4%BD%93%E4%BD%BF%E7%94%A8%EF%BC%88Sabon%20Linotype%20%2F%20Sabon%20Greek%EF%BC%89.png)
我很喜欢 Sabon,想继续使用它。然而,当我尝试将它与 XeTeX 一起使用时,我遇到了一些问题。
问题在于 Sabon LT 不包含完整的希腊字母,它位于单独的 Sabon 希腊字体中。因此,当我在 XeTeX 文档中将 Sabon LT 定义为标准字体时,从逻辑上讲,当我在 unicode 文档中使用它们时,不会呈现任何希腊字符。
我想直接在 unicode 文档中输入希腊字母,而不使用 mathmode 或其他任何工具。现在我可以使用例如 fontforge 将 Sabon LT 与 Sabon Greek 字体集合并;创建包含所有缺失字符的字体。但我不愿意这样做,因为我没有这方面的经验,而且我担心我可能会做错事
那么,有没有一种方便的方法可以在 XeTeX 中自动执行此操作?:切换到单独的 Sabon 希腊字体,以防它遇到任何希腊字符?在 LaTeX 中,我只需定义一个新命令,但我希望能够通过直接在 Unicode 中输入适当的字符来使用希腊字体。
非常感谢所有帮助!
答案1
简短地回答,不可以。详细地回答,你必须标记你的希腊语文本并使用适当的字体,最简单的方法是使用多语制:
\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}
答案2
我已更新我的答案。
是的,可以使用低级 XeTeX 来实现,但根据使用的软件包(polyglossia 或 xgreek),实现方式有所不同。该技术在xetex-参考第 14 页和 A. Syropoylos 的书Ψηφιακή τυπογραφία με το XeLaTeX
(希腊语)。
若要想知道简短的答案,只需查看相关Answer
部分即可。
这里使用的方法的缺点是,您不能在文本中使用多种希腊语变体(monogreek、polygreek、ancientgreek)。您必须选择一个。如果您只关心连字规则,那么我认为这并不重要。
首先,创建一个名为的文件,greektokens.tex
内容如下。它包含来自greek and coptic
和greek extended
unicode块的字符。
\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
主要案件有3起。
- 多语种,以希腊语为第二语言(主要引起非希腊人的兴趣)。
- 以希腊语为主要语言的多语种(可能最好只使用 xgreek)。
- Xgreek(用于希腊文本)。
多语种和希腊语为第二语言
只需在序言中输入以下代码,一切就可以正常工作。
\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*}}
多语种和希腊语为主要语言
在这种情况下,只能排版一种使用拉丁文字的语言。我将在以下示例中使用巴斯克语。
我更喜欢使用xgreek
而不是,polyglossia
因为它看起来更完整、更成熟。我还没有彻底测试过这个选项,所以可能会有问题。Polyglossia
已知在希腊语中存在一些轻微的错误(2011 年 6 月)。
\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
用于排版希腊语文本的包。在这种情况下,与上一个一样,只能使用一种使用拉丁文字的语言。我将再次使用巴斯克语。
\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}}
回答
以下 mwe 是对您的问题的实际回答:)
\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}
要求
如果您尝试了这三种方法中的任何一种,并且遇到了问题,请将其作为评论报告。如果一切正常,也许可以将其制作成一个软件包。