1

So I wish to include a few Arabic characters in my text which is primarily composed of Latin characters. Apparently this can be done using the package arabtex.

However, it does not want to compile properly. I know I have unicode support, as I am able to render IPA characters and some more obscure Latin characters.

I have directly copied the following example from Overleaf:

\documentclass[a4paper,10pt]{article}
\usepackage{arabtex}
\usepackage{utf8}
\setcode{utf8}
\begin{document}
Here is the word ``Arabic'' written in Arabic:  \<اَلْعَرَبِيَّةُ>. You can also use the command \verb|\RL{arabic text}| like this: \RL{اَلْعَرَبيَّةُ}.
\end{document}

It compiles in the online compiler, but when I run it through XeLaTeX on my Linux machine, it compiles, but does not render the Arabic characters, and when run through LuaLaTeX, it doesn't compile at all.

I have no idea what's going on here.

Edit:

Some of the compile errors from LuaLaTeX

! String contains an invalid utf-8 sequence.
l.1299 \global\a@first = {
                        ����ϕ}%

! String contains an invalid utf-8 sequence.
l.1300 \catcode `
               � 1 11

And the Full output from XeLaTeX

xelatex test.tex 
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/arabtex.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/aconfig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/arabaux.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/acmd.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/afonts.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/afonts2.sty))
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/ascan.sty
(ArabTeX) scanner for code `arabtex' installed.
(ArabTeX) input encoding set to ArabTeX standard conventions.)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/aparse.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/awrite.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/xarbsymb.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/arabskel.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/xarbskel.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/aboxes.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/arabtoks.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/arabchrs.sty))
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/aligs.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/aoutput.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/abidir.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/atrans.sty
(ArabTeX) ZDMG transliteration.)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/alatex.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/afoot.sty))
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/abjad.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/apatch.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/alists.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/asect.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/atabg.sty)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/alocal.sty
(ArabTeX) 3.11 local stub, 26.02.2006))
Arabic processor `ArabTeX' [20060702 patch level 3.11s (02.07.2006)]
(ArabTeX) ... now be patient ... )
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/utf8.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/utfcode.sty)
(ArabTeX) scanner for code UTF-8 installed.)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def)
(./test.aux) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/apatch.sty
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/alocal.sty
(ArabTeX) 3.11 local stub, 26.02.2006)
(ArabTeX) version 3.11s (02.07.2006): second phase of patching)
(ArabTeX) input encoding set to UTF-8 conventions
(/usr/share/texlive/texmf-dist/tex/latex/arabtex/Uxnsh.fd) [1] (./test.aux)

 *File List*
 article.cls    2019/12/20 v1.4l Standard LaTeX document class
  size10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
 arabtex.sty    2003/08/22  3.11 ArabTeX main module
 arabaux.sty    2003/05/21  3.11 auxiliary macros for ArabTeX
    acmd.sty    2003/08/20  3.11 Arabic command processing 
  afonts.sty    1995/11/16  3.04 define Naskh font 
 afonts2.sty    1998/10/19  3.10 define Naskh fonts for LaTeX2e
   ascan.sty    2003/08/22  3.11 standard ZDMG input encoding 
  aparse.sty    2003/05/26  3.11 get syllables 
  awrite.sty    2003/06/05  3.11 build output word 
xarbsymb.sty    1998/07/15  3.07 symbolic output encoding 
arabskel.sty    2000/06/04  3.10 character skeleton definitions 
xarbskel.sty    1999/07/17  3.09 character skeleton definitions 
  aboxes.sty    2003/05/28  3.11 build output boxes
arabtoks.sty    1999/07/17  3.09 ArabTeX CS token definitions 
arabchrs.sty    1998/07/11  3.07 letter token definitions 
   aligs.sty    2003/05/26  3.11 compute ligatures
 aoutput.sty    2000/06/04  3.10 build output lines
  abidir.sty    2003/08/22  3.11 bidirectional linebreaking
  atrans.sty    2003/06/14  3.11 generate the transliteration 
  alatex.sty    2003/05/04  3.11 ArabTeX extensions for LaTeX 
   afoot.sty    2003/05/12  3.11 ArabTeX footnotes
   abjad.sty    2003/04/26  3.11 abjad numerals 
  apatch.sty    2006/07/02  3.11s last minute patches 
  alists.sty    2003/04/26  3.11 inverted list macros
   asect.sty    2003/04/26  3.11 section macros for Arabic
   atabg.sty    1997/01/21  3.05 LaTeX tabbing macros for Arabic
    utf8.sty    2000/06/13  3.10 UTF-8 input encoding 
 utfcode.sty    2002/03/07  3.10a Arabic+Hebrew segment of UTF-8
l3backend-xdvipdfmx.def    2020-02-03 L3 backend support: xdvipdfmx
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
  apatch.sty    2006/07/02  3.11s last minute patches 
   Uxnsh.fd
 ***********

 )
(see the transcript file for additional information)
Output written on test.pdf (1 page).
Transcript written on test.log.
1
  • 1
    arabtex is for use with pdflatex. You want arabxetex or arabluatex. There are examples of the usage of these packages elsewhere on this site.
    – Thérèse
    Sep 30, 2022 at 18:13

1 Answer 1

3

If you just have a few words you don't need package support for a full bidi setup, just choose fonts that have the characters. xelatex then gives

enter image description here

\documentclass[a4paper,10pt]{article}
\usepackage{fontspec}
\setmainfont{Noto Sans}
\newfontfamily\afont{Noto Sans Arabic}

\begin{document}
Here is the word ``Arabic'' written in Arabic: {\afont اَلْعَرَبِيَّةُ}. You
can also use the command \verb|\RL{arabic text}| like this:
 {\afont اَلْعَرَبيَّةُ}.
\end{document}
2
  • Thanks. That worked!
    – JRCSalter
    Sep 30, 2022 at 20:19
  • Beware: this works only for single words. If there are several ones, they are ordered left-to-right, even if the words are ‘internally’ right-to-left. I’d follow the advice by Thérèse above. Oct 1, 2022 at 6:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .