[XeTeX] refusal to typeset and strange behaviour

Jonathan Kew jonathan_kew at sil.org
Wed May 10 20:40:56 CEST 2006

On 10 May 2006, at 6:23 pm, Alex Hamann wrote:

> I am working on a paper that is saved in Utf-8 format with this  
> preamble

Several things I notice here....

> \documentclass[12pt, oneside]{article}
> \pagestyle{plain}
> \usepackage{setspace}
> \usepackage[applemac]{inputenc}

(1) If your file is in Unicode (UTF-8), then [applemac]{inputenc} is  
inappropriate. "applemac" refers to the 8-bit MacRoman encoding,  
which is not what you say you're using. (In general, for Unicode and  
XeLaTeX you shouldn't need to use inputenc stuff at all, I  
believe.... just let xetex process the Unicode directly.)

> \usepackage[left=25mm,top=25mm,bottom=2cm,right=25mm]{geometry}
> \usepackage[marginal]{footmisc}
> \usepackage{fontspec}
> \newfontinstance\fonta{Gentium}
> %\newcommand\basetext{\fonta\fontsize{12}{14}\selectfont}
> \setromanfont[Scale=1.01]{Gentium}
> \usepackage{ucs}

(2) I don't know what the {ucs} package does, but I would guess that  
it's unnecessary and possibly harmful when used in conjunction with  
xelatex, Unicode text, and Unicode fonts.

> \usepackage{sectsty}
> \usepackage{url}
> \usepackage[sort&compress]{natbib}
> \bibpunct{(}{)}{,}{a}{:}{,}
> \bibliographystyle{plainnat}
> \citestyle{}
> \begin{document}
> the text contains Greek letters. When I include Greek fonts they  
> are properly displayed and typset. However, as soon as I save,  
> close, and re-open the file, the Greek fonts are relpaced by  
> apparently random symbols (or maybe it is the unicode fonts in  
> another encoding? lokks like this:  γεη σψηον  ).

(3) This sounds like your editor (TeXShop?) is interpreting the file  
as a non-Unicode encoding, probably MacRoman, so the bytes that  
should compose a single UTF-8 character are being displayed as  
separate codes.

If you're using TeXShop, you can put the special comment line

	%!TEX encoding = UTF-8 Unicode

at the beginning of the file, to tell it which encoding to use; and/ 
or you can set the default document encoding in the Preferences dialog.


More information about the XeTeX mailing list