[OS X TeX] [Beginner] unicode support

Bruno Voisin bvoisin at mac.com
Tue Apr 12 05:00:36 EDT 2005


Le 12 avr. 05, à 00:43, Marek Stepanek a écrit :

> Ok, thanx to all your replies ! Unfortunately nothing helps ! Some of  
> your
> hints were helpful, but my document does not 'compile' with Cyrillic
> letters, with or without Byte Order Mark (BOM). Whether I am using  
> latex or
> pdflatex with the terminal, or with TeXShop nothing helps.

OK, now, with the following input file that you provide, it is possible  
to give a more appropriate answer.

> [...]
>
> perhaps I made a silly mistake in my .tex file ? I boiled down the  
> document
> to this one, which does not 'compile' - it is saved in BBEdit utf-8  
> without
> BOM; line endings "unicode" (is this right ? I tried also with with  
> "unix").
>
> ******* einladung_test.tex***************
>
> [...]

Yes, you cannot use LaTeX as a word processor similar to Word, which is  
what you did: you cannot, generally, just input Cyrillic characters in  
your .tex file and expect the output to contain them. The fonts used  
for producing the LaTeX output are not the one used in your input file  
(Monaco). You have to make sure instead LaTeX is using a font that does  
indeed contain Cyrillic letters. And you also generally have to use  
pre-processors, or special input methods, such that your original  
Unicode input is converted to 8-bit input, which is the only input that  
LaTeX can understand.

That is, unless you use XeTeX which makes things much simpler. The  
following is einladung_test.tex, modified slightly such that it runs in  
XeTeX (simply install XeTeX and compile the file in TeXShop). The  
modifications are:

- Addition of first two lines such that TeXShop knows the file must be  
compiled by XeTeX and read as UTF-8 input.

- Commenting out the ucs and inputenc packages.

- Addition of font declarations ensuring that Lucida Grande (an OS X  
font containing the Cyrillic alphabet and having a bold version) is  
used instead of LaTeX's default (Computer Modern, aka CMR10).

- Suppression of the blank line inside \closing (\closing cannot  
contain more than one paragraph), which was causing a LaTeX error.

This is suboptimal XeTeX input, just to show that XeTeX offers a  
solution to your problem. It's certainly possible to find a better  
suited font for Cyrillic input, and the fontspec package would also  
make the font declarations much simpler. You may consider joining the  
XeTeX mailing list, where helpful people might give more specific  
instructions. Don't forget to install xunicode.sty and fontspec.sty,  
from XeTeX's Related Packages page.

Hoping that it won't scare you off, you may also have a look at  
Jonathan Kew's recent technical paper on XeTeX:

<http://scripts.sil.org/cms/scripts/render_download.php? 
site_id=nrsi&format=file&media_id=xetex_iuc27_slides&filename=a309- 
iuc27-slides.pdf> (especially p. 25)

<http://scripts.sil.org/cms/scripts/render_download.php? 
site_id=nrsi&format=file&media_id=xetex_iuc27_paper&filename=a309- 
iuc27.pdf> (especially fig. 9).

Hope this helps,

Bruno Voisin

******* einladung_test.tex***************

%&program=xelatex
%&encoding=UTF-8 Unicode

\documentclass[paper=a4]{scrlttr2}
\usepackage{ngerman}
%\usepackage{ucs}
%\usepackage[utf-8]{inputenc}
% \usepackage{graphicx}
% \usepackage[dvips]{color}
% \usepackage{fancyvrb}
% \usepackage{txfonts}

\DeclareFontFamily{U}{lucida}{}
\DeclareFontShape{U}{lucida}{m}{n}
   {<-> "Lucida\space Grande:mapping=tex-text"}{}
\DeclareFontShape{U}{lucida}{b}{n}
   {<-> "Lucida\space Grande\space Bold:mapping=tex-text"}{}
\DeclareFontShape{U}{lucida}{bx}{n}
   {<-> ssub * lucida/b/n}{}
\renewcommand{\sfdefault}{lucida}
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\encodingdefault}{U}

\begin{document}

\begin{letter}{XXX Konsulat\\
\\
}
\setkomavar{fromname}{Big Firma}
\setkomavar{fromaddress}{Big Boss

address

address

address
}
%\setkomavar{title}{}
\setkomavar{subject}{Einladung für Benefizkonzert 3. Mai 2005}
\opening{Sehr geehrte Damen und Herren,}

Wie jedes Jahr veranstaltet text text text

Eingeladen sind wieder hochbegabte junge Kinder aus der Zentral  
Musikschule
Moskau und zwei begleitende Mütter:

\textbf{XXX XXX} ,
Lehrer: Prof. Gennadiy Kerentsev
date of birth XXXXX Moscow Russia, nationality Russian Federation.
Date of issue xxxx, date of expiry xxxxxx
Authority - PУВД 645

Russia, address
Россия, 109544, Москва, площадь Рогожской Заставы



****************

\textbf{XXX XXX}  ,
date of birth XXXXX, Saratov, Russia, nationality Russian Federation.
Date of issue XXXXXX, date of expiry 16.05.2007.
Authority- УВД 767.

His adress:Russia, 127322, Moskow,Yablochkova street, house 28/1,  
apartment
2.
Его адрес: Россия, 127322,Москва, улица Яблочкова,


etc etc


\closing{Mit besten Grüßen \\ \mbox{} \\ Big Boss}
\encl{}
\end{letter}
\end{document}
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list