# Specifying a different font for polytonic Greek in pdfTeX with Babel

I am writing my master’s thesis with the ulthese class, which is now part of MiKTeX and TeX Live. This class is based on memoir and is fairly flexible, but assumes the use of pdfTeX and sets the font encoding to T1. Furthermore, the University requires the use of Computer Modern/Latin Modern or a standard PostScript font (e.g. Times or Palatino).

My thesis is primarily in French, with citations in English and polytonic Greek. With inputenc’s utf8 option, the babel package, and the textalpha package from the lgrx bundle my bases seem to be covered.

I have decided to use Palatino as the main text font (with the mathpazo package) and, because this font family does not cover extended greek, the CB Greek fonts are automatically used instead in babel’s \textgreek commands and {otherlanguage}{polutonikogreek} environments. I have no problem with CB Greek in itself, but it does not blend optimally with Palatino and I would like to use another font’s extended Greek characters. I know that the Type 1 version of Libertine has polytonic Greek (I have checked the .pfb files in FontForge), but I do not know how to use Libertine’s glyphs in the appropriate environments. In fact, I have made a test in which I only used Libertine throughout the document instead of Palatino/Mathpazo, but still Libertine’s Greek was not used and the CB fonts were substituted.

My question is: how can I automatically switch to another font inside babel’s commands and environments on a per-language basis? I am looking for something similar to polyglossia’s \newfontfamily\greekfont[Script=Greek,⟨...⟩]{⟨font⟩}. I know that the lgrx bundle offers a substitutefont package, but I am not sure whether that is what I need, as I do not yet understand what the package does exactly. If there is no “high-level” solution, will I have to use LaTeX’s font-related commands?

If there is no readily available method to use Libertine’s extended Greek, I could be content with Kerkis, which is already set up for automatic use and has many niceties, but I would be very happy if I could use Libertine. What is more, even if I were to use Kerkis for Greek text I would still need to (and want to) use Palatino for the main text, so the switch to Kerkis would have to be confined to Greek environments and commands.

Here follows a minimal working example compiled with a fully updated MacTeX 2012 on OS X 10.8, with pdfTeX. Some commands and options in the preamble are specific to ulthese and I include them to show the complete use case (for example, I use ulthese’s specific hypperef color setup and I use hyperref’s unicode option in order to get polytonic Greek text to display correctly in PDF bookmarks).

\documentclass[12pt,nonatbib,english,polutonikogreek,francais]{ulthese}
\usepackage[utf8]{inputenc}
\usepackage{textalpha}
\usepackage[osf]{mathpazo}
\usepackage{microtype}
\chapterstyle{southall}
\usepackage[unicode]{hyperref}
\frenchbsetup{%
CompactItemize=false,
ThinSpaceInFrenchNumbers=true
}
\titre{Un mémoire sur la philosophie grecque}
\auteur{Un étudiant en philosophie}
\programme{Maîtrise en Philosophie}
\annee{9999}
\MA
\begin{document}

\chapter{Introduction à la \textgreek{φύσις} et autres}

Pour les Grecs, la \textgreek{φύσις} a plusieurs sens.
D’ailleurs, c’est le cas de plusieurs mots.

\begin{otherlanguage}{polutonikogreek}
σύμψηφός σοί εἰμι, ἔφη, τούτου τοῦ νόμου, καί μοι ἀρέσκει.
\end{otherlanguage}

\end{document}
-

You can try the Artemisia font of the Greek Font Society:

\documentclass[12pt,nonatbib,english,polutonikogreek,francais]{ulthese}

\usepackage[utf8]{inputenc}

\usepackage{textalpha}
\usepackage[osf]{mathpazo}
\usepackage{microtype}
\chapterstyle{southall}

\usepackage[unicode]{hyperref}
\frenchbsetup{%
CompactItemize=false,
ThinSpaceInFrenchNumbers=true
}

%%% Patch \greektext to use Artemisia
\usepackage{xpatch}
\xpatchcmd{\greektext}
{\selectfont}
{\fontfamily{artemisia}\selectfont}
{}{}

\titre{Un mémoire sur la philosophie grecque}
\auteur{Un étudiant en philosophie}
\programme{Maîtrise en Philosophie}
\annee{9999}
\MA

\begin{document}

\chapter{Introduction à la \textgreek{φύσις} et autres}

Pour les Grecs, la \textgreek{φύσις} a plusieurs sens.
D’ailleurs, c’est le cas de plusieurs mots.

\begin{otherlanguage}{polutonikogreek}
σύμψηφός σοί εἰμι, ἔφη, τούτου τοῦ νόμου, καί μοι ἀρέσκει.
\end{otherlanguage}

\end{document}

-
Beautiful! This is even better than Libertine because it has accented greek small caps, and the latin letters look nice too. I have yet to understand how xpatch works, so for now this looks like sorcery to me, but I appreciate the efficiency of this solution. – Christian Gagné Apr 4 '13 at 14:39
However, I just read in the documentation of xpatch and regexpatch that eventually the latter will replace the former and that this might break existing code: if and when that happens, what should one know in order to repatch correctly? Also, is it possible to renew the \greektext command with \renewcommand instead of patching it with an etoolbox-style command? – Christian Gagné Apr 4 '13 at 14:56
@ChristianGagné The latter package is under development; currently, the only common problem might be the need to add \makeatletter and \makeatother around the patching command; I hope to be able to get rid of this before the big change (which is not near in time, by the way). – egreg Apr 4 '13 at 16:31