1

When we have a MWE like:

\documentclass[twoside]{book}

\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}

\begin{document}

\chapter{Титульная страница}
More text

\end{document}

we get as output:

enter image description here

this is what we expect:

  • the Russian text in Cyrillic
  • the word chapter translated to Russian and in Cyrillic
  • the text "More text" just as English in ASCII

when we have the corresponding in Greek:

\documentclass[twoside]{book}

\usepackage[greek]{babel}
\usepackage{alphabeta}                                                                                                              
\begin{document}

\chapter{Κύρια Σελίδα}                                                                                                              More text

\end{document}

we get as output:

enter image description here

this is what we expect:

  • the Greek text in Greek script
  • the word chapter translated to Greek and in Greek script

but this is not what we expect:

  • the text "More text" just as English in Greek script

I know about the possibilities of switching between languages in tex but the problem here is that we used here the text "More text" where this could work, but in real life example this can also be a code line like printf("More text\n"); or printf("Κύρια Σελίδα\n"); so here we cannot use the switching methodology especially as we don't know what the content between the double quotes is and the output is automatically generated (doxygen).

Is there a solution for this "greek" problem?

1 Answer 1

3

The Greek output encoding LGR is a bit weird with respect to other output encodings. A requirement for a T<number> encoding is that it has Latin letters in the ASCII slots for letters.

The Cyrillic encodings T2A, T2B and T2C comply. Cyrillic is split into three different encodings because it has many more characters than can fit in 256 slots; however, each one of the three encodings covers Russian and some other languages, besides satisfying the requirement above.

This is not possible for polytonic Greek: even filling up the 256 slots leaves out a few rare characters.

The font layout for Greek fonts actually predates the very concept of LaTeX output encoding and Unicode as well.

A common problem at the times when the first Greek fonts were designed was how to input them. A method was devised by the font designer, Claudio Beccari, and some experts in the Greek language: to (almost) each Latin letter there corresponds a Greek one. So from a you get an alpha, from b a beta and so on.

It might be possible to define a “real” output encoding for modern (monotonic) Greek, because the number of needed glyphs can fit the 256 limit and also satisfy the requirement for Latin letters in the ASCII positions. However, this also requires working out completely new sets of fonts, properly laid out according to this new encoding.

The job would not require creation of fonts, because one can use virtual fonts and even “mechanize” the translation. Big project anyway.


On the other hand, if you use XeLaTeX or LuaLaTeX and a main font that supports Greek, you get the expected result.

\documentclass[twoside]{book}
\usepackage{fontspec}
\usepackage[greek]{babel}

\setmainfont{Libertinus Serif}

\begin{document}

\chapter{Κύρια Σελίδα}

More text

\end{document}

enter image description here

4
  • I just tried this in my original setup, but here the word Chapter is not translated. I have to figure out what the reason is...
    – albert
    Commented Jun 9, 2020 at 14:40
  • There were a few stupid mistakes from my side (ran in batchmode so didn't see the errors and I ran pdflatex instead of xelatex), but now I'm faced with the error: "! Package fontspec Error: The font "Libertinus Serif" cannot be found." any idea how to solve (note I'm using MikTeX)?
    – albert
    Commented Jun 9, 2020 at 14:51
  • @albert You have to use a font you have in the system, or call it explicitly by file name and extension. Consult the manual of fontspec.
    – egreg
    Commented Jun 9, 2020 at 15:17
  • I've been able to install the font (a bit strange for me that MikTeX didn't install it automatically). The small test case runs without problems, but on a bigger problem I still find some warnings and empty places in the document. I have to figure out from where it comes. As reference the messages are like: "D:\Program Files\MiKTeX 2.9\tex/latex/wasysym\uwasy.fd") [1] [2] \textKappa \textepsilon \textphi \acctonos \textalpha \textlambda \textalpha \t extiota \textomicron 1. LaTeX Font Warning: Font shape TU/phv/bc/n' undefined (Font) using TU/phv/m/n' instead on input line 180.
    – albert
    Commented Jun 9, 2020 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .