# xelatex: Greek Typesetting with FreeSerif with OmegaSerif features

Back in the days of plain TeX, when Omega was the default/only way to write Greek in TeX, the default font was OmegaSerif. For Greek typesetting it had the following extra (neat) features:

1. When in beginning of a word, beta would be the normal β, but when mid-words beta would automatically transform into ϐ.

2. In a word phi, would be ϕ and not φ. (text: {phisymbol vs phi}, or math: {phi vs varphi})

Now, its successor, FreeSerif, from GNU FreeFont Project has the same glyphs, but not these 2 features from OmegaSerif.

Can I somehow play with FreeSerif to achieve these features or is there, somewhere, OmegaSerif for LaTeX?

Following pictures depict these 2 features.

## 1 Answer

\documentclass{article}

\usepackage{fontspec}
\setmainfont{FreeSerif.otf}

% turn on xetex character class feature
\XeTeXinterchartokenstate=1

% character class for beta
\newXeTeXintercharclass\myc

% assign beta to the class
\XeTeXcharclassβ=\myc

% specify that \swapbeta should be inserted between any
% normal character (class zero) and a beta (class \mych)
\XeTeXinterchartoks 0 \myc{\swapbeta}

% define \swapbeta to swallow a β and expand to ϐ
\def\swapbeta β{ϐ}

% To do the same for phi just define a new class and a new \swapphi
% command and set up a substitution for that.

% testing...
\begin{document}

abc βέβα

\end{document}
`
• Thank you! But what about the φ vs ϕ thing? – ɪdɪət strəʊlə Oct 7 '16 at 18:12
• Also, could you elaborate on your macros, for learning purposes? – ɪdɪət strəʊlə Oct 7 '16 at 18:14
• @st.vit you just do exactly the same but with those two characters instead of the betas. I'll add some comments to the code – David Carlisle Oct 7 '16 at 19:27
• @st.vit comments added – David Carlisle Oct 7 '16 at 19:32