[XeTeX] Setting greek letters in cmtt with XeTeX on OS X

Ulrike Fischer news3 at nililand.de
Mon Oct 18 14:13:24 CEST 2010


Am Mon, 18 Oct 2010 17:41:37 +1100 schrieb Rodney Polkinghorne:

> Dear list
> 
> Has anyone used lcm with XeTeX?  If so, how do you map greek letters
> in the XeTeX source to the encodings used in the lcm font files?
> 
> I'm writing a program to simulate clouds of trapped atoms.  It
> involves some complicated equations, and I'm using noweb to combine
> the mathematical derivations with the fortran code to solve them.  The
> code uses greek letters as variables, to be consistent with the
> mathematics.
> 
> I'm currently setting the text and equations in Computer Modern, and
> the code in Courier New.  That works, but it's ugly.  I'd like to set
> the code in Computer Modern Typewriter, but the sticking point is
> those greek letters.
> 
> I downloaded the Open Type lcm files, and installed them on my OS X
> box using the Font Book program.  That was easy.  Then I realised that
> lcm lacks greek letters.  I downloaded the cm-lgc fonts, which are
> supposed to include a greek version of cmtt.  However, these only come
> as Type 1 files, which Font Book refuses to touch.  I haven't figured
> out how to use them with XeTeX, either.
> 
> Am I making this harder than it needs to be?  I'm not that attached to
> Computer Modern, and maybe there are other fonts where this would
> simply work.

Well you can make the alpha, beta etc input character active and
define them so that they switch to a greek encoding like LGR (see
below, I'm using the ascii notation ^^^^03b1 instead of alpha as I
don't have an utf8 editor here). But I would advise you to find some
typewriter open type font with greek character. 


\documentclass{article}
\usepackage[LGR]{fontenc}
\usepackage{fontspec}

\catcode`\^^^^03b1=\active
\def^^^^03b1{{\fontencoding{LGR}\selectfont a}}

\begin{document}

a^^^^03b1

\ttfamily a^^^^03b1
\end{document}



-- 
Ulrike Fischer 



More information about the XeTeX mailing list