Arabic in latex [duplicate]

how to write Arabic words between English script in latex? I tried this code but it writes Arabic text in new line

\documentclass[a4paper,10pt]{article}
%In the preamble section include the arabtex and utf8 packages
\usepackage{arabtex}
\usepackage{utf8}

\begin{document}
%start encoding to unicode
%Note that your layout must support arabic text when compiling
\setcode{utf8}
%To start typing in Arabic use the command arabtext
hello
\begin{arabtext}
السَلامُ عَليكم ورَحمةُ الله وبَركاته
\end{arabtext}
arabic
\end{document}


migrated from stackoverflow.comJun 20 '13 at 21:18

This question came from our site for professional and enthusiast programmers.

• The documentation suggests that hello \RL{السَلامُ عَليكم ورَحمةُ الله وبَركاته} arabic. should work. – Scott H. Jun 20 '13 at 21:24
• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jun 20 '13 at 21:24
• The accepted answer to this question: Typesetting a document using Arabic script should be what you need. This question is essentially a duplicate. – Alan Munn Jun 21 '13 at 2:56
• I'm a little surprised at Alan's comment: this question is precisely NOT about typesetting a whole document in Arabic script, but about including a short fragment of Arabic within English text. This question is NOT a duplicate. – Peter Flynn Aug 17 '16 at 21:03

From reading the documentation I deduced that \<> will do the trick:

\documentclass[a4paper,10pt]{article}
%In the preamble section include the arabtex and utf8 packages
\usepackage{arabtex}
\usepackage{utf8}

\begin{document}
%start encoding to unicode
%Note that your layout must support arabic text when compiling
\setcode{utf8}
%To start typing in Arabic use the command arabtext
hello
\<السَلامُ عَليكم ورَحمةُ الله وبَركاته  >
arabic
\end{document}


• @HeikoOberdiek i tired the same code in TexnicCenter but i doesn't work, any suggestion ? – khaled Feb 10 '14 at 13:56
• @user1200219: Please, be more specific including error messages, problem description, ... – Heiko Oberdiek Feb 10 '14 at 15:54
• @HeikoOberdiek there is no error but it shows strange character which is not Arabic – khaled Feb 10 '14 at 15:58
• @user1200219: I do not even know, where (editor window, PDF viewer, ...) you are seeing the strange characters. Check, if your software is uptodate (TeXnicCenter, TeX distribution) and ask a new question. I am neither an expert for TeXnicCenter nor package arabtex. – Heiko Oberdiek Feb 10 '14 at 16:19
• @MikeiLL The example works for me in TeX Live 2016. Maybe a PDF viewer issue. – Heiko Oberdiek Sep 4 '16 at 7:46