1
 \documentclass{article}
    \usepackage{fontspec}

    \setmainfont[Ligatures=TeX]{Times New Roman}
    \newfontfamily\arabicfont
        [Script=Arabic,     % to get correct arabic shaping
        Scale=1.2]          % make the arabic font bigger, a matter of taste
            {Arial}     % whatever Arabic font you like

    \newcommand{\textarabic}[1]     % Arabic inside LTR
        {\bgroup\textdir TRT\arabicfont #1\egroup}
    \newcommand{\n}         [1]     % for digits inside Arabic text
        {\bgroup\textdir TLT #1\egroup}
    \newcommand{\afootnote} [1]     % Arabic footnotes
        {\footnote{\textarabic{#1}}}
    \newenvironment{Arabic}     % Arabic paragraph
        {\textdir TRT\pardir TRT\arabicfont}{}

    \begin{document}

    English text ``\textarabic{جملة عربية وسط جملة إنجليزية}'' with Arabic in
    between. English paragraph left aligned English paragraph left aligned English
    paragraph left aligned English paragraph left aligned English paragraph left
    aligned English paragraph left aligned English paragraph left aligned English
    paragraph left aligned English paragraph left aligned English paragraph left
    aligned English paragraph left aligned.

    \begin{Arabic}
    فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \n{١٢٣٤٥} فقرة عربية
    محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
    فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
    اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
    اليمين\afootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
    \end{Arabic}

    \end{document}

I got the following code from here but when i was trying to compilate it i got this error messege even if i am using Xelatex and lualatex any help please

> ! Fatal fontspec error: "cannot-use-pdftex" ! ! The fontspec package
> requires either XeTeX or LuaTeX. ! ! You must change your typesetting
> engine to, e.g., "xelatex" or ! "lualatex"instead of "latex" or
> "pdflatex". ! ! See the fontspec documentation for further
> information. ! ! For immediate help type H <return>.

closed as unclear what you're asking by TeXnician, Phelype Oleinik, Stefan Pinnow, Troy, marmot Sep 27 '18 at 4:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    The code works for me when compiled with lualatex. With xelatex I got a error about \textdir being undefined. I never got cannot-usepdf-tex. – moewe May 19 '18 at 11:37
  • @moewe I am so beginer with LaTeX, could you recommand something to me for this kind or error i got ? – F.Marko May 19 '18 at 11:41
  • I don"t know what happening with me in this time I got Log file not found! – F.Marko May 19 '18 at 11:43
  • Welcome to TeX.SX! Could you compile any other file with lualatex? – Bobyandbob May 19 '18 at 11:49
  • 1
    Than How do you configure Texmaker to use LuaTeX? could be intresting for you (if you are using texmaker). – Bobyandbob May 19 '18 at 11:55

Browse other questions tagged or ask your own question.