插入阿拉伯语文本时遇到问题

插入阿拉伯语文本时遇到问题

因此,我希望在主要由拉丁字符组成的文本中包含一些阿拉伯字符。显然,这可以使用 arabtex 包来实现。

但是,它无法正确编译。我知道我有 unicode 支持,因为我能够渲染 IPA 字符和一些更晦涩的拉丁字符。

我直接复制了以下示例背页

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

它在在线编译器中进行编译,但是当我在 Linux 机器上通过 XeLaTeX 运行它时,它会进行编译,但不会呈现阿拉伯字符,而当通过 LuaLaTeX 运行时,它根本不会编译。

我不知道这里发生了什么事。

编辑:

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

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

如果你只有几个单词,你不需要完整的 bidi 设置包支持,只需选择具有字符的字体即可。xelatex 然后给出

在此处输入图片描述

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

相关内容