# Arabic Typesetting with texmaker editor and pdfLatex

I'm writing a book in French, but i need to write a chapter in Arabic. To do so I've used the arabtex.

\usepackage{arabtex}


after the preamble I've done this

\chapter*{\<السلام عليكم>}


After compiling my code i get this :

! Illegal arabic command: ?.\a@cmderr ...age {Illegal arabic command: \nxp #1}\a@@cmd = {{\a@puttt #1\ar... \chapter{\<?????? ?????>}

But when ii change the arabic letter with the \<> tag

\chapter*{\<this is an arabic message>}


I got :

which is kind of random and insignificant, so how can I write in arabic in my texmaker editor and compile my code properly ?

EDIT : This is a full Example :

  \documentclass[parskip=full,12pt,a4paper,twoside,frenchb,openany,fleqn]{book}
\usepackage{arabtex}
\usepackage[latin1]{inputenc}
\usepackage{titlesec}
\usepackage{ae}
\usepackage{aecompl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[Sonny]{fncychap}
\begin{document}
\chapter{\<سلام>}
\end{document}

• Did you think of using XeLaTeX, arabxetex and polyglossia? – Bernard Jun 15 '14 at 14:56
• Please complete your code to provide a small, compilable document demonstrating the issue. This allows people to understand your situation and reproduce the problem - prerequisites for offering you much by way of useful advice! – cfr Jun 15 '14 at 14:58
• @cfr : A full example has been Added.. Thank you – Guen_hamza Jun 15 '14 at 15:10
• You've specified latin1 as your input encoding (twice) but the characters you've typed are not in latin1. If you want to input Arabic characters directly, you want to be using unicode. XeLaTeX is one option but you can use (pdf)LaTeX with arabtex as described on page 34 of the user manual. You need the utf8 option for inputenc and \setcode{utf8} and make sure that the file really is saved in UTF-8 encoding. Then you can switch to Arabic language and arabtex should expect UTF-8 encoded characters. – cfr Jun 15 '14 at 15:22
• @cfr I've changed the inputenc to utf8 and i did the setcode{utf8}, But i'm still having the same problem "! Illegal arabic command: ?. " and after saving the file and re-opening it, i realise that the letters are turning into question marks ... Thanks for the effort – Guen_hamza Jun 15 '14 at 15:29

This is covered in the documentation. Page 34 of the manual explains how to use UTF-8 encoding. Applying the instructions to your example:

\documentclass[parskip=full,12pt,a4paper,twoside,frenchb,openany,fleqn]{book}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage{utf8}
\setcode{utf8}
\usepackage{titlesec}
\usepackage{ae}
\usepackage{aecompl}
\usepackage[T1]{fontenc}
\usepackage[frenchb]{babel}
\usepackage[Sonny]{fncychap}
\begin{document}
\setarab
\chapter{\<سلام>}
\end{document}


\usepackage[utf8]{inputenc} is not necessary but you cannot save your file in two input encodings so you need either utf8 or latin1. Hence, you'll need to change the option for inputenc as shown since you want to use UTF-8 for Arabic.

Note that this code is using obsolete commands. (Something is still using pre-LaTeX2e font switches, for example.) Also, you should consider switching from ae and using cm-super or lmodern fonts which include the characters and don't need the emulation.

When saving the file, you have to ensure that it is saving in the correct encoding. If you were using latin1, try saving a new version and double-check the encoding your editor is using. Otherwise you will find characters becoming question marks.