Using MiKTeX for Greek

Here you can discuss all things Ancient Greek. Use this board to ask questions about grammar, discuss learning strategies, get help with a difficult passage of Greek, and more.
Post Reply
User avatar
jaihare
Textkit Zealot
Posts: 959
Joined: Mon Oct 22, 2007 2:47 am
Location: Tel Aviv, Israel
Contact:

Using MiKTeX for Greek

Post by jaihare »

I wonder if someone can give me some pointers about how to type Greek using MiKTeX/LaTeX. I'm reinstalling MiKTeX 2.8 now to prepare for it. Here are my questions:

1. What editing program (environment) do you use that supports Unicode?

2. How do I set it up to produce Greek characters? Is there something separate I can do to use it with Hebrew also?

3. How do I alter the font?

Is there possibly a good online resource for non-Unix users (I'm running Windows 7) who want to learn to use it without all of the complication that it can naturally produce? Isn't it supposed to be user-friendly?!

Thanks,
Jason

edonnelly
Administrator
Posts: 989
Joined: Sun Jan 16, 2005 2:47 am
Location: Music City, USA
Contact:

Re: Using MiKTeX for Greek

Post by edonnelly »

I am by no means a LaTex expert (and there are some here, such as Will, who are) but I do routinely use MikTex on Windows and I love the results, so I'll try to tell you what works for me.

For an editor, I use Texmaker (http://www.xm1math.net/texmaker/) which has always worked great for me. I'm sure there are all kinds of discussions floating around the internet about which is the best, but this one seems to handle unicode very well and has never given me any problems.

The key, at least for me, to getting it to work was to add the command for xelatex (the version of latex that handles unicode well). To set this up, I go to the menu option "User" and then choose " For "Command 1" I give it the name "XeTex" and put in this command:

Code: Select all

xelatex -interaction=nonstopmode %.tex
Once this has been set, exit then restart texmaker. Then, along the top row where the buttons are, there is one that defaults to something like "Quick build." I click on the little down arrowhead and change it to 1: XeTex from the drop-down menu. At this point, any xetex file will compile fine for me and generate a pdf file simply by pressing the arrow button just to the left of the "1: XeTex" text. Usually the first time I do this on a computer, there will be a bunch of packages that get installed. Here's a simple xetex file that illustrates how I change fonts:

Code: Select all

\documentclass{article}
\usepackage{fontspec} 
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{KadmosU}
\begin{document}
\section{Unicode}
 
\subsection{Kadmos}

ὁ Βορέας ποτὲ καὶ ὁ ἥλιος ἤριζον ὁπότερός ἐστι κρείσσων. ἰδὼν δὲ ἄνθρωπον ἱμάτιον ἔχοντα, ἔ-θη ὁ ἥλιος.
“τί μάτηρ διαλεγόμεθα; ὁρᾷς δήπου ἐκεῖνον τὸν ἄνδρα· ὁποτερος ἂν οὖν ἡμῶν δύνηται ἀποδῦσαι τὸ ἱμάτιον τοῦ ἀνθρώπου,
οὖτος νικάτω.” ὁ δὲ ἕτερος ἐπὶ τούτοις ὡμολόγησε. πρῶτον μὲν οὖν πεῖραν ἐποιεῖτο ὁ Βορέας. καὶ παντὶ μὲν τῷ σθένει ἔ-πνευσε,
ὁ δὲ ἀνὴρ πολὺ μᾶλλον ἑαυτὸν τῷ ἱματίῳ ἐ-κάλυπτε. παυσαμένου δὲ τοῦ Βορέου, ὁ ἥλιος ἐξ-ῆλθεν. ὁ δὲ ἀνήρ, θερμὸς γενόμενος, τὸ
ἱμάτιον ἀπ-έ-ρριψε.
 
 
 \font\1="Gentium" at 12pt
\subsection{Gentium}
 
\1
ὁ Βορέας ποτὲ καὶ ὁ ἥλιος ἤριζον ὁπότερός ἐστι κρείσσων. ἰδὼν δὲ ἄνθρωπον ἱμάτιον ἔχοντα, ἔ-θη ὁ ἥλιος.
“τί μάτηρ διαλεγόμεθα; ὁρᾷς δήπου ἐκεῖνον τὸν ἄνδρα· ὁποτερος ἂν οὖν ἡμῶν δύνηται ἀποδῦσαι τὸ ἱμάτιον τοῦ ἀνθρώπου,
οὖτος νικάτω.” ὁ δὲ ἕτερος ἐπὶ τούτοις ὡμολόγησε. πρῶτον μὲν οὖν πεῖραν ἐποιεῖτο ὁ Βορέας. καὶ παντὶ μὲν τῷ σθένει ἔ-πνευσε,
ὁ δὲ ἀνὴρ πολὺ μᾶλλον ἑαυτὸν τῷ ἱματίῳ ἐ-κάλυπτε. παυσαμένου δὲ τοῦ Βορέου, ὁ ἥλιος ἐξ-ῆλθεν. ὁ δὲ ἀνήρ, θερμὸς γενόμενος, τὸ
ἱμάτιον ἀπ-έ-ρριψε.

\end{document}
(for this to work, your computer would have to have both Gentium and KadmosU fonts installed (both are free out on the internet) but obviously you could replace them with whatever fonts you choose. What I did in this file is make KadmosU the default font for the document (up near the beginning of the document) so the first paragraph is done in this font. Then I switch to the Gentium font with the \1 business.

Anyway, I certainly don't know the finer points of all of this stuff, but this technique has served me well and generates beautiful pdf files. I'm sure there are other slicker ways to do all this stuff, and maybe someone else will chime in, but at least this is a start.

As an aside, a ton of things online tell you to install all kinds of other stuff, but all I ever need to install are MikTex and Texmaker. Those two alone take care of everything, and Texmaker has always been smart enough to figure out where MikTek is. Good luck and I hope all this works for you. If you have trouble, I'll try to help.
The lists:
G'Oogle and the Internet Pharrchive - 1100 or so free Latin and Greek books.
DownLOEBables - Free books from the Loeb Classical Library

User avatar
jaihare
Textkit Zealot
Posts: 959
Joined: Mon Oct 22, 2007 2:47 am
Location: Tel Aviv, Israel
Contact:

Re: Using MiKTeX for Greek

Post by jaihare »

Thanks a lot!

Tell me, do I have to download the packages in order for the system to pick them up? If so, where should I place them? TeX is hard to use for someone who isn't Linux-minded.

I'll check out these things this weekend. I'll be working straight through until tomorrow afternoon, so I won't be online much tonight. :(

Thanks again!

edonnelly
Administrator
Posts: 989
Joined: Sun Jan 16, 2005 2:47 am
Location: Music City, USA
Contact:

Re: Using MiKTeX for Greek

Post by edonnelly »

I just install MikTex, whenever it needs a package it goes and finds it itself. When I first got MikTex I was very confused about what I had to do and what I had to configure, but now I realize that I don't have to do or configure anything to make it work for me. Recently my computer got destroyed and I had to completely reinstall everything. I installed MikTex but have never changed a single setting or configuration and have never manually downloaded anything. The first time it encounters a package referenced in a .tex file, it will pop up a little box asking me if it should go download it, to which I always answer yes. I've never had a problem.

Honestly, all the documentation for this stuff seems incredibly and unnecessarily complicated. And all those package depositories still confuse me, but fortunately the software seems to know what it's doing. Maybe I'm too trusting, but with my new install I have never had to manually download any package, which is good because I never could figure out where I was supposed to put them if I did.

EDIT: And I should add that I've never needed anything like Ghostsript or Ghostview and I've never had to deal a .ps file and I've never had to do anything like "distill" a file. I just edit my .tex file, hit the button, and get a .pdf file in my directory.
The lists:
G'Oogle and the Internet Pharrchive - 1100 or so free Latin and Greek books.
DownLOEBables - Free books from the Loeb Classical Library

Rothbardian
Textkit Neophyte
Posts: 9
Joined: Fri May 15, 2009 4:53 am

Re: Using MiKTeX for Greek

Post by Rothbardian »

edonnelly wrote:Here's a simple xetex file that illustrates how I change fonts:

Code: Select all

\documentclass{article}
\usepackage{fontspec} 
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{KadmosU}
\begin{document}
...
\end{document}
Do this instead:

Code: Select all

\documentclass{article}
\usepackage{xltxtra}  % includes fontspec and xunicode; no need for separate lines
\usepackage{polyglossia}
\setmainfont{KadmosU}
\setmainlanguage[variant=ancient]{greek}

...
\end{document}
Also, use

Code: Select all

\newfontfamily\gentium{Gentium}  % GentiumAlt is better!
to make \gentium (\1 is not a good name) your font-switching command (and it'll cope with bold, italics, size changes, etc., which your \1 won't)

Rothbardian
Textkit Neophyte
Posts: 9
Joined: Fri May 15, 2009 4:53 am

Re: Using MiKTeX for Greek

Post by Rothbardian »

jaihare wrote:1. What editing program (environment) do you use that supports Unicode?
What's an "editing program"? Are you suggesting there's something other than Emacs? When did that happen? :D

Post Reply