How to write (Ancient) Greek in LaTeX

Because I’m a classicist by training, I have been wanting to broach the topic of how to typeset Ancient Greek in LaTeX for a long time. So today comes a short post on the topic. There are a number of ways you can approach this but most importantly, you need to decide whether you need just any Greek letters or Ancient Greek letters. Because Ancient Greek has diacritics which aren’t featured in all (“normal”) Greek keyboards.

This blogpost covers the three sub-topics I deemed relevant to the question and they are:

  1. How do I get my Greek letters in the first place?
  2. (related to 1) How/Where do I get a Greek keyboard and which one to choose?
  3. How to typeset Greek in LaTeX?

How to get your Greek letters

If you’re just adding, say a note on the origin of a word to your text, you might not even need to install a Greek keyword at all. When I just quickly need a Greek character, I will often just copy the text from the internet (like from a Wikipedia entry where you got your info on the word origin from in the first place). If the exact word isn’t in there, you can copy it together from a number of other words. Seems weird but it works and can sometimes be faster than actually installing a Greek keyboard and learning to use it.

The only real issue with this is how to effectively launch a web-search for a Greek word without using Greek characters. But for very common stuff, it usually isn’t that difficult (most people probably don’t actually need tons of Ancient Greek in their documents, let’s be realistic). For anything else, you might need to get a little creative. If the creative process takes way too long, maybe you should try to type it out yourself after all.

I once knew how to type relatively quickly on an Ancient Greek keyboard (of course, outside of the realm of virtual keywords, you can’t see where the letters are so you have to learn their location by comparing the output on the screen with your muscle memory on which keyboard letter you pressed) but I don’t use it so much lately. Thus, it’s also easier for me to just copy the text out.

So if you’re – for example – writing a seminar paper on some Ancient Greek poem, you could, for instance, copy it out from the Perseus Digital Library or Thesaurus Linguae Graecae (TLG), thus (probably mostly) eliminating the need for you to type Greek at all. Then, only the part on typesetting Greek is still relevant for you and you might want to skip to that section rightaway.

Getting a Greek keyboard

If you’re going to be needing to type (Ancient) Greek more than the use cases discussed above, then it makes sense to install or enable the switch to a Greek keyboard on your device. I think this has actually gotten much easiert nowadays than it has been in the past / when I learned how to type Greek letters. Just click into the language settings of your device.

Greek keywords nowadays are especially convenient on touch screen devices (so your phone, tablet or even laptop if it has a touch screen) because that way you’ll have access to a virtual keyboard where you can actually see where the letters are while typing.

If that’s not an option for you, you’ll need to learn it the way I did: You bring up a visual representation of the (Ancient) Greek keyboard you are using, on (part of) your screen or maybe even as a print out. Then you start teaching your fingers where the letters (and letter combinations) you are looking for are located on this keyboard. It’s extremely cumbersome at first but gets a lot easier after some practice. I actually got really good (or good enough for the skill to have become useful) after not even that long. And you do really build up muscle memory. It’s just very likely a type of feat/skill you’ve never had to perform before, so pretty weird at first.

You might even want to use a 10 finger typing training software (such as Tipp10) where you can import an Ancient Greek text to train yourself on. I actually used this app to get faster at typing special characters needed for programming when I first got into DH (like curly braces and the like which are not located in the most conveniant of places on German keyboards). Typing fast really is a learnable skill and it doesn’t even take that much training (see my blogpost on speeding up your LaTeX typing that way).

Now is also where you’ll need to pay attention to whether you got the correct keyword. Any Greek keyword will have most letters and diacritics you need but not all of the ones you need for Ancient Greek. You thus need to procure yourself a Polytonic Greek keyboard (and that’s also the language type you will want to enable in LaTeX later).

There are also a few web keywords such as Lexilogos, that you can use – depending on what’s more convenient to you and how much Ancient Greek typing you really need to do (probably a lot less than you might initially have thought, in my personal experience, unless you’re an Ancient Greek teacher).

Typesetting (Ancient) Greek in LaTeX

You might need this as you’re typing out a PhD thesis or seminar paper using some Ancient Greek or even for XSL transformations where there are Ancient Greek characters in your TEI for which you’re trying to generate a PDF output using LaTeX. Here, you will have to carefully make sure all the Ancient Greek characters are in their appropriate environments or you might be looking at a number of error messages.

If you just need a few words, this simple approach is suggested on TeX StackExchange: Using the following package settings, \usepackage[LGR,T1]{fontenc} \usepackage[utf8]{inputenc}, you make a \newcommand{\textgreek}[1]{\begingroup\fontencoding{LGR}\selectfont#1\endgroup} which you can later invoke as \textgreek{φύσις} like so. That was easy, wasn’t it?

For longer passages, you might want to use the babel package with the polutoniko option like \usepackage[greek.polutoniko, english]{babel}, meaning that currently, English is activated (for the document at large) but you can invoke polytonic greek for some passages like \selectlanguage{greek} or just \textgreek{greek letters} like above for shorter passages (and maybe read more here).

Or maybe you prefer to just paste your Unicode source text directly into the .tex file and then compile with XeTeX or LuaLaTeX.

So, that’s it for today. I hope this helped – otherwise let me know if you have any specific questions!


PS: I also created a new ‘Digital Classics’ category for the blog, so excited about it!


Buy me coffee!

If my content has helped you, donate 3€ to buy me coffee. Thanks a lot, I appreciate it!


I like LaTeX, the Humanities and the Digital Humanities. Here I post tutorials and other adventures.

One thought on “How to write (Ancient) Greek in LaTeX

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.