[Tex/LaTex] Arabic Typesetting with texmaker editor and pdfLatex

arabicfontstexmaker

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 :
enter image description here

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}

Best Answer

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}

Chapter title

\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.

Related Question