Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using TeXlive (2009-7) on Ubuntu 10.04. I've installed texlive-lang-arabic and I can't find out how should I compose the preamble to be able to use it. The babel's documentation I've found in the Internet http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/babel/ is probably out-of-date (September 2009), because Arabic is not mentioned as supported language, and aptitude show texlive-lang-arabic gives as the result:

This package includes the following CTAN packages: 
 arabi -- (La)TeX support for Arabic and Farsi, compliant with Babel.
 arabtex -- Macros and fonts for typesetting Arabic.
 hyphen-arabic --
 hyphen-farsi --

I could't find any documentation of the newly installed package. I'm even not sure if the package allows what I want, i.e. writing using Arabic script directly and not, as it was the case with arabtex, in transcription (and Arabic script was appearing only in output).

If I've missed some relevant information, I can complete my question.

UPDATE

Thanks for everybody. First of all, I've tried to apply Mustail's solution. I've composed the preamble based on his example (mostly the same, just without Persian). I run for it XeLaTeX. Compilation failed, the .log file said that I need xetex package. I had texlive-xetex installed and xetex is mentioned as part of it. Searching further in the Internet I've found that all information about XeLaTeX I can find not match with my LaTeX installation.

I've decided to try the solution proposed by Caramdir and I've made a new TeX Live installation following the instruction in the link. I can't compile any file as I don't have LaTeX nor pdfLaTeX installed and I don't want to install it in other way I've installed TeX Live. In the documentation about installation I've found that I should run tlmgr to manage my LaTeX installation, but I can't do it, command not found.

I have still previous installation of TeX Live on one computer, I can test both (by aptitude and downloaded from tug.org).

Maybe I should post another question concerning installation of TeX Live from tug.org, but I try first here, maybe it's not a real problem but just an omission of something obvious from my part.

UPDATE 2

I was trying to compile Mehro's exemple document (using instalation of LaTeX from Ubuntu packages), without succes. This is the terminal's output (starting from first warning):

Package polyglossia Warning: No hyphenation patterns were loaded for `arabic'
(polyglossia)                I will use the patterns loaded for \language=0
(polyglossia)                instead on input line 7.

) (./mehro.aux)
kpathsea: Running mktextfm 
/usr/share/texmf/web2c/mktexnam: Could not map source abbreviation 6 for 600.
/usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input 
This is METAFONT, Version 2.718281 (TeX Live 2009/Debian)


kpathsea: Running mktexmf 
! I can't find file `'.
<*> \mode:=ljfour; mag:=1; nonstopmode; input

Please type another input file name
! Emergency stop.
<*> \mode:=ljfour; mag:=1; nonstopmode; input

Transcript written on mfput.log.
grep: .log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ' failed to make .tfm.
kpathsea: Appending font creation commands to missfont.log.

! Font \zf@basefont="" not loadable: Metric (TFM) file or installed font not fo
und.
<to be read again> 
                   \zf@family@fontdeflmr 
l.15 ...abic: \textarabic{السلام عليكم}

? ^C! Interruption.
<argument> ...@family@fontdef\f@family \endcsname 
                                                  " at \f@size pt \zf@check@...

I had a look in Polyglossia documentation, but I didn't find there nothing what could help me to compile document.

It seems I have more general problem with fonts for XeTeX. Fontspec documentation opens but should lack of some fonts as I see white gaps in some places. The termial output is quite long and consist almost of 'error' messages. This are just few lines of it:

Error: Missing language pack for 'Adobe-Japan1' mapping 
Error: Unknown font tag 'F5.1' 
Error (24124): No font in show 
Error: Unknown font tag 'F5.1' 

UPDATE 3

I have maneged to install Linux Liberation O and Scheherazade via Ubuntu Sotware Center (although I still can't understand why I could't do that via Synaptic nor aptitude...), so Meho's and Alan's exemple files are compiled succesfully.

Documentation became readable after installation of poppeler data. I'm still not able to compile Mustail's exemple file, but having acces to documentation I can try to solve it.

Thanks a lot for everybody for your help.

share|improve this question
    
I think you should post a separate question about installing. A good guide will also be useful to others. –  Caramdir Mar 1 '11 at 21:50
    
Your first problem might be related to tex.stackexchange.com/questions/652/… –  Caramdir Mar 1 '11 at 21:52
    
@Caramdir: Thanks a lot for the link and advice. Unfortunatly, the link didn't solve the problem. I have had already lmodern package installed, still no output. I have now also information about problems with fonts: Latin Modern Sans not found. I've commented the line and than compilation stops on `\begin{document}... Actually I've decided to try to install from the source you've mentioned becouse I was not able to find out where I have installed fonts... I'll post a separate question about second problem. –  maria Mar 1 '11 at 22:21
add comment

4 Answers 4

up vote 15 down vote accepted

I usually use XeLaTeX with Polyglossia. A quick example:

\documentclass{book}

\usepackage{setspace}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Scheherazade}

\begin{document}

Some latin text and inline arabic: \textarabic{السلام عليكم}

And for larger blocks of text you can use Arabic environment:

\begin{Arabic}

العربية أكثر لغات المجموعة السامية متحدثينَ، وإحدى أكثر اللغات انتشارًا في العالم، يتحدثها أكثر من 422 مليون نسمة،1 ويتوزع متحدثوها في المنطقة المعروفة باسم الوطن العربي، بالإضافة إلى العديد من المناطق الأخرى المجاورة كالأحواز وتركيا وتشاد ومالي السنغال وإرتيريا. اللغة العربية ذات أهمية قصوى لدى المسلمين، فهي لغة مقدسة (لغة القرآن)، ولا تتم الصلاة (وعبادات أخرى) في الإسلام إلا بإتقان بعض من كلماتها. العربية هي أيضا لغة شعائرية رئيسية لدى عدد من الكنائس المسيحية في الوطن العربي، كما كتبت بها الكثير من أهم الأعمال الدينية والفكرية اليهودية في العصور الوسطى. وأثّر انتشار الإسلام، وتأسيسه دولاً، في ارتفاع مكانة اللغة العربية، وأصبحت لغة السياسة والعلم والأدب لقرون طويلة في الأراضي التي حكمها المسلمون، وأثرت العربية، تأثيرًا مباشرًا أو غير مباشر على كثير من اللغات الأخرى في العالم الإسلامي، كالتركية والفارسية والكردية والأوردية والماليزية والإندونيسية والألبانية وبعض اللغات الإفريقية الأخرى مثل الهاوسا والسواحيلية، وبعض اللغات الأوروبية وخاصةً المتوسطية منها كالإسبانية والبرتغالية والمالطية والصقلية. كما أنها تدرس بشكل رسمي أو غير رسمي في الدول الإسلامية والدول الإفريقية المحاذية للوطن العربي.

العربية لغة رسمية في كل دول الوطن العربي إضافة إلى كونها لغة رسمية في تشاد وإريتيريا وإسرائيل. وهي إحدى اللغات الرسمية الست في منظمة الأمم المتحدة.

تحتوي العربية على 28 حرفًا مكتوبًا. ويرى بعض اللغويين أنه يجب إضافة حرف الهمزة إلى حروف العربية، ليصبح عدد الحروف 29. تكتب العربية من اليمين إلى اليسار - مثلها اللغة الفارسية والعبرية وعلى عكس الكثير من اللغات العالمية - ومن أعلى الصفحة إلى أسفلها.

\end{Arabic}

To get even spacing between lines, you can use \verb|\lineskiplimit| command (locally or globally, preferably locally) and set spacing with \verb|setspace| or \verb|leading| package to avoid possible overlapping:

\begin{Arabic}
\lineskiplimit=-1000pt
\setstretch{1.2}

العربية أكثر لغات المجموعة السامية متحدثينَ، وإحدى أكثر اللغات انتشارًا في العالم، يتحدثها أكثر من 422 مليون نسمة،1 ويتوزع متحدثوها في المنطقة المعروفة باسم الوطن العربي، بالإضافة إلى العديد من المناطق الأخرى المجاورة كالأحواز وتركيا وتشاد ومالي السنغال وإرتيريا. اللغة العربية ذات أهمية قصوى لدى المسلمين، فهي لغة مقدسة (لغة القرآن)، ولا تتم الصلاة (وعبادات أخرى) في الإسلام إلا بإتقان بعض من كلماتها. العربية هي أيضا لغة شعائرية رئيسية لدى عدد من الكنائس المسيحية في الوطن العربي، كما كتبت بها الكثير من أهم الأعمال الدينية والفكرية اليهودية في العصور الوسطى. وأثّر انتشار الإسلام، وتأسيسه دولاً، في ارتفاع مكانة اللغة العربية، وأصبحت لغة السياسة والعلم والأدب لقرون طويلة في الأراضي التي حكمها المسلمون، وأثرت العربية، تأثيرًا مباشرًا أو غير مباشر على كثير من اللغات الأخرى في العالم الإسلامي، كالتركية والفارسية والكردية والأوردية والماليزية والإندونيسية والألبانية وبعض اللغات الإفريقية الأخرى مثل الهاوسا والسواحيلية، وبعض اللغات الأوروبية وخاصةً المتوسطية منها كالإسبانية والبرتغالية والمالطية والصقلية. كما أنها تدرس بشكل رسمي أو غير رسمي في الدول الإسلامية والدول الإفريقية المحاذية للوطن العربي.

العربية لغة رسمية في كل دول الوطن العربي إضافة إلى كونها لغة رسمية في تشاد وإريتيريا وإسرائيل. وهي إحدى اللغات الرسمية الست في منظمة الأمم المتحدة.

تحتوي العربية على 28 حرفًا مكتوبًا. ويرى بعض اللغويين أنه يجب إضافة حرف الهمزة إلى حروف العربية، ليصبح عدد الحروف 29. تكتب العربية من اليمين إلى اليسار - مثلها اللغة الفارسية والعبرية وعلى عكس الكثير من اللغات العالمية - ومن أعلى الصفحة إلى أسفلها.

\end{Arabic}

\end{document}
share|improve this answer
    
@Mehro Thanks a lot. Do you use also polyglossia for typesetting a document in one language? In any case, it will be useful for me for multi-languages documents, the day I manage to make it working :) Could you tell me what kind of installation of LaTeX do you use? More details in the body of question. –  maria Mar 1 '11 at 21:54
3  
Consider polyglossia "babel for XeLaTeX" which means you should use it whenever using XeLaTeX, even if there's only one language. As for TeXLive installation, there is no tlmgr if TL is installed from repos. But if you install it from DVD or using netinstall, it'll be there. –  Meho R. Mar 2 '11 at 2:37
    
@Meho I was trying to compile your document - failed... As for tlmgr, I was trying to run it in installation from TUG, but it seems there is more general problem, it doesn't work at all (I've asked separate question for it), so for the moment I'm trying to run XeLaTeX on installation from repos. The result is in main question under UPDATE 2. Thanks –  maria Mar 3 '11 at 9:02
    
@Maria, regarding fonts, for running this example you only need Scheherazade font installed. You can find it in Ubuntu's repos, or you can download it from sil.org and put it into ~/.fonts directory (this is shortcut for /home/your_username/.fonts). –  Meho R. Mar 3 '11 at 12:08
    
@Meho But I don't have such a directory... In ~/ I have only .fontconfig under .f. Looking for (using locate) *.fonts* I can find only two files fonts.gz in /usr/share/doc/console-setup. –  maria Mar 3 '11 at 13:31
show 4 more comments

Although I am no expert in LaTeX and Arabic typesetting, I have had some experience in using Arabic and Persian in TeX environment, that I can share.

I have tried arabi and babel in the past, it worked out well, however, I had problems with fonts. Then, as most people would do, I switched to XeLaTeX (or XeTeX, I'm not sure which one means what, I use it anyway..), which is an evolution of LaTeX in terms of fonts and language usage.

I suggest you have a look at XeLaTeX. You don't need the package babel anymore in XeLaTeX, and the package arabxetex, the XeLaTeX counterpart of the LaTeX packages arabi or arabtex, is superior to both in my experience.

This is how my preamble looks like:

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{arabxetex}

\newfontfamily\arabicfont[Script=Arabic, Scale=1]{Traditional Arabic}
\newfontfamily\farsifont[Script=Arabic, Scale=1]{Farsi Simple Bold}
\defaultfontfeatures{Mapping=tex-text}

\usepackage[T1]{fontenc}

\setsansfont[Mapping=text-text]{Latin Modern Sans}

My font for Arabic and Persian are respectively Traditional Arabic and Farsi Simple, which are available in Windows.

And this is how I address Arabic and Persian within my text:

\textarab[utf]{ ...كمثل الحمار يحمل أسفاراً ...}

\textfarsi[utf]{هم عمل هم علم باهم یار داشت}

Unfortunately, the documentation in XeLaTeX, as is the case with LaTeX and many other open source software, is scarce and/or poorly presented. (I do not mean to detract from the great amount of work devoted to these projects, but I wish the barrier for entry could be made lower.) It takes time to learn but it pays in the end.

Hope this helps.

share|improve this answer
    
Welcome to tex.sx! A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). You can mark short passages of code with backticks (`). –  Caramdir Mar 1 '11 at 3:10
    
XeTeX is an extension of the TeX typesetting engine. XeLaTeX is using LaTeX on top of that (LaTeX is basically just a bunch of TeX macros that are loaded automatically when you call (pdf/xe/lua)latex. You don't need \usepackage[T1]{fontenc} with XeLaTeX and xunicode is automatically loaded with recent versions of fontspec. –  Caramdir Mar 1 '11 at 3:12
    
+1 for XeLaTeX; Most of the documentation you need for using xelatex is contained in the fontspec documentation, which is very clear and helpful. The arabxetex documentation is also very clear. Other than that, XeLaTeX is just latex. –  Alan Munn Mar 1 '11 at 3:26
    
The arabxetex solution is mainly intended for people who are used to using the arabtex system, which was designed for people who needed to input Arabic without access to an Arabic keyboard layout. If you are typing Arabic text directly, you should probably just use xelatex and polyglossia as in Meho's answer. –  Alan Munn Mar 1 '11 at 18:14
1  
@Maria Unfortunately I use a Mac, not linux, so I don't have any experience with fonts in Linux. The main thing to understand about XeLaTeX is that it is not dependent on fonts installed as part of your TeX Live distribution, but by default uses the fonts that are available on your system for any application. (E.g. if you have OpenOffice installed, any font that you can use with OpenOffice, you should be able to use with XeLaTeX as well.) –  Alan Munn Mar 3 '11 at 15:03
show 7 more comments

I don't know about typesetting arabic, but I did watch this presentation by Idris Hamid from TUG 2010 about a project called Oriental TeX, and remember being rather impressed by it.

I understood it is using ConTeXt mkIV and LuaTeX.

share|improve this answer
1  
Thanks for the link to the presentation. it turned out to be extremely beneficial –  Ibn Saeed Jun 20 at 10:09
add comment

I don't really know anything about typesetting Arabic with LaTeX. The following should be comments, but turned out to be too long for the comment field.

  • CTAN always has the most current stable packages.
  • September 2009 is not outdated, in comparison to the packages you have installed. Ubuntu 10.04 (and 10.10) contain TeX Live 2009, which was packages sometime in summer 2009.
  • Generally you can find the documentation for packages you have installed with texdoc 〈packagename〉 on the command line. However, this mechanism seems to be rather broken with the Ubuntu packages (at least on my system).
  • Documentation (if it exists) can always be found on CTAN. For example for arabi and arabtex. Both of these packages haven't seen a lot development recently though.
  • Instead of using the traditional pdfTeX engine for your documents, you could use XeLaTeX or LuaLaTeX, two engines that accept the full range of Unicode input and arbitrary TrueType and OpenType fonts. You can try to adapt the answer to a similar question for Devanagari. Compile the document with xelatex instead of (pdf)latex.
  • If you use this last suggestion, I would also suggest that you replace the Ubuntu packages with the latest version of TeX Live to be able to use all the recent developments.
share|improve this answer
    
Thanks a lot for useful informations. I've tried to follow your suggestion, the result of my attempts is in main question in UPDATE. I'm not sure if it makes part of the problem for which I've posted this question or should I post another one. –  maria Mar 1 '11 at 21:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.