# Greek in LaTeX.

### Summary

Method latin input greek input
babel \latintext Latin \greektext Ellhnik'a
babel+inputenc \latintext Latin \greektext Ελληνικά
auto-greek Latin Ελληνικά
greektex Latin Ελληνικά
xelatex (texlive) Latin Ελληνικά
Method Preamble
babel \usepackage[english,greek]{babel}
babel+inputenc \usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
auto-greek \usepackage{auto-greek}
greektex \usepackage{greektex}

### Babel

The "standard" way of writing greek in LaTeX, is by using the babel package. You simply insert \usepackage[greek]{babel} in the preamble of your document and you are set. For example:

\documentclass{article}
\usepackage[greek]{babel}

\begin{document}
Ellhniko keimeno.
\end{document
}

Using this method, you have to write latin characters to produce the greek text. So, writing abgdezhjiklmnxoprs(c)tufqyw, you get:

and 'a a "i "i gives you:

If you want to use more than one languages, you include them as options of the babel package (the last being the main language): \usepackage[english, greek]{babel} (main language is greek, so "Contents" will appear as "Περιεχόμενα" etc). To switch between greek and latin text, you have to use the commands \latintext and \greektext. (You may also use \selectlanguage{language} instead.)

Putting all of the above together, the following code:

\documentclass{article}
\usepackage[english, greek]{babel}
\title{Titlos}
\author{Nikos Augoc}

\begin{document}
\maketitle
abgdezhjiklmnxoprs(c)tufqyw\\
'a a "i "i

\latintext Latin text
\greektext Ellhniko keimeno
\end{document
}

will give you:

### Babel + inputenc

If you do not want (as is usually the case) to write latin-text for greek, you'll have to use the inputenc package. Insert the command \usepackage[iso-8859-7]{inputenc} (or utf-8) in the preamble of your document. So this:

\documentclass{article}
\usepackage[english, greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\title{Titlos}
\author{Nikos Augoc}

\begin{document}
\maketitle
abgdezhjiklmnxoprs(c)tufqyw\\
'a a "i "i

\latintext Latin text
\greektext Ελληνικό κείμενο
\end{document
}

gives the same output as above.

### auto-greek

Assuming that you are writing a greek document (so you only need greek headings), you can avoid continuously typing \latintext, \greektext, or any other command of the kind, by using the package auto-greek. Putting \usepackage{auto-greek} in the preamble, you can write both greek and latin text directly. So,

\documentclass{article}
\usepackage{auto-greek}

\title{Τίτλος}
\author{Νίκος Αυγός}

\begin{document}
\maketitle
Ελληνικό και latin κείμενο.
\end{document
}

gives you

### XeLaTeX

Xe(La)TeX is a modern (La)Tex engine which supports unicode by default. It avoids most of the pitfalls of all the other methods (on the "fonts" front) but is not as yet as advanced in microtypography. If font problems are your main issue with LaTeX then this should be your first choise.

3 tips so far
0.1135 BTC
(avg tip 0.03783 BTC)
Like this post? Tip me with bitcoin!

1B8bUT3BkqrWjcmJpN8KG3Zo9cXMt8jtw1

{ Tags: , }

## respond

1. ### Peter

on September 28, 2010 at 06:59

I tried iso-8859-7 for inputencoding, it did not work for me (for directly typesetting Greek characters). Neither did utf8. However, it somehow works in extended utf8:

\usepackage[utf8x]{inputenc}

However, the issue is that my document contains both Greek and Arabic (by directly typesetting). And Arabic only works with utf8 but not utf8x.

Just wonder if you can advice something to solve the issue.

Sorry, I don't know about that.
Have you checked arabtex and ucs?
Have you tried XeLaTeX?

2. ### Levin

on October 4, 2010 at 00:14

Great tips! But how do we get to make the spiritus asper and spritius lenis? Do you have any idea? Thanks.

Use polutonikogreek option for babel and write ">a" for δασεία/spiritus asper and "<a" for ψιλή/spiritus lenis:

\documentclass{article}
\usepackage[english,polutonikogreek]{babel}
\begin{document}
>a <a
\end{document
}

Also note that you'll have to use utf8 encoding (like in "\usepackage[utf8]{inputenc}") if you want to type those marks in your .tex.

3. ### Dietrich

on November 28, 2010 at 13:40

Hey, thanks for that. Just one point that I missed - how to do a circumflex? Just as before (in latin) with \^[x] ? Thanks!

In babel yes, circumflex is the same.

Thank you! just another one - iota subscriptum? (sorry for bothering, but I'm not an tex-expert, to be frank). Thanks!

I think you need polutonikogreek babel option for that. Append | to the letter you want a iota subscript:

\documentclass{article}
\usepackage[english,polutonikogreek]{babel}
\begin{document}
a| h| w|
\end{document
}
4. ### Manthos

on May 12, 2011 at 13:48

Today I installed ubuntu 11.04 and texmaker. I use texmaker on my other PC's running on windows and linux mint. The following preamble:
\documentclass{11pt, article}
\usepackage[greek]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\begin{document}

\end{document}

is working fine on windows and mint however on ubuntu I get the following error:

any ideas?

5. ### Guillaume

on July 25, 2011 at 15:04

Babel+inputenc works well, but I need to insert a bit of Greek within English and it turns the entire text into Greek!
do I need auto-greek for that? Does auto-greek work with windows? Many thanks.

You have to switch-out from greek every time:

...
\usepackage[greek, english]{babel} %default english
...
\begin{document}
There are some \greektext ελληνικά\latintext in this sentence.

No you don't need auto-greek for that.
Yes auto-greek works with windows (MikTeX and TexLive) but *not* out of the box.

6. ### Victor

on October 28, 2011 at 04:41

I noticed that several people had problems getting this to work with utf-8. The best way to get it done (specially since utfx-8 gives me a lot of pain when I use Spanish) is using LGR text encoding. Here is the web site where you can get the files and some instructions.

http://milde.users.sourceforge.net/LGR/

Could you please give me a quick idea of how I can get autogreek to work in a Mac? I will be forever grateful... Well, may be not "forever" but I will be very grateful for a while 🙂

I have no idea about the Mac-TeX system, sorry 🙁

Wow! Took me a while to reply...

7. ### Bob

on February 20, 2012 at 16:30

Good stuff!
Could you publish it on ctan?

Yes, CTAN is on my to-do list. Just haven't got around to it yet :-/

8. ### Vasilhs

on February 20, 2012 at 16:52

Combining Greek and LaTeX turns out to be quite hard. Over the years, UTF-8 has become the defacto standard for encoding (http://googleblog.blogspot.com/2012/02/unicode-over-60-percent-of-web.html). In your post you mention iso-8859-7. What is the status of LaTeX and UTF-8?
Moving text around and copying from other sources means there has to be some transcoding between utf-8 and iso-8859-7 (or others) which can turn out to be very unreliable in the long run.
Converting any greek text to latin characters should not be an option, at least not for documents written mostly in greek. This extremely slows down the process of authoring and often makes the source files hard to read.
Using auto-greek is also unreliable because it is not (easily) available on any machine, which means you cannot freely share documents as you are bound by this package.
Is there some definitive guide on how to use LaTeX with UTF-8 Greek in the modern age? Or at least some work being done to get there..?
What is your opinion on XeLaTeX and the polyglossia package?

Cheers