\documentclass[a4paper]{article} % \usepackage{textcomp} \usepackage[colorlinks=true,linkcolor=blue]{hyperref} \usepackage{bookmark} \usepackage{parskip} \usepackage[tuenc]{fontspec} \setmainfont{Linux Libertine O} \setsansfont{Linux Biolinum O} % \setmainfont{DejaVu Serif} % \setmainfont{Droid Serif} % only monotonic Greek (subset of Greek and Coptic) \usepackage[greek,english]{babel} % \languageattribute{greek}{polutoniko} \languageattribute{greek}{ancient} \message{greek-euenc ist} \makeatletter \@ifl@aded{def}{greek-fontenc}{\message{geladen}}{\message{nicht geladen}} \makeatother \begin{document} \title{Greek support for Babel with XeTeX/LuaTeX} \author{Günter Milde} \date{2016/09/07} \maketitle The babel option «greek» activates the support for the Greek language defined in the file «greek.ldf» (source «greek.dtx»). Typesetting Greek texts requires a font containing Greek letters. With the XeTeX or LuaTeX engines, the user must ensure that the selected font contains the required glyphs (the default Latin Modern fonts miss most of them). Examples for suitable fonts are the «Deja Vu», «Linux Libertine», or «Free Serif» OpenType fonts. \section{Language Switch} The declaration \verb|\selectlanguage| switches between languages. \begin{quote} \selectlanguage{greek} Τί φήις; Ἱδὼν ἐνθέδε παῖδ’ ἐλευθέραν τὰς πλησίον Νύμφας στεφανοῦσαν, Σώστρατε, ἐρῶν άπῆλθες εὐθύς; \end{quote} The command \verb|\foreignlanguage| sets its second argument in the language specified as first argument. This is intended for short text parts like \foreignlanguage{greek}{Βιβλιοθήκη}. \section{Font Encoding} Every language switch to \texttt{greek} calls the \verb|\extrasgreek| command which in turn calls \verb|\greekscript| to ensure a Greek-supporting font encoding (LGR, TU, EU1, or EU2). Under Xe/LuaTeX the font encoding normally just remains Unicode (TU). For customization, you can add to or redefine the \verb|\extrasgreek| command. The LGR font encoding does not support Latin characters. Therefore, the Babel core defines the declaration \verb|\latintext| and the command \verb|\textlatin| to switch to the TU, EU1, EU2, T1 or OT1 font encoding or typeset the argument using this encoding. At this point, the «latinencoding» is \latinencoding. Every language switch from \texttt{greek} calls the \verb|\noextrasgreek| command which in turn calls \verb|\latintext|.\\ For customization, you can add to or redefine the \verb|\noextrasgreek| command. With the Unicode font encoding TU, EU1, or EU2, Latin characters can be used in Greek text parts and input via the «LGR Latin transcription» is not possible.% \footnote{% The \emph{xunicode} package provides with the \texttt{tipa} emulation an example how this could be achieved also for Unicode fonts. Alternatively, LGR encoded fonts can be used (see test-unicode-lgr.tex). } \begin{quote} \greekscript Φίλων τοῦ \textlatin{TeX} (ΕΦΤ) -- \latintext Friends (\ensuregreek{F\'ilwn}) of TeX.% \footnote{Compare the printout to the similar example in test-greek.pdf.} \end{quote} \section{LICR Macros} Babel defines macros for several autogenerated strings so that they may appear in the choosen language. \emph{babel-greek} uses LICR% \footnote{LaTeX internal character representation} macros in order to let the string macros work independent of the font encoding. If \emph{fontspec} is loaded, \emph{babel-greek} loads Greek LICR definitions for the Unicode font encoding (TU, EU1 or EU2) from the file \texttt{greek-euenc.def} provided with \href{http://www.ctan.org/pkg/greek-fontenc}{greek-fontenc} since version~0.10. With this setup, it is also possible to use accent macros instead of pre-composed Unicode characters for letters with diacritics: «Τ\'ι φ\'ηις;», «\`<ορα = \accdasiavaria{ο}ρα». \subsection{Captions} \selectlanguage{greek} \prefacename, \refname, \abstractname, \bibname, \chaptername, \appendixname, \contentsname, \listfigurename , \listtablename, \indexname, \figurename, \tablename, \partname, \enclname, \ccname, \headtoname, \pagename, \seename, \alsoname, \proofname, \glossaryname \selectlanguage{english} Test correct upcasing (dropping of accents): \selectlanguage{greek} \MakeUppercase{ \prefacename, \refname, \abstractname, \bibname, \chaptername, \appendixname, \contentsname, \listfigurename, \listtablename, \indexname, \figurename, \tablename, \partname, \enclname, \ccname, \headtoname, \pagename, \seename, \alsoname, \proofname, \glossaryname } \selectlanguage{english} \subsection{Months} \selectlanguage{greek} \newcounter{foo} \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \stepcounter{foo} \month=\value{foo} \today \\ \selectlanguage{english} \section{Greek Numerals} See greek.pdf for the formation rules of Greek numerals. Some examples: \selectlanguage{greek} \greeknumeral{1}, \greeknumeral{2}, \greeknumeral{3}, \greeknumeral{4}, \greeknumeral{5}, \greeknumeral{6}, \greeknumeral{7}, \greeknumeral{8}, \greeknumeral{9}, \greeknumeral{10}, \greeknumeral{11}, \greeknumeral{12}, \greeknumeral{20}, \greeknumeral{345}, \greeknumeral{500}, \greeknumeral{1997}, \greeknumeral{2013}, \Greeknumeral{1}, \Greeknumeral{2}, \Greeknumeral{3}, \Greeknumeral{4}, \Greeknumeral{5}, \Greeknumeral{6}, \Greeknumeral{7}, \Greeknumeral{8}, \Greeknumeral{9}, \Greeknumeral{10}, \Greeknumeral{11}, \Greeknumeral{12}, \Greeknumeral{20}, \Greeknumeral{345}, \Greeknumeral{500}, \Greeknumeral{1997}, \Greeknumeral{2013}, Enumerated lists use Greek characters/numerals in the second and fourth level: \selectlanguage{greek} \begin{enumerate} \item item 1 \begin{enumerate} \item item 1.1 \begin{enumerate} \item item 1.1.1 \begin{enumerate} \item item 1.1.1.1 \item item 1.1.1.2 \end{enumerate} \item item 1.1.2 \end{enumerate} \end{enumerate} \end{enumerate} \selectlanguage{english} This may be problematic with fonts that only partially support Greek and miss the numeral signs (dexiakeraia and aristerikeraia). You may redefine the commands \verb+\textdexiakeraia+ and \verb+\textaristerikeraia+ to some substitute characters. Or, if you prefer the ``normal'' enumeration, write in the preamble after loading babel: \begin{verbatim} \makeatletter \addto\extrasgreek{\let\@alph\latin@alph \let\@Alph\latin@Alph} \makeatother \end{verbatim} \end{document}