3

I am writing my master thesis and I want to write down a sentence in Greek. Some years ago I used in another project for the same situation:

\usepackage[polutonikogreek,english]{babel}

and when I had to write in Greek I was using:

\foreignlanguage{polutonikogreek}{...}

In my current project instead I have this kind of settings:

\documentclass[11pt, english, ...]

What I just tried to do then is adding the polutonikogreek to the document class. Unfortunately it didn't work. By searching online then I found people saying to add the greek.polutoniko and so it became:

\documentclass[11pt, english, greek.polutoniko, ...]

And the package is loaded. Then, in order to write the text in Greek, I should use:

\textgreek{...}

Unfortunately \textgreek{} is a call not recognized. So I moved forward and I saw some answers saying to use:

\usepackage{fontspec}

but it gives me back the error:

The fontspec package requires either XeTeX or LuaTeX.
You must change your typesetting engine to, e.g., "xelatex" or
"lualatex"instead of plain "latex" or "pdflatex".

So, at the end I wasn't able to write my sentence in Greek. Can you help me understanding how to do it please? Thanks in advance!

EDIT: This is my whole document class

\documentclass[11pt, english, singlespacing, headsepline, ]{MastersDoctoralThesis}
doncherry
  • 54,637
  • Have you used xelatex or lualatex then? –  Aug 30 '16 at 11:21
  • @ChristianHupfer no, my bad. pdflatex is in my requirements. Sorry for forgetting to write it down – Enrico Ribelli Aug 30 '16 at 11:25
  • Is pdflatex really in your requirements, or an engine which outputs a .pdf file? – Bernard Aug 30 '16 at 11:28
  • @Bernard it really is in my requirements unfortunately – Enrico Ribelli Aug 30 '16 at 11:34
  • @Alenanno that's where I learned about the "\textgreek{...}" thing, which unfortunately seems not working in my project – Enrico Ribelli Aug 30 '16 at 11:35
  • @EnricoRibelli You were adding greek.polutoniko to the document class, you should add it to the babel options. Please copy-paste the document in that answer and test it in another empty file. – Alenanno Aug 30 '16 at 11:37
  • @Alenanno that's what I did at the beginning after reading that post. but it gave me the error "Error: Option clash for package babel." so I went looking it up on google and I found out that error is because my documentclass already calls babel. The answer is in the following link and that's why I added it to the documentclass http://tex.stackexchange.com/questions/135060/getting-an-option-clash-with-babel-english-greek – Enrico Ribelli Aug 30 '16 at 11:41
  • @EnricoRibelli Then you're not using the article class? Please replace all the small code snippets in your question with a MWE (minimal working example). In this case it will be non-working, but load your document class and the sentence you want to write. – Alenanno Aug 30 '16 at 11:42
  • @Alenanno yes I am not using the article class. Edited the question with my document class. For the sentence don't worry, it's just an euforism in ancient greek. – Enrico Ribelli Aug 30 '16 at 11:50
  • I'd try \usepackage[greek.polutoniko,main=english]{babel}. Is the class available somewhere? – egreg Aug 30 '16 at 11:56
  • Instead of asking again the same question, you should point where the class is available; there's no way to answer without this information. – egreg Aug 30 '16 at 16:37

2 Answers2

4

Your custom class is already loading babel at line 155:

enter image description here

So if you load it again in your document, you get an Option Clash error. Now, a good rule of thumb is never to edit classes or packages, so to circumvent this, you can add \PassOptionsToPackage before the \documentclass is declared.

Output

enter image description here

Code

\PassOptionsToPackage{greek.polutoniko, main=english}{babel}
\documentclass[11pt, english, singlespacing, headsepline]{MastersDoctoralThesis}
\usepackage[utf8]{inputenc}

\begin{document}
Cosmos in Greek is \textgreek{Κόσμος}
\end{document}
Alenanno
  • 37,338
  • Sometimes you don't have a choice but to edit the class or package, though. I have encountered a journal style file that redefines \p@ (among other cardinal sins...) – zwol Aug 30 '16 at 17:51
  • @zwol If the license of the class allows you to change it, you are free to do so. If a journal class redefines stuff, they have a pretty good reason. I wouldn't touch it. They won't care about your changes. – Johannes_B Sep 03 '16 at 12:16
  • @Johannes_B You maybe don't realize how disastrous redefining things in the guts of LaTeX can be... – zwol Sep 03 '16 at 19:06
  • @zwol I surely do. And i know, i can't simply change lines of The Lord of the Rings, and say it is the same. There are issues. – Johannes_B Sep 03 '16 at 19:55
  • @Johannes_B In the not-at-all-hypothetical situation with the journal style file that redefined \p@, what I did was fix it (with each change from the original clearly marked) and then put a README in with the sources to warn them that the document won't compile if they put back their version. And we'll see what happens. :-/ – zwol Sep 03 '16 at 20:06
  • @zwol See, you did everything right. You helped them. :-) – Johannes_B Sep 03 '16 at 20:23
3

For a single sentence in Greek you don't need to load babel-greek. If you are using UTF-8 as the file encoding you can use the first way; otherwise use the transliteration below.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{textgreek}

\begin{document}

{\textgreekfont Πάτερ ἡμῶν ὁ ἐν τοῖς οὐρανοῖς}

{\textgreekfont\catcode`~=12 P'ater <hm~wn <o >en to~is o>urano~is}

\end{document}

enter image description here

egreg
  • 1,121,712