[Tex/LaTex] typeset greek letters in text mode using Latin Modern Fonts

greeklatin-modern

I use lualatex and utf8 source. I want to use the Latin Modern fonts (including math). If I include e.g. the character ε in my source file; it does not appear in the output. I've tried changing the font to TeX Gyre Pagella (with fontspec) and the ε appears as I want. I assume the Latin Modern font I'm using does not support greek characters.

Now; obviously someone has created greek glyphs for Latin Modern Math, so I'm surprised the text mode greek letters are incomplete in Latin Modern. Is there anything wrong with doing e.g.

\setmainfont{latinmodern-math.otf}

or some other hacky workaround? Is there just no way of typesetting greek characters in text mode with Latin Modern? I don't want to have to surround every greek letter with $$

(I appreciate the irony of trying to write greek letters with a font that has latin in the name, but I'm surprised the solution isn't more obvious)

MWE:

\documentclass{minimal}

\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}

\begin{document}
This text appears fine.
The following does not, only the capital omega appears: ∆πΩε.
This math does appear as expected, however: $∆πΩε$.
\end{document}

Best Answer

The Latin Modern fonts don't have the full set of Greek letters, but only some of them.

If you need only some Greek words, you can benefit from the ucharclasses package, as shown in the example. If you need longer passages in Greek, it's convenient to load Polyglossia.

\documentclass{article}

\usepackage{fontspec}
\usepackage[Latin,Greek]{ucharclasses}
\setmainfont[Ligatures=TeX]{Latin Modern Roman}

\newfontfamily{\gfsartemisia}{GFS Artemisia}
\newfontfamily{\gfsbaskerville}{GFS Baskerville}
\newfontfamily{\gfsbodoni}{GFS Bodoni}
\newfontfamily{\gfsdidot}{GFS Didot}
\newfontfamily{\cmu}{CMU Serif}

\newcommand{\greekfont}{\gfsartemisia}


\setTransitionsForLatin{}{}
\setTransitionsForGreek{\begingroup\greekfont}{\endgroup}

\begin{document}
GFS Artemisia -- This text appears fine: ΔπΩε. And again.

\renewcommand{\greekfont}{\gfsbaskerville}
GFS Baskerville -- This text appears fine: ΔπΩε. And again.

\renewcommand{\greekfont}{\gfsbodoni}
GFS Bodoni -- This text appears fine: ΔπΩε. And again.

\renewcommand{\greekfont}{\gfsdidot}
GFS Didot -- This text appears fine: ΔπΩε. And again.

\renewcommand{\greekfont}{\cmu}
CMU Serif --This text appears fine: ΔπΩε. And again.

\end{document}

After you've chosen the font that suits you (maybe experimenting with other Greek fonts), give it directly the name of \greekfont.

enter image description here