16

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}
  • The documentation suggests that hello \RL{السَلامُ عَليكم ورَحمةُ الله وبَركاته} arabic. should work. – Scott H. Jun 20 '13 at 21:24
  • 1
    Welcome to TeX.sx! Your post was migrated here from [so]. 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
  • 1
    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 02:56
  • 1
    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

1 Answers1

17

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}

Result

Heiko Oberdiek
  • 271,626
  • @HeikoOberdiek i tired the same code in TexnicCenter but i doesn't work, any suggestion ? – khaled Feb 10 '14 at 13:56
  • 1
    @user1200219: Please, be more specific including error messages, problem description, ... – Heiko Oberdiek Feb 10 '14 at 15:54
  • 1
    @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
  • Using TexLive 2016, no complaints in command line output, but just black boxes where the arabic characters are in the document. – MikeiLL Sep 04 '16 at 04:45
  • 1
    @MikeiLL The example works for me in TeX Live 2016. Maybe a PDF viewer issue. – Heiko Oberdiek Sep 04 '16 at 07:46
  • @HeikoOberdiek You are correct. I'm not sure what I was doing wrong. May have had the wrong extension (lytex) or been running with XeLaTeX (although that's giving command line errors) – MikeiLL Sep 05 '16 at 00:58
  • Please how can I add some english words inside \begin{arabtext} – F 505 Dec 27 '17 at 05:50
  • If I used the same approach mentioned in your answer, all the paragraph appears in one line – F 505 Dec 27 '17 at 06:14
  • @HeikoOberdiek , this way generated other errors for me, for example after using it I missed the numbers of the sessions !? do you have an Idea about it? – Minions Jun 18 '19 at 11:54