[XeTeX] Arabic XeLaTeX sample

Musa Furber musaf at runbox.com
Mon Jul 5 22:16:54 CEST 2004


First, my apologies if my message has an unnatural affection for the 
right side of your message viewer. mail.app is funny this way.

The following is a short example of using Arabic using XeLaTeX.

The Arabic formatting comments may be of interest to people using RTL 
languages with XeLaTeX.

Things work well in single column mode. Things are not so well for two 
column mode, where the left column is filled before the right.

Perhaps someone can suggest improvements.

Regards,
Musa

P.S. SubEthaEdit works well for Arabic TeX files. TextWrangler, 
unfortunately, just does not work for Arabic.

%%%% Begin file %%%%
\TeXXeTstate=1

\documentclass[12pt,a4paper]{article}

\DeclareFontFamily{U}{geeza}{}
\DeclareFontShape{U}{geeza}{m}{n}%
      {<-> "Geeza\space Pro"}{}
\renewcommand{\encodingdefault}{U}
\renewcommand{\rmdefault}{geeza}

%%%%%%%%%%%%%%%%%%%%%%
%  for Arabic formatting
%%%%%%%%%%%%%%%%%%%%%%
% make paragraphs RTL instead of LTR
\let\myeverypar\everypar
\newtoks\everypar
\everypar\expandafter{\the\myeverypar}
\myeverypar{\the\everypar\beginR}

% get rid of the paragraph indent, otherwise it will
% appear on the LEFT hand side of the page, instead
% of the right.
\parindent=0pt
\parskip=12pt
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{center}
  بسم الله الرحمن الرحيم
\end{center}
\beginR
  الْحَمْدُ لِلَّهِ  الْعَالَمِينَ  وَصَلَّى اللَّهُ  عَلَى سَيِّدِنَا مُحَمَّدٍ النَّبِيِّ  وَ  آلِهِ  وَ  صَحْبِهِ  
أَجْمَعِينَ
\end{document}



More information about the XeTeX mailing list